From f0a783bb4190d3d5aaa1dfd9fd84400c2cedaed1 Mon Sep 17 00:00:00 2001 From: Deepak Bomjan Date: Wed, 19 Jun 2024 11:13:42 +0545 Subject: [PATCH] ci: add cicd --- .github/ISSUE_TEMPLATE/bug_report.md | 24 +++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++++ .github/ISSUE_TEMPLATE/task-template.md | 27 ++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 28 +++++++++++++++ .github/labeler.yml | 11 ++++++ .github/workflows/auto-pr-labeler.yml | 32 +++++++++++++++++ .../build-test-soroban-contracts.yml | 35 +++++++++++++++++++ .github/workflows/check-pr-label.yml | 25 +++++++++++++ .github/workflows/lint-pr.yml | 18 ++++++++++ .github/workflows/soroban-codecov.yml | 35 +++++++++++++++++++ 10 files changed, 255 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/task-template.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/auto-pr-labeler.yml create mode 100644 .github/workflows/build-test-soroban-contracts.yml create mode 100644 .github/workflows/check-pr-label.yml create mode 100644 .github/workflows/lint-pr.yml create mode 100644 .github/workflows/soroban-codecov.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..ddf85ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: iBriz +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +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. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..0805004 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: iBriz +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/task-template.md b/.github/ISSUE_TEMPLATE/task-template.md new file mode 100644 index 0000000..901bca6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/task-template.md @@ -0,0 +1,27 @@ +--- +name: Task Template +about: New tasks created should consist of the following information +title: '' +labels: iBriz +assignees: '' + +--- + +### What needs to be done + +Describe what needs to be done here. +Ex: "Relay synchronization starts from the most recently stored block header" + +### Why it needs to be done + +Describe why it needs to be done here. +Ex: "Reduces the amount of time for the relay to synchronize to the latest block" + +### Acceptance Criteria + +Describe how we can know whether the task is done. +Ex: When restarting the relay, synchronization picks up from the most recently stored block + +### Additional Information + +Describe anything relevant that hasn't been mentioned yet. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1b818da --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ +## Description + +### Commit Message + +```bash +type: commit message +``` + +see the [guidelines](https://github.com/icon-project/community/blob/main/guidelines/technical/software-development-guidelines.md#commit-messages) for commit messages. + +### Changelog Entry + +```bash +version: +``` + +## Checklist + +- [ ] I have performed a self-review of my own code +- [ ] I have documented my code in accordance with the [documentation guidelines](https://github.com/icon-project/community/blob/main/guidelines/technical/software-development-guidelines.md#documentation) +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] I have run the unit tests +- [ ] I only have one commit (if not, squash them into one commit). +- [ ] I have a descriptive commit message that adheres to the [commit message guidelines](https://github.com/icon-project/community/blob/main/guidelines/technical/software-development-guidelines.md#commit-messages) +- [ ] I have added version bump label on PR. + +> Please review the [CONTRIBUTING.md](/CONTRIBUTING.md) file for detailed contributing guidelines. diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..7b083b8 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,11 @@ +cicd: + - '.github/workflows/*' + +scripts: + - 'scripts/*' + +test: + - 'test/**' + +documentation: +- '**/*.md' \ No newline at end of file diff --git a/.github/workflows/auto-pr-labeler.yml b/.github/workflows/auto-pr-labeler.yml new file mode 100644 index 0000000..906947f --- /dev/null +++ b/.github/workflows/auto-pr-labeler.yml @@ -0,0 +1,32 @@ +name: Pull Request Labeler +on: + pull_request: + types: + - opened + - edited + - synchronize +jobs: + auto-label: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Find Current Pull Request + uses: jwalton/gh-find-current-pr@v1.3.2 + id: findPr + with: + # Can be "open", "closed", or "all". Defaults to "open". + state: open + - run: echo "PR Number is ${PR}" + if: success() && steps.findPr.outputs.number + env: + PR: ${{ steps.findPr.outputs.pr }} + + - name: check pr pr-number + run: echo ${{ github.event.number }} + + - uses: actions/labeler@v4 + with: + dot: true + pr-number: ${{ steps.findPr.outputs.pr }} diff --git a/.github/workflows/build-test-soroban-contracts.yml b/.github/workflows/build-test-soroban-contracts.yml new file mode 100644 index 0000000..e81a2ac --- /dev/null +++ b/.github/workflows/build-test-soroban-contracts.yml @@ -0,0 +1,35 @@ +name: Build and Test Balanced Soroban contracts +on: + push: + branches: + - '**' + pull_request: + branches: + - main + +jobs: + Build: + name: Build Soroban Contracts + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v3 + with: + submodules: true + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.78.0 + target: wasm32-unknown-unknown + override: true + profile: minimal + + - name: Install wasm32 + run: | + rustup target add wasm32-unknown-unknown + cargo install --locked soroban-cli + + - name: Build & Test soroban Contracts + run: | + soroban contract build diff --git a/.github/workflows/check-pr-label.yml b/.github/workflows/check-pr-label.yml new file mode 100644 index 0000000..330f3d6 --- /dev/null +++ b/.github/workflows/check-pr-label.yml @@ -0,0 +1,25 @@ +name: PR Label Checker +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + workflow_run: + workflows: + - auto-label + types: + - completed + +jobs: + + check_labels: + name: Check PR labels + runs-on: ubuntu-latest + steps: + - uses: docker://agilepathway/pull-request-label-checker:latest + with: + any_of: documentation,enhancement,bug,cicd,test,breaking-change,feature,scripts,dependencies + repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 0000000..dca39a4 --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,18 @@ +name: Lint PR +on: + pull_request_target: + types: + - opened + - edited + - synchronize +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5.1.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + validateSingleCommit: true + validateSingleCommitMatchesPrTitle: true diff --git a/.github/workflows/soroban-codecov.yml b/.github/workflows/soroban-codecov.yml new file mode 100644 index 0000000..96dc906 --- /dev/null +++ b/.github/workflows/soroban-codecov.yml @@ -0,0 +1,35 @@ +name: Soroban contracts Codecov + +on: + pull_request: + branches: + - "main" + push: + branches: + - "**" + +jobs: + code-coverage: + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + - name: Install Rust + run: rustup update stable + - name: Cache Rust dependencies + uses: Swatinem/rust-cache@v2 + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + flags: rust + fail_ci_if_error: true \ No newline at end of file