Skip to content

Feature: Setup Cosmos CLI #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.bazel
build/
bazel-bin
bazel-out
bazel-testlogs
2 changes: 2 additions & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BAZELISK_HOME=build/.bazelisk
USE_BAZEL_VERSION=6.3.2
10 changes: 10 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
startup --output_user_root=build/.bazel
startup --output_base=build/bazel

build --cxxopt -std=c++17
build --cxxopt -g

# Config to build for optimized with debug information

build:optdbg -c opt
build:optdbg --copt -g
103 changes: 103 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: RitheeshBaradwaj

---

## Description

A clear and concise description of what the issue is.

## Steps to Reproduce

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## Expected Behavior

A clear and concise description of what you expected to happen.

## Screenshots

If applicable, add screenshots to help explain your problem.

## Additional Information

- Operating System: [e.g. Windows, macOS, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 22]

## To Do

- [ ] Task 1
- [ ] Task 2

## Labels

- bug
- enhancement
- question

## Milestone

- [ ] Milestone 1
- [ ] Milestone 2

## Assignees

- [ ] @username1
- [ ] @username2
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: RitheeshBaradwaj

---

## Feature Request

### Problem Statement

Briefly describe the problem or pain point that this feature request is trying to solve.

### Proposed Solution

Outline the proposed solution for addressing the problem. Provide as much detail as possible about how the feature would work and what it would accomplish.

### Use Cases

Describe how this feature would be used and by whom. Include any relevant examples or scenarios.

### Alternatives Considered

Have you considered any alternative solutions or workarounds? If so, please explain why the proposed solution is a better fit.

### Additional Context

Is there any additional information or context that would be helpful in considering this feature request?
33 changes: 33 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Description

Please provide a clear and concise description of what changes were made and why.

## Checklist

- [ ] Code has been tested and is working as expected
- [ ] Documentation has been updated, if necessary
- [ ] All relevant tests have been added and passed
- [ ] Code follows the project's coding style and standards
- [ ] Changes do not introduce any new bugs

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

<!-- Uncomment the following lines and add meanigful information

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

## Additional context

Add any other relevant information or screenshots.

## Mentions

- @mention any relevant people who should be aware of this pull request. -->
76 changes: 76 additions & 0 deletions .github/workflows/auto_lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Fix linting errors

on:
push:
branches:
- '!main'
pull_request:

jobs:
analyse:
runs-on: ubuntu-latest

steps:
- name: Install Clang Format
run: |
sudo apt-get update
sudo apt-get install -y clang-format

- name: Set branch name
run: |
echo "BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH_NAME }}

- name: Run clang-format
run: |
clang-format -i src/*.cpp

- name: Commit changes
id: commit_changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit."
echo "NO_COMMIT=true" >> $GITHUB_ENV
exit 0
fi
git commit -m "Fix linting errors"

- name: Push changes
id: push_changes
if: ${{ env.NO_COMMIT != 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}

- name: Comment on Pull Request
if: (${{ env.NO_COMMIT }} != 'true') && (${{ github.event_name }} == 'pull_request')
uses: actions/github-script@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
if (process.env.NO_COMMIT !== 'true') {
const result = await github.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: context.sha,
});

if (result.data.length) {
const pullRequest = result.data[0];
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pullRequest.number,
body: 'Linting errors observed and fixed 🎉. Please pull the latest changes!!',
});
}
}
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Test Cosmos CLI

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Bazelisk
run: |
# Install Bazelisk
curl -Lo bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
chmod +x bazel
mkdir -p "$HOME/bin"
mv bazel "$HOME/bin/"
export PATH="$HOME/bin:$PATH"
bazel --version

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y g++

- name: Build and Test
run: |
./tools/build.sh
Loading