feat(build): Remove 'index' fallback to enable proper dynamic chunking #14026
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: Backend Tests | |
| on: | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| docker-build-base: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Check if backend files changed | |
| id: changes | |
| uses: ./.github/actions/check-backend-changes | |
| - name: Build Base Docker Image | |
| if: steps.changes.outputs.backend == 'true' | |
| uses: ./.github/actions/docker-build-base | |
| docker-build: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| needs: docker-build-base | |
| strategy: | |
| matrix: | |
| include: | |
| - name: backend.wasm.gz | |
| target: backend | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Check if backend files changed | |
| id: changes | |
| uses: ./.github/actions/check-backend-changes | |
| - name: Build canister WASM | |
| if: steps.changes.outputs.backend == 'true' | |
| uses: ./.github/actions/docker-build-backend | |
| with: | |
| name: ${{ matrix.name }} | |
| target: ${{ matrix.target }} | |
| network: local | |
| tests: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| needs: ['docker-build'] | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Check if backend files changed | |
| id: changes | |
| uses: ./.github/actions/check-backend-changes | |
| - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: steps.changes.outputs.backend == 'true' | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-backend-tests-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }} | |
| - name: Download backend.wasm.gz | |
| if: steps.changes.outputs.backend == 'true' | |
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
| with: | |
| name: backend.wasm.gz | |
| path: . | |
| - name: Install dfx | |
| if: steps.changes.outputs.backend == 'true' | |
| uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365 # main | |
| - name: 'Run backend tests' | |
| if: steps.changes.outputs.backend == 'true' | |
| working-directory: . | |
| run: ./scripts/test.backend.sh | |
| breaking-interface: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - docker-build | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| env: | |
| TITLE: ${{ github.event.pull_request.title }} | |
| DESCRIPTION: ${{ github.event.pull_request.body }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Check if backend files changed | |
| id: changes | |
| uses: ./.github/actions/check-backend-changes | |
| - name: 'Run when backend candid interface changes' | |
| if: steps.changes.outputs.backend == 'true' | |
| # Goal: Run only when the backend candid interface changes, otherwise | |
| # every PR after a breaking change will also have to be marked as a breaking change | |
| # until deployment to production. As it is, any PRs that change the backend candid | |
| # will still need to be announced as a breaking change, but that is probably acceptable, | |
| # and it makes it clear if the API is revised to no longer be breaking. | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: api-changes | |
| with: | |
| filters: | | |
| api: | |
| - 'src/backend/backend.did' | |
| - name: 'Check whether the PR description & title mention "breaking interface"' | |
| if: steps.changes.outputs.backend == 'true' | |
| id: conventional-commit | |
| run: | | |
| # See the conventional commit conventions for how to mark a breaking change: https://www.conventionalcommits.org/en/v1.0.0/#commit-message-with-both--and-breaking-change-footer | |
| # The PR title needs a ! before the colon, e.g.: | |
| # chore(frontend)!: drop support for Node 6 | |
| if [[ "$TITLE" =~ ^([a-z]+)(\([-a-zA-Z0-9,]+\))\!\: ]]; then | |
| echo "BREAKING_TITLE=true" | tee -a "$GITHUB_OUTPUT" | tee -a "$GITHUB_STEP_SUMMARY" | |
| fi | |
| # The PR body needs a line declaring the breaking change, e.g.: | |
| # BREAKING CHANGE: use JavaScript features not available in Node 6. | |
| if grep -qE '^BREAKING CHANGE: ' <<<"$DESCRIPTION"; then | |
| echo "BREAKING_DESCRIPTION=true" | tee -a "$GITHUB_OUTPUT" | tee -a "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Need to check for breaking changes | |
| id: check-for-breaking-changes | |
| # Run if the interface has changed, but the PR is NOT marked as a breaking change. | |
| if: (steps.changes.outputs.backend == 'true') && (steps.api-changes.outputs.api == 'true') && !((steps.conventional-commit.outputs.BREAKING_DESCRIPTION == 'true') && (steps.conventional-commit.outputs.BREAKING_TITLE == 'true')) | |
| run: echo "EXPECT_NO_BREAKING_CHANGES=true" | tee -a "$GITHUB_OUTPUT" | tee -a "$GITHUB_STEP_SUMMARY" | |
| - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: (steps.changes.outputs.backend == 'true') && (steps.check-for-breaking-changes.outputs.EXPECT_NO_BREAKING_CHANGES == 'true') | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-backend-tests-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }} | |
| - name: Install dfx | |
| if: (steps.changes.outputs.backend == 'true') && (steps.check-for-breaking-changes.outputs.EXPECT_NO_BREAKING_CHANGES == 'true') | |
| uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365 # main | |
| - name: Download backend.wasm.gz | |
| if: (steps.changes.outputs.backend == 'true') && (steps.check-for-breaking-changes.outputs.EXPECT_NO_BREAKING_CHANGES == 'true') | |
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
| with: | |
| name: backend.wasm.gz | |
| path: . | |
| - name: 'Run backend tests' | |
| if: (steps.changes.outputs.backend == 'true') && (steps.check-for-breaking-changes.outputs.EXPECT_NO_BREAKING_CHANGES == 'true') && (github.event_name != 'merge_group') | |
| working-directory: . | |
| run: | | |
| set -euxo pipefail # Ensure that the `exit 1` causes this step to fail. | |
| ./scripts/test.backend.sh -- --ignored candid || { | |
| echo HAS_BREAKING_CHANGES=true | |
| echo | |
| echo "The backend API is incompatible with production." | |
| echo "If this is intentional, please use the conventional commit convention for indicating" | |
| echo "a breaking change in this PR, then push another commit to re-run this job." | |
| echo "E.g. title: feat(backend)!: Change the API to..." | |
| echo " body: BREAKING CHANGE: The backend API is now incompatible with production." | |
| echo " git commit --allow-empty -m 'I really want breaking changes in the API' && git push" | |
| exit 1 | |
| } | tee -a "$GITHUB_STEP_SUMMARY" | |
| backend-tests-pass: | |
| needs: | |
| - tests | |
| - breaking-interface | |
| if: ${{ always() }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/needs_success | |
| with: | |
| needs: '${{ toJson(needs) }}' |