name: jtreg # The OpenJDK regression tests in test/jtreg/passing.txt, split over parallel # jobs. A pull request runs the tests its changes need; `full` runs them all. on: workflow_call: inputs: full: type: boolean default: false permissions: contents: read jobs: plan: runs-on: ubuntu-latest outputs: filters: ${{ steps.select.outputs.filters }} shards: ${{ steps.select.outputs.shards }} steps: - uses: actions/checkout@v7 with: fetch-depth: 0 persist-credentials: false - uses: actions/setup-node@v7 with: node-version: 26 - id: select env: FULL: ${{ inputs.full }} BASE: ${{ github.event.pull_request.base.sha }} # a pull request runs what its diff needs; anything else runs everything run: | if [ "$FULL" = true ] || [ -z "$BASE" ]; then arg=--full; else arg=$BASE; fi node scripts/jtreg/select.ts "$arg" >> "$GITHUB_OUTPUT" run: needs: plan if: needs.plan.outputs.shards != '[]' runs-on: ubuntu-latest timeout-minutes: 90 strategy: fail-fast: false matrix: shard: ${{ fromJSON(needs.plan.outputs.shards) }} steps: - uses: actions/checkout@v7 with: persist-credentials: false - uses: pnpm/action-setup@v6 with: version: 12 - uses: actions/setup-node@v7 with: node-version: 26 cache: pnpm - uses: actions/cache@v6 with: # the downloads build-jdk.sh keeps; boot snapshots there stay out path: | ~/.cache/java-web/jdk-* ~/.cache/java-web/dejavu-* key: jdk-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/build-jdk.sh') }} - run: pnpm install --frozen-lockfile - run: pnpm jdk # each test VM starts from the bundle, which loads faster than src/ - run: pnpm build - name: OpenJDK regression tests env: FILTERS: ${{ needs.plan.outputs.filters }} run: | release=$(sed -n 's/^release=//p' scripts/build-jdk.sh) git clone -q --filter=blob:none --sparse --depth 1 --branch "jdk-${release%+*}-ga" https://github.com/openjdk/jdk25u.git build/ref/jdk25u dirs=$(grep -v '^#' test/jtreg/passing.txt | cut -d/ -f1-2 | sort -u | sed 's|^|test/jdk/|') git -C build/ref/jdk25u sparse-checkout set test/lib test/jdk/lib test/jdk/tools/lib $dirs read -ra filters <<< "$FILTERS" node scripts/jtreg/run.ts build/ref/jdk25u --only-passing --jobs 4 --timeout 600 --vm dist/node.js \ --shard ${{ matrix.shard }}/${{ strategy.job-total }} "${filters[@]}" # each test's run time, for refreshing test/jtreg/times.tsv - uses: actions/upload-artifact@v7 if: always() with: name: times-${{ matrix.shard }} path: build/jtreg/times.tsv if-no-files-found: ignore retention-days: 30 # one check for branch protection, whatever the number of shards result: needs: [plan, run] if: always() runs-on: ubuntu-latest steps: - env: PLAN: ${{ needs.plan.result }} RUN: ${{ needs.run.result }} run: test "$PLAN" = success && { test "$RUN" = success || test "$RUN" = skipped; }