Skip to content

Incremental rebuilds seeded from the deployed versions.json #537

Incremental rebuilds seeded from the deployed versions.json

Incremental rebuilds seeded from the deployed versions.json #537

Workflow file for this run

name: CI
on:
workflow_dispatch:
inputs:
full-rebuild:
description: "Ignore the deployed versions.json and rebuild everything from scratch"
type: boolean
default: false
schedule:
# Monthly full-rebuild backstop: re-downloads and re-hashes everything, so any
# drift the incremental path cannot detect (a seed entry whose recorded hash is
# wrong while its ETag still matches) is bounded to a month.
- cron: "30 3 3 * *"
push:
branches:
- main
paths-ignore:
- "README.md"
pull_request:
merge_group: # GitHub Merge Queue
concurrency:
# Skip intermediate builds: all builds except for builds on the `master` branch
# Cancel intermediate builds: only pull request builds
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/main' || github.run_number }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
permissions:
contents: read
actions: write # Needed for `julia-actions/cache` to clear old caches
env:
aws_region: us-east-1
s3_bucket: julialang2
jobs:
package-tests:
name: Package tests
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
version:
- '1.10' # 1.10 = current LTS
os:
- ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
- uses: julia-actions/setup-julia@fa02766e078afaaf09b14210362cee14137e6a32 # v3.0.2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@b7788abd52452d5bc033d69796e110d9906af4ab # v3.2.0
- name: Install dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"
- uses: julia-actions/julia-runtest@6e050c8013b833b1195105ff2fce9cd802f53271 # v1.12.0
full-test:
name: Full test
# This job takes a long time (1+ hours).
# So we intentionally skip this job on PR runs.
# But we still run this job on Merge Queue jobs.
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 360
strategy:
fail-fast: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
- uses: julia-actions/setup-julia@fa02766e078afaaf09b14210362cee14137e6a32 # v3.0.2
with:
version: '1.10' # 1.10 = current LTS
- uses: julia-actions/cache@b7788abd52452d5bc033d69796e110d9906af4ab # v3.2.0
- name: Install dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"
- run: rm -f versions.json
- name: Download the deployed versions.json to build on top of
# Scheduled runs (and the manual full-rebuild switch) deliberately skip the
# seed and rebuild from scratch. A missing/broken seed must never fail the
# build: without a seed we simply do a full rebuild.
if: github.event_name != 'schedule' && inputs.full-rebuild != true
run: |
curl -fLO https://julialang-s3.julialang.org/bin/versions.json \
|| { echo "::warning::deployed versions.json unavailable; doing a full rebuild"; rm -f versions.json; }
- name: Build versions.json
run: |
using VersionsJSONUtil
VersionsJSONUtil.main("versions.json")
shell: julia --project {0}
- name: Validate versions.json against schema
run: npx -p ajv-cli@3.3.0 ajv -s schema.json -d versions.json
- run: julia --project test/more_tests.jl versions.json
- name: Upload versions.json as workflow artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: versions
path: versions.json
if-no-files-found: error
upload-to-s3:
needs: [package-tests, full-test]
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Download versions.json from previous job
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: versions
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # 6.2.3
with:
aws-access-key-id: ${{ secrets.AWS_DEPLOY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEPLOY_SECRET_ACCESS_KEY }}
aws-region: ${{ env.aws_region }}
- name: Upload versions.json to S3
run: aws s3 cp versions.json s3://${{ env.s3_bucket }}/bin/versions.json --acl public-read --no-progress
- name: Purge cache
# As of 2026-08 the Fastly service rejects unauthenticated URL purges (401),
# so this surfaces a warning annotation instead of passing silently; the
# deployed file is then served stale for up to its cache TTL.
run: |
curl -fsS -X PURGE https://julialang-s3.julialang.org/bin/versions.json \
|| echo "::warning::Fastly purge of versions.json failed; it will be served stale until the cached copy expires"
test-current-s3:
# We intentionally do not make this job a "required status check" on PRs.
# Because if the currently deployed `versions.json` on S3 is already broken,
# then this job will fail, which would block us from merging a PR with fixes.
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # 7.0.1
with:
persist-credentials: false
- uses: julia-actions/setup-julia@fa02766e078afaaf09b14210362cee14137e6a32 # v3.0.2
with:
version: 'lts'
- uses: julia-actions/cache@b7788abd52452d5bc033d69796e110d9906af4ab # v3.2.0
- name: Install dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
- name: Remove an old versions.json if one happens to be lying around
run: rm -fv versions.json
- name: Download the current versions.json from S3
run: curl -LO https://julialang-s3.julialang.org/bin/versions.json
- name: Run the post-build tests on the versions.json that we downloaded from S3
run: julia --project test/more_tests.jl versions.json