diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1873177f..a79adeb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -66,6 +66,8 @@ jobs: node-version: '22.19.0' - name: Enable Yarn from the repository package manager run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce - name: Install locked dependencies run: yarn install --immutable - name: Check documentation @@ -87,6 +89,8 @@ jobs: node-version: '22.19.0' - name: Enable Yarn from the repository package manager run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce - name: Install locked dependencies run: yarn install --immutable - name: Build integration dependencies @@ -116,6 +120,8 @@ jobs: node-version: '22.19.0' - name: Enable Yarn from the repository package manager run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce - name: Install locked dependencies run: yarn install --immutable - name: Check tutorial assembler negative cases @@ -125,7 +131,55 @@ jobs: ARC_DOCUMENTATION: ${{ github.workspace }}/.arc-tutorial-source/Documentation run: yarn build && bash Documentation/tutorial-e2e/run.sh - verify: + verify-artifacts: + needs: changes + if: needs.changes.outputs.code == 'true' + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.19.0' + - name: Enable Yarn from the repository package manager + run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce + - name: Install locked dependencies + run: yarn install --immutable + - name: Build packages and check generated artifacts and consumers + run: yarn ci:artifacts + + verify-quality: + needs: changes + if: needs.changes.outputs.code == 'true' + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.19.0' + - name: Enable Yarn from the repository package manager + run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce + - name: Install locked dependencies + run: yarn install --immutable + - name: Build prerequisites + run: yarn build + - name: Lint and typecheck + run: yarn ci:quality + + verify-tests: needs: changes if: needs.changes.outputs.code == 'true' runs-on: ubuntu-latest @@ -141,7 +195,59 @@ jobs: node-version: '22.19.0' - name: Enable Yarn from the repository package manager run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce - name: Install locked dependencies run: yarn install --immutable - - name: Run the complete local gate - run: yarn ci + - name: Build prerequisites + run: yarn build + - name: Run unit, client contract, decorator and Library end-to-end tests + run: yarn ci:tests + + verify-docs: + needs: changes + if: needs.changes.outputs.code == 'true' + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '22.19.0' + - name: Enable Yarn from the repository package manager + run: corepack enable + - name: Cache Yarn packages + uses: Cratis/Workflows/.github/actions/yarn-cache@2fa2cb4fedb8048c4afb7f1a14e0103a35b0f1ce + - name: Install locked dependencies + run: yarn install --immutable + - name: Build prerequisites + run: yarn build + - name: Check documentation, release scripts and version consistency + run: yarn ci:docs + + # Preserve the existing check name, including intentionally skipped code checks. + verify: + needs: [changes, verify-artifacts, verify-quality, verify-tests, verify-docs] + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: {} + steps: + - name: Require every code check to succeed when code changes + env: + CHANGES_RESULT: ${{ needs.changes.result }} + CODE: ${{ needs.changes.outputs.code }} + RESULTS: ${{ toJSON(needs.*.result) }} + run: | + if [[ "$CHANGES_RESULT" != success ]]; then + exit 1 + fi + if [[ "$CODE" == true ]]; then + jq -e 'all(. == "success")' <<< "$RESULTS" + else + jq -e 'all(. == "success" or . == "skipped")' <<< "$RESULTS" + fi diff --git a/.github/workflows/verify-pull-request-policy.yml b/.github/workflows/verify-pull-request-policy.yml index fd636cc3..775e6773 100644 --- a/.github/workflows/verify-pull-request-policy.yml +++ b/.github/workflows/verify-pull-request-policy.yml @@ -8,7 +8,7 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read diff --git a/package.json b/package.json index 106c08b4..254e8a45 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,11 @@ "set-version": "node scripts/set-version.mjs", "test": "vitest run", "specs": "yarn test", - "ci": "yarn tsc -b Source/Core Source/Testing Source/Chronicle Source/MongoDB Source/Tools/ProxyGenerator && yarn check:metadata && yarn workspace @cratis/arc.core.sample.tasks generate-proxies && yarn workspace @cratis/arc.sample.library generate-proxies && yarn workspace @cratis/arc.sample.showcase generate-proxies && yarn check:proxies && yarn build && yarn check:declarations && yarn check:declarations:self-test && yarn check:consumers && yarn check:chronicle-peer-floor:self-test && yarn check:chronicle-peer-floor && yarn check:fetch && yarn check:node-test && yarn check:observability-recipes && yarn workspace @cratis/arc.sample.library.web build && yarn lint && yarn typecheck && yarn lint:tasks:arc && yarn test:client-generation:verify && yarn test && yarn workspace @cratis/arc.sample.library test:e2e && yarn test:legacy-decorators && yarn test:decorator-types && yarn docs:lint && yarn docs:snippets:self-test && yarn docs:snippets && yarn docs:examples:self-test && yarn docs:examples && node --test scripts/for_release/*.test.mjs && node --test scripts/classify-changes.test.mjs && yarn set-version --check" + "ci:artifacts": "yarn tsc -b Source/Core Source/Testing Source/Chronicle Source/MongoDB Source/Tools/ProxyGenerator && yarn check:metadata && yarn workspace @cratis/arc.core.sample.tasks generate-proxies && yarn workspace @cratis/arc.sample.library generate-proxies && yarn workspace @cratis/arc.sample.showcase generate-proxies && yarn check:proxies && yarn build && yarn check:declarations && yarn check:declarations:self-test && yarn check:consumers && yarn check:chronicle-peer-floor:self-test && yarn check:chronicle-peer-floor && yarn check:fetch && yarn check:node-test && yarn check:observability-recipes && yarn workspace @cratis/arc.sample.library.web build", + "ci:quality": "yarn lint && yarn typecheck && yarn lint:tasks:arc", + "ci:tests": "yarn test:client-generation:verify && yarn test && yarn workspace @cratis/arc.sample.library test:e2e && yarn test:legacy-decorators && yarn test:decorator-types", + "ci:docs": "yarn docs:lint && yarn docs:snippets:self-test && yarn docs:snippets && yarn docs:examples:self-test && yarn docs:examples && node --test scripts/for_release/*.test.mjs && node --test scripts/classify-changes.test.mjs && yarn set-version --check", + "ci": "yarn ci:artifacts && yarn ci:quality && yarn ci:tests && yarn ci:docs" }, "devDependencies": { "@cratis/arc.react": "22.45.0",