diff --git a/.github/testing/src/main.ts b/.github/testing/src/main.ts index 89f36afb5bd8..0132c6b1162f 100644 --- a/.github/testing/src/main.ts +++ b/.github/testing/src/main.ts @@ -1,7 +1,8 @@ +import { List } from 'immutable'; import * as affected from './affected'; import * as git from './git'; -import {global} from './config/global'; -import {python} from './config/python'; +import { global } from './config/global'; +import { python } from './config/python'; const diffsCommit = process.argv.length > 2 // @@ -15,11 +16,16 @@ const baseCommit = const diffs = git.diffs(diffsCommit, baseCommit).filter(global.matchFile); -const affectedPython = diffs - .filter(python.matchFile) - .map(python.changes) - .groupBy(change => change.package) - .map(change => change.map(pkg => pkg.affected)) - .map(affected.merge); - -console.log('affectedPython:', affectedPython.toJS()); +const strategyMatrix = { + python: List( + diffs + .filter(python.matchFile) + .map(python.changes) + .groupBy(change => change.package) + .map(change => change.map(pkg => pkg.affected)) + .map(affected.merge) + .map((tests, pkg) => ({ package: pkg, tests: tests })) + .values() + ), +}; +console.log(JSON.stringify(strategyMatrix)); diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b3a993cfa58b..949ad45f43ad 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -24,18 +24,23 @@ jobs: find-tests: runs-on: ubuntu-latest outputs: - tests: ${{steps.affected.outputs.tests}} + affected: ${{steps.find-affected.outputs.affected}} steps: - uses: actions/checkout@v4 - - id: affected - run: echo "tests=`TODO`" >> "$GITHUB_OUTPUT" + - run: npm run build + working-directory: .github/testing + - id: find-affected + run: echo "affected=$AFFECTED" >> "$GITHUB_OUTPUT" + working-directory: .github/testing + env: + AFFECTED: $(npm run affected) + test-python: needs: find-tests runs-on: ubuntu-latest strategy: - matrix: - test: ${{fromJson(needs.find-tests.outputs.tests)}} + matrix: ${{fromJson(needs.find-tests.outputs.affected)}} steps: # - uses: actions/checkout@v4 - - run: echo ${{matrix.test}} + - run: echo ${{matrix}}