diff --git a/.github/workflows/change-quality.yml b/.github/workflows/change-quality.yml index d67762cc17..75376871f0 100644 --- a/.github/workflows/change-quality.yml +++ b/.github/workflows/change-quality.yml @@ -14,6 +14,7 @@ on: - 'package.json' - 'package-lock.json' - '.github/actions/mongodb-binary/**' + - '.github/actions/redis-binaries/**' - 'packages/data-schemas/src/postgres/**' - 'packages/data-schemas/src/types/favorite*' - 'packages/data-schemas/src/methods/favorite*' @@ -131,6 +132,8 @@ jobs: --strict --types node scripts/quality/*.mts - name: Test change selection and metrics run: node --test scripts/crap.test.mts scripts/quality/*.test.mts + - name: Test Redis binary provisioning + run: node --test .github/actions/redis-binaries/provision.test.mjs select: needs: [request] @@ -288,6 +291,10 @@ jobs: cache-dependency-path: | source/package-lock.json tooling/package-lock.json + - name: Provision Redis tools for API coverage + if: matrix.workspace == 'api' && matrix.task.check == 'risk' + timeout-minutes: 8 + uses: ./tooling/.github/actions/redis-binaries - run: npm ci - name: Install quality tooling working-directory: tooling diff --git a/scripts/quality/workflow.test.mts b/scripts/quality/workflow.test.mts index 9a70b8f466..f7cce70999 100644 --- a/scripts/quality/workflow.test.mts +++ b/scripts/quality/workflow.test.mts @@ -32,6 +32,7 @@ interface Step { with?: Record; env?: Record; 'working-directory'?: string; + 'timeout-minutes'?: number; } interface Job { env?: Record; @@ -180,6 +181,27 @@ test('PR updates retain PostgreSQL contracts without starting source quality rep assert.equal(report.steps[prewarm].with?.['working-directory'], 'source'); }); +test('API risk coverage provisions pinned host Redis before executing source tests', () => { + const provision = report.steps.findIndex( + ({ uses }) => uses === './tooling/.github/actions/redis-binaries', + ); + const node = report.steps.findIndex(({ uses }) => uses === 'actions/setup-node@v5'); + const tooling = report.steps.findIndex(({ name }) => name === 'Check out quality tooling'); + assert.ok(provision > node && provision > tooling, 'trusted provisioning needs Node and tooling'); + assert.ok(provision < report.steps.indexOf(runner), 'test fixtures need host Redis on PATH'); + assert.equal( + report.steps[provision].if, + "matrix.workspace == 'api' && matrix.task.check == 'risk'", + ); + assert.equal(report.steps[provision]['timeout-minutes'], 8); + assert.ok( + workflow.jobs.verify.steps.some( + ({ run }) => run === 'node --test .github/actions/redis-binaries/provision.test.mjs', + ), + ); + assert.ok(workflow.on.pull_request?.paths.includes('.github/actions/redis-binaries/**')); +}); + test('comment commands from humans and bots reach trusted admission before report jobs', () => { const request = workflow.jobs.request; assert.equal(