feat(core): Update Candid Files #5674
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Checks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| formatting: | |
| runs-on: ubuntu-24.04 | |
| # In order to trigger other workflows after committing formatting changes, we need | |
| # to use the PR Automation App. This secret is not available for external | |
| # contributors. So on PRs that can't access the secret, we don't commit changes and | |
| # instead just fail if the formatting changes are needed. | |
| steps: | |
| - name: Check if commits can be added | |
| id: check_can_add_commit | |
| run: | | |
| echo "can_add_commit=${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY != '' && vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT | |
| - name: Create GitHub App Token | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' | |
| uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | |
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | |
| - name: Checkout | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Checkout | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'false' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install shfmt | |
| run: sudo snap install --classic shfmt | |
| - name: Format shell scripts | |
| run: ./scripts/fmt-sh | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Format ts | |
| run: npm run format | |
| - name: Check formatting changes | |
| id: check_format | |
| run: | | |
| if git diff --exit-code; then | |
| echo "formatting_needed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "formatting_needed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit Formatting changes | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true' | |
| uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 | |
| with: | |
| add: . | |
| default_author: github_actions | |
| message: "Updating formatting" | |
| # do not pull: if this branch is behind, then we might as well let | |
| # the pushing fail | |
| pull_strategy: "NO-PULL" | |
| - name: Fail for formatting issues without GitHub App | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true' | |
| run: | | |
| echo "Formatting changes are needed but couldn't be committed because the GitHub App secret isn't available or this isn't a pull request." | |
| exit 1 | |
| build-candid: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Compile candid | |
| run: ./scripts/compile-idl-js | |
| - name: Verify that there are no changes to the compiled did files | |
| run: git diff --exit-code -- candid/ | |
| build-protobuf: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Check the protoc installer | |
| run: ./scripts/install-protoc --help | |
| - name: Install protoc | |
| run: sudo ./scripts/install-protoc | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Compile protobuf | |
| run: npm run protoc | |
| - name: Verify that there are no changes to the compiled proto files | |
| run: git diff --exit-code -- packages/nns/proto/ | |
| build: | |
| needs: [build-candid, build-protobuf] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Build | |
| run: npm run build | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Build utils | |
| run: npm run build -w packages/utils | |
| - name: Lint | |
| run: npm run lint | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Build | |
| run: npm run build | |
| - name: Test | |
| run: npm run test | |
| size: | |
| runs-on: ubuntu-24.04 | |
| # The size checker should run and provide metrics only on PRs | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Size check | |
| # The limits are defined in package.json. | |
| uses: andresz1/size-limit-action@e7493a72a44b113341c0cf6186ab49c17c4b65c1 # v1.6.1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| checks-pass: | |
| needs: ["formatting", "build", "lint", "test", "size"] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Cleared for merging | |
| run: echo OK |