mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 23:00:59 -05:00
ci: run the checks too heavy for a pull request nightly (#8574)
Some checks need images of several gigabytes or long runs: an EMR Serverless run on a custom image pushed to Floci's ECR copies the whole 3.5 GB base image into the registry on every run, and Floci running in a container with an EMR cluster beside it needs the Floci image built first. Every *Test class lands in one of the five CI shards, already close to their time limit, so these have had no place to run. The Nightly checks workflow runs the classes named *NightlyIntegrationTest with -Dfloci.nightly=true: once a day on main, on demand, and on a pull request that adds or changes one, so a check is seen to pass before it merges. Each such class skips without the property, which keeps the shards' cost at a skip. It frees the runner's unused toolchains for the images, prefetches them through prefetch-images.sh, and uploads the reports. GitHub-hosted runners only. A nightly check keys its images in prefetch-images.sh on its own name, and ci.yml hands the prefetch its shard's classes without the nightly ones, so a shard never pulls an image for a check that skips there. AGENTS.md names the convention.
This commit is contained in:
1 parent
b2a019ef4e
commit
2d3fa5cd86
4 files changed
+127
-1
No files matched your search
@@ -107,8 +107,13 @@ jobs:
|
||||
test -s shard.txt
|
||||
echo "shard ${{ matrix.shard }}/$SHARD_TOTAL: $(wc -l < shard.txt) classes"
|
||||
|
||||
# A nightly check (*NightlyIntegrationTest) skips in the shards, so its images are left to
|
||||
# nightly-checks.yml: the prefetch is handed the shard's classes without it, while Surefire
|
||||
# still gets them all.
|
||||
- name: Prefetch this shard's Docker images (background)
|
||||
run: .github/ci/prefetch-images.sh shard.txt || true
|
||||
run: |
|
||||
grep -v 'NightlyIntegrationTest$' shard.txt > prefetch.txt || true
|
||||
.github/ci/prefetch-images.sh prefetch.txt || true
|
||||
|
||||
- name: Compile
|
||||
run: ./mvnw test-compile -B
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
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 -Dfloci.nightly=true, so the CI shards,
|
||||
# which pick every *Test class, see it skip at no cost; this workflow sets the property. 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
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
# 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.
|
||||
- name: List the nightly checks
|
||||
id: list
|
||||
run: |
|
||||
cd src/test/java
|
||||
find . -name '*NightlyIntegrationTest.java' | sed 's|^\./||; s|\.java$||' | LC_ALL=C sort \
|
||||
> "$GITHUB_WORKSPACE/nightly.txt"
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
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 }}-
|
||||
|
||||
- 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
|
||||
|
||||
# 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"
|
||||
-Dsurefire.failIfNoTests=true
|
||||
-Dfloci.nightly=true
|
||||
|
||||
- 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
|
||||
path: |
|
||||
nightly.txt
|
||||
prefetch-images.log
|
||||
target/surefire-reports/
|
||||
if-no-files-found: warn
|
||||
Reference in new issue
Block a user