|
| 1 | +# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT |
| 2 | + |
| 3 | +name: HOL-Light |
| 4 | +permissions: |
| 5 | + contents: read |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: ["main"] |
| 9 | + paths: |
| 10 | + - '.github/workflows/hol_light.yml' |
| 11 | + - 'proofs/hol_light/x86_64/Makefile' |
| 12 | + - 'proofs/hol_light/x86_64/**/*.S' |
| 13 | + - 'proofs/hol_light/x86_64/**/*.ml' |
| 14 | + - 'flake.nix' |
| 15 | + - 'flake.lock' |
| 16 | + - 'nix/hol_light/*' |
| 17 | + - 'nix/s2n_bignum/*' |
| 18 | + pull_request: |
| 19 | + branches: ["main"] |
| 20 | + paths: |
| 21 | + - '.github/workflows/hol_light.yml' |
| 22 | + - 'proofs/hol_light/x86_64/Makefile' |
| 23 | + - 'proofs/hol_light/x86_64/**/*.S' |
| 24 | + - 'proofs/hol_light/x86_64/**/*.ml' |
| 25 | + - 'flake.nix' |
| 26 | + - 'flake.lock' |
| 27 | + - 'nix/hol_light/*' |
| 28 | + - 'nix/s2n_bignum/*' |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + # The proofs also check that the byte code is up to date, |
| 36 | + # but we use this as a fast path to not even start the proofs |
| 37 | + # if the byte code needs updating. |
| 38 | + hol_light_bytecode: |
| 39 | + name: HOL-Light bytecode check |
| 40 | + runs-on: pqcp-x64 |
| 41 | + if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 44 | + with: |
| 45 | + fetch-depth: 0 |
| 46 | + - uses: ./.github/actions/setup-shell |
| 47 | + with: |
| 48 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + nix-shell: 'hol_light' |
| 50 | + script: | |
| 51 | + autogen --update-hol-light-bytecode --dry-run |
| 52 | + hol_light_interactive: |
| 53 | + name: HOL-Light interactive shell test |
| 54 | + runs-on: pqcp-x64 |
| 55 | + needs: [ hol_light_bytecode ] |
| 56 | + if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 59 | + with: |
| 60 | + fetch-depth: 0 |
| 61 | + - uses: ./.github/actions/setup-shell |
| 62 | + with: |
| 63 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + nix-shell: 'hol_light' |
| 65 | + script: | |
| 66 | + # Load base infrastructure and specs to validate HOL-Light environment |
| 67 | + # When we have smaller/faster proofs, we can run them here instead: |
| 68 | + # make -C proofs/hol_light/x86_64 mldsa/mldsa_ntt.o |
| 69 | + # echo 'needs "proofs/mldsa_ntt.ml";;' | hol.sh |
| 70 | + echo 'needs "x86/proofs/base.ml";; needs "proofs/mldsa_specs.ml";; #quit;;' | hol.sh |
| 71 | + hol_light_proofs: |
| 72 | + needs: [ hol_light_bytecode ] |
| 73 | + strategy: |
| 74 | + fail-fast: false |
| 75 | + matrix: |
| 76 | + proof: |
| 77 | + # Dependencies on {name}.{S,ml} are implicit |
| 78 | + - name: mldsa_ntt |
| 79 | + needs: ["mldsa_specs.ml", "mldsa_utils.ml"] |
| 80 | + name: HOL Light proof for ${{ matrix.proof.name }}.S |
| 81 | + runs-on: pqcp-x64 |
| 82 | + if: github.repository_owner == 'pq-code-package' && !github.event.pull_request.head.repo.fork |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 85 | + with: |
| 86 | + fetch-depth: 0 |
| 87 | + - name: Get changed files |
| 88 | + id: changed-files |
| 89 | + uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0 |
| 90 | + - name: Check if dependencies changed |
| 91 | + id: check_run |
| 92 | + shell: bash |
| 93 | + run: | |
| 94 | + run_needed=0 |
| 95 | + changed_files="${{ steps.changed-files.outputs.all_changed_files }}" |
| 96 | + dependencies="${{ join(matrix.proof.needs, ' ') }} ${{ format('{0}.S {0}.ml', matrix.proof.name) }}" |
| 97 | + for changed in $changed_files; do |
| 98 | + for needs in $dependencies; do |
| 99 | + if [[ "$changed" == *"$needs" ]]; then |
| 100 | + run_needed=1 |
| 101 | + fi |
| 102 | + done |
| 103 | + done |
| 104 | +
|
| 105 | + # Always re-run upon change to nix files for HOL-Light |
| 106 | + if [[ "$changed_files" == *"nix/"* ]] || [[ "$changed_files" == *"hol_light.yml"* ]] || [[ "$changed_files" == *"flake"* ]] || [[ "$changed_files" == *"proofs/hol_light/x86_64/Makefile"* ]]; then |
| 107 | + run_needed=1 |
| 108 | + fi |
| 109 | +
|
| 110 | + echo "run_needed=${run_needed}" >> $GITHUB_OUTPUT |
| 111 | + - uses: ./.github/actions/setup-shell |
| 112 | + if: | |
| 113 | + steps.check_run.outputs.run_needed == '1' |
| 114 | + with: |
| 115 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 116 | + nix-shell: 'hol_light' |
| 117 | + script: | |
| 118 | + tests hol_light -p ${{ matrix.proof.name }} --verbose |
0 commit comments