Files
floci/.github/workflows/nightly-checks.yml
T
Hector Ventura 030ba3d72b chore(ci): run the EMR Docker runner test nightly, beside the cluster shrink check (#8957)
EmrDockerRunnerDockerIntegrationTest pulls a 3.5 GB image and took about 640 s of a passing pull request shard, so after #8903 moved its cluster shrink scenario to the nightly checks, the rest of the class follows as EmrDockerRunnerNightlyIntegrationTest. partition.sh no longer weighs it: SLOW_CLASSES comes from PARTITION_SLOW_CLASSES, empty by default, and test_partition.py passes its own. The standard nightly group has no room for it (339 of its 359 minutes), so the cluster-shrink group becomes docker-runner, with both classes in 42 minutes of bounds in a 62-minute job. On a pull request, the nightly checks now run only the nightly classes it adds or changes, or all of them when it changes the workflow.
2026-11-19 11:22:50 -04:00

167 lines
7.6 KiB
YAML

name: Nightly checks
# Runs the test classes named *NightlyIntegrationTest: checks that pull or push images too large, or run too long,
# for every pull request's shards. Each such class skips unless the JVM has -Dnightly.checks.enabled=true, so the
# CI shards, which pick every *Test class, see it skip at no cost; this workflow sets the property. Its name is
# outside floci.*, whose names Floci's configuration validates: a Quarkus test given -Dfloci.nightly refuses to
# start. It runs once a day on main, on demand, and on a pull request that adds or changes a nightly check, so the
# check is seen to pass before it merges. GitHub-hosted runners only, which a public repository runs at no charge.
on:
schedule:
# 08:00 UTC, after Nightly (23:00 America/Chicago) and away from the daytime merges' CI runs.
- cron: '0 8 * * *'
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '.github/workflows/nightly-checks.yml'
- 'src/test/java/**/*NightlyIntegrationTest.java'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
checks:
name: Nightly checks (${{ matrix.group }})
runs-on: ubuntu-latest
# Each group runs its checks one after another, within their own @Timeout bounds, plus about twenty minutes for
# compilation, the image and the prefetch; together they would exceed the 360 minutes a hosted runner gives one
# job. standard holds every check but the EMR Docker runner's, 339 minutes. docker-runner holds
# EmrDockerRunnerNightlyIntegrationTest's eleven two-minute tests and two-minute setup, and
# EmrClusterShrinkNightlyIntegrationTest's sixteen-minute method and two-minute setup, 42 minutes. A check added,
# or a bound raised, raises its group's timeout with it, so a slow check fails with its own message.
strategy:
fail-fast: false
matrix:
include:
- group: standard
timeout: 359
- group: docker-runner
timeout: 62
timeout-minutes: ${{ matrix.timeout }}
# A fork's schedule would spend its owner's minutes on checks it never asked for; a draft waits until it is
# ready for review, as the CI shards do.
if: >-
(github.event_name != 'schedule' || !github.event.repository.fork) &&
(github.event_name != 'pull_request' || github.event.pull_request.draft == false)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Every test is a top-level class in src/test/java, so the file name is the class name, as ci.yml relies on.
# On a pull request, only the checks it adds or changes run, or all of them when it changes this workflow.
- name: List the nightly checks
id: list
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
GROUP: ${{ matrix.group }}
run: |
set -euo pipefail
cd src/test/java
find . -name '*NightlyIntegrationTest.java' | sed 's|^\./||; s|\.java$||' | LC_ALL=C sort \
> "$GITHUB_WORKSPACE/all-nightly.txt"
cd "$GITHUB_WORKSPACE"
if [ -n "$PR" ]; then
gh pr diff "$PR" --repo "$GITHUB_REPOSITORY" --name-only > changed.txt
if ! grep -qx '.github/workflows/nightly-checks.yml' changed.txt; then
sed -n 's|^src/test/java/\(.*NightlyIntegrationTest\)\.java$|\1|p' changed.txt | LC_ALL=C sort \
| comm -12 all-nightly.txt - > selected.txt
mv selected.txt all-nightly.txt
fi
fi
runner='/(EmrDockerRunner|EmrClusterShrink)NightlyIntegrationTest$'
if [ "$GROUP" = "docker-runner" ]; then
grep -E "$runner" all-nightly.txt > nightly.txt || true
else
grep -vE "$runner" all-nightly.txt > nightly.txt || true
fi
count=$(wc -l < nightly.txt | tr -d ' ')
echo "count=$count" >> "$GITHUB_OUTPUT"
echo "$count nightly checks"
cat nightly.txt
- name: No nightly checks yet
if: steps.list.outputs.count == '0'
run: echo "::notice title=Nightly checks::No *NightlyIntegrationTest class exists, so nothing ran."
# The checks' images run to several gigabytes, a pushed copy of one included, and the runner's disk holds
# toolchains they never use.
- name: Free disk space
if: steps.list.outputs.count != '0'
run: |
df -h /
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
df -h /
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
if: steps.list.outputs.count != '0'
with:
java-version: '25'
distribution: 'temurin'
# no `cache: maven`, as in ci.yml; main's cache is restored below.
# Restored only: ci.yml saves main's copy under this key.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: steps.list.outputs.count != '0'
with:
path: ~/.m2/repository
key: maven-${{ runner.os }}-${{ hashFiles('pom.xml') }}
restore-keys: |
maven-${{ runner.os }}-
# The Maven distribution ./mvnw runs, saved by ci.yml on main, so this job does not fetch it from
# Maven Central with the wrapper's one unretried wget.
- if: steps.list.outputs.count != '0'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ runner.os }}-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Prefetch the checks' Docker images (background)
if: steps.list.outputs.count != '0'
run: .github/ci/prefetch-images.sh nightly.txt || true
- name: Compile
if: steps.list.outputs.count != '0'
run: ./mvnw test-compile -B
# A check that runs Floci in a container, as a user's Docker setup does, runs this image: this commit's own
# build, made from the compiled application as docker/Dockerfile.jvm-package describes.
- name: Build the Floci image
if: steps.list.outputs.count != '0' && matrix.group == 'standard'
run: |
./mvnw package -B -q -DskipTests
docker build -q -f docker/Dockerfile.jvm-package -t floci/floci:nightly-check .
# nightly.txt is never empty here: an empty includesFile would make surefire run the whole suite.
- name: Run the nightly checks
if: steps.list.outputs.count != '0'
run: >
./mvnw surefire:test -B
-Dsurefire.includesFile="$GITHUB_WORKSPACE/nightly.txt"
-DfailIfNoTests=true
-Dnightly.checks.enabled=true
-Dnightly.checks.floci-image=floci/floci:nightly-check
- name: Image prefetch results
if: always() && steps.list.outputs.count != '0'
run: |
cat prefetch-images.log 2>/dev/null || echo "no prefetch log"
grep -E 'stale prefetch key|prefetch skipped|prefetch failed' prefetch-images.log 2>/dev/null \
| sed 's/^/::warning title=prefetch-images.sh::/' || true
- name: Upload the checks' results
if: always() && steps.list.outputs.count != '0'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: nightly-checks-${{ matrix.group }}
path: |
nightly.txt
prefetch-images.log
target/surefire-reports/
if-no-files-found: warn