Skip to content

Migrate Aeneas to the Lean module system #3847

Migrate Aeneas to the Lean module system

Migrate Aeneas to the Lean module system #3847

Workflow file for this run

on:
# Run the checks on any push to any branch of the repo that doesn't start with `_`.
push:
branches:
- main
# Run the check for any pull request. The check is run on a merge between the
# PR commit and the `main` branch at the time of running the check.
pull_request:
# Runs the check when a PR is added to the merge queue.
merge_group:
# Makes it possible to run the forkflow by hand from GItHub's interface.
workflow_dispatch:
# Cancel previous versions of this job that are still running.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
HAS_CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN != '' }}
jobs:
select-runner:
uses: ./.github/workflows/select-runner.yml
nix:
needs: [select-runner]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- &install_nix # YAML anchor to reduce duplication
name: Install Nix
if: ${{ runner.environment == 'github-hosted' }}
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
extra-substituters = https://hacl.cachix.org
extra-trusted-public-keys = hacl.cachix.org-1:FzsZ2xsByOwKwIWNPII7yMOelJNDZ12mDAj3d1eGX0c=
- &setup_cachix_push
name: Set up Cachix push
if: ${{ runner.environment == 'github-hosted' && env.HAS_CACHIX_AUTH_TOKEN == 'true' }}
uses: cachix/cachix-action@v17
with:
name: hacl
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
skipAddingSubstituter: true
- uses: actions/checkout@v4
- run: nix build -L .#checks.x86_64-linux.aeneas-check-tidiness
- run: nix build -L .#checks.x86_64-linux.check-charon-pin
- run: nix build -L .#aeneas
- run: nix build -L .#checks.x86_64-linux.default
diff_lean_files:
needs: [select-runner]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # deep clone in order to get access to other commits
- id: skip_check
run: |
# Compares this version with `main`, and checks whether the lean files changed.
if git diff origin/main --quiet -- tests/lean && git diff origin/main --quiet -- backends/lean; then
echo 'lean files were not changed in this PR.'
echo "CHECK_LEAN=false" >> "$GITHUB_ENV"
else
echo 'lean files were changed in this PR.'
echo "CHECK_LEAN=true" >> "$GITHUB_ENV"
fi
outputs:
check_lean: ${{ env.CHECK_LEAN }}
lean:
needs: [select-runner, diff_lean_files]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- *install_nix
- *setup_cachix_push
- uses: actions/checkout@v4
- if: needs.diff_lean_files.outputs.check_lean == 'true'
# Lean cannot run its tests in the nix sandbox because `elan` will download things
run: nix develop --command bash -c "cd tests/lean && make"
charon-pin-is-forward:
needs: [select-runner]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- *install_nix
- *setup_cachix_push
- uses: actions/checkout@v4
with:
fetch-depth: 0 # deep clone in order to get access to other commits
- run: nix develop --command ./scripts/ci-check-charon-pin-is-forward.sh
charon-pin-is-merged:
needs: [select-runner]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- *install_nix
- *setup_cachix_push
- uses: actions/checkout@v4
with:
fetch-depth: 0 # deep clone in order to get access to other commits
- run: nix develop --command ./scripts/ci-check-charon-pin-is-merged.sh
userdocs:
needs: [select-runner]
runs-on: ${{ fromJSON(needs.select-runner.outputs.runs_on) }}
steps:
- *install_nix
- *setup_cachix_push
- uses: actions/checkout@v4
- run: nix build '.?dir=docs/user'#book
# TODO: test the Lean examples code via nix build '.?dir=docs/user'#test or something similar.