|
1 | 1 | name: EasyCrypt compilation & check |
2 | 2 |
|
3 | | -on: [push,pull_request] |
| 3 | +on: [push,pull_request,merge_group] |
4 | 4 |
|
5 | 5 | env: |
6 | 6 | HOME: /home/charlie |
7 | 7 | OPAMYES: true |
8 | 8 | OPAMJOBS: 2 |
9 | 9 |
|
10 | 10 | jobs: |
| 11 | + pre_job: |
| 12 | + name: Check for Duplicates Jobs |
| 13 | + runs-on: ubuntu-20.04 |
| 14 | + outputs: |
| 15 | + should_skip: ${{ steps.skip_check.outputs.should_skip }} |
| 16 | + steps: |
| 17 | + - uses: fkirc/skip-duplicate-actions@v5 |
| 18 | + id: skip_check |
| 19 | + with: |
| 20 | + concurrent_skipping: 'same_content_newer' |
| 21 | + skip_after_successful_duplicate: 'false' |
| 22 | + |
11 | 23 | compile-opam: |
12 | 24 | name: EasyCrypt compilation (opam) |
| 25 | + needs: pre_job |
| 26 | + if: needs.pre_job.outputs.should_skip != 'true' |
13 | 27 | runs-on: ubuntu-20.04 |
14 | 28 | container: |
15 | 29 | image: ghcr.io/easycrypt/ec-build-box |
16 | 30 | steps: |
17 | | - - uses: actions/checkout@v3 |
18 | | - - name: Update OPAM & EasyCrypt dependencies |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: Install EasyCrypt dependencies |
19 | 33 | run: | |
20 | | - opam update |
21 | 34 | opam pin add -n easycrypt . |
22 | 35 | opam install --deps-only easycrypt |
23 | 36 | - name: Compile EasyCrypt |
24 | | - run: opam config exec -- make |
| 37 | + run: opam exec -- make |
25 | 38 |
|
26 | 39 | compile-nix: |
27 | 40 | name: EasyCrypt compilation (nix) |
| 41 | + needs: pre_job |
| 42 | + if: needs.pre_job.outputs.should_skip != 'true' |
28 | 43 | env: |
29 | 44 | HOME: /home/runner |
30 | 45 | runs-on: ubuntu-20.04 |
31 | 46 | steps: |
32 | | - - uses: actions/checkout@v3 |
| 47 | + - uses: actions/checkout@v4 |
33 | 48 | - name: Setup Nix |
34 | | - uses: cachix/install-nix-action@v20 |
| 49 | + uses: cachix/install-nix-action@v26 |
35 | 50 | with: |
36 | 51 | nix_path: nixpkgs=channel:nixos-unstable |
37 | 52 | - name: Setup Cachix |
38 | | - uses: cachix/cachix-action@v12 |
| 53 | + uses: cachix/cachix-action@v14 |
39 | 54 | with: |
40 | 55 | name: formosa-crypto |
41 | 56 | authToken: '${{ secrets.CACHIX_WRITE_TOKEN }}' |
42 | 57 | - name: Build and cache EasyCrypt and dependencies |
43 | 58 | run: | |
44 | | - nix-build |
| 59 | + make nix-build-with-provers |
45 | 60 |
|
46 | 61 | check: |
47 | 62 | name: Check EasyCrypt Libraries |
48 | | - needs: compile-opam |
| 63 | + needs: [pre_job, compile-opam] |
| 64 | + if: needs.pre_job.outputs.should_skip != 'true' |
49 | 65 | runs-on: ubuntu-20.04 |
50 | 66 | container: |
51 | 67 | image: ghcr.io/easycrypt/ec-build-box |
52 | 68 | strategy: |
53 | 69 | fail-fast: false |
54 | 70 | matrix: |
55 | | - target: [stdlib, examples] |
| 71 | + target: [unit, stdlib, examples] |
56 | 72 | steps: |
57 | | - - uses: actions/checkout@v3 |
58 | | - - name: Update OPAM & EasyCrypt dependencies |
| 73 | + - uses: actions/checkout@v4 |
| 74 | + - name: Install EasyCrypt dependencies |
59 | 75 | run: | |
60 | | - opam update |
61 | 76 | opam pin add -n easycrypt . |
62 | 77 | opam install --deps-only easycrypt |
63 | 78 | - name: Compile EasyCrypt |
64 | | - run: opam config exec -- make |
| 79 | + run: opam exec -- make |
65 | 80 | - name: Detect SMT provers |
66 | 81 | run: | |
67 | 82 | rm -f ~/.why3.conf |
68 | | - opam config exec -- ./ec.native why3config -why3 ~/.why3.conf |
| 83 | + opam exec -- ./ec.native why3config -why3 ~/.why3.conf |
69 | 84 | - name: Compile Library (${{ matrix.target }}) |
70 | 85 | env: |
71 | 86 | TARGET: ${{ matrix.target }} |
72 | | - run: opam config exec -- make $TARGET |
73 | | - - uses: actions/upload-artifact@v3 |
| 87 | + run: opam exec -- make $TARGET |
| 88 | + - uses: actions/upload-artifact@v4 |
74 | 89 | name: Upload report.log |
75 | 90 | if: always() |
76 | 91 | with: |
77 | 92 | name: report.log (${{ matrix.target }}) |
78 | 93 | path: report.log |
79 | 94 | if-no-files-found: ignore |
80 | 95 |
|
| 96 | + fetch-external-matrix: |
| 97 | + name: Fetch EasyCrypt External Projects Matrix |
| 98 | + needs: [pre_job] |
| 99 | + runs-on: ubuntu-20.04 |
| 100 | + outputs: |
| 101 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 102 | + steps: |
| 103 | + - uses: actions/checkout@v4 |
| 104 | + with: |
| 105 | + path: 'easycrypt' |
| 106 | + - id: set-matrix |
| 107 | + run: | |
| 108 | + JSON=$(jq -c . < easycrypt/.github/workflows/external.json) |
| 109 | + echo "matrix=${JSON}" >> $GITHUB_OUTPUT |
| 110 | +
|
81 | 111 | external: |
82 | 112 | name: Check EasyCrypt External Projects |
83 | | - needs: compile-opam |
| 113 | + needs: [pre_job, compile-opam, fetch-external-matrix] |
| 114 | + if: needs.pre_job.outputs.should_skip != 'true' |
84 | 115 | runs-on: ubuntu-20.04 |
85 | 116 | container: |
86 | 117 | image: ghcr.io/easycrypt/ec-build-box |
87 | 118 | strategy: |
88 | 119 | fail-fast: false |
89 | 120 | matrix: |
90 | | - target: [ [ 'jasmin-eclib', 'jasmin-lang/jasmin', 'eclib', 'tests.config', 'jasmin' ] ] |
| 121 | + target: ${{fromJson(needs.fetch-external-matrix.outputs.matrix)}} |
91 | 122 | steps: |
92 | | - - uses: actions/checkout@v3 |
| 123 | + - uses: actions/checkout@v4 |
93 | 124 | with: |
94 | | - path: 'easycrypt' |
95 | | - - uses: actions/checkout@v3 |
96 | | - with: |
97 | | - path: 'project' |
98 | | - repository: ${{ matrix.target[1] }} |
99 | | - - name: Update OPAM & EasyCrypt dependencies |
| 125 | + path: easycrypt |
| 126 | + - name: Checkout External Project |
| 127 | + run: | |
| 128 | + git clone --recurse-submodules \ |
| 129 | + -b ${{ matrix.target.branch }} \ |
| 130 | + ${{ matrix.target.repository }} \ |
| 131 | + project/${{ matrix.target.name }} |
| 132 | + - name: Install EasyCrypt dependencies |
100 | 133 | run: | |
101 | | - opam update |
102 | 134 | opam pin add -n easycrypt easycrypt |
103 | 135 | opam install --deps-only easycrypt |
104 | 136 | - name: Compile & Install EasyCrypt |
105 | | - run: opam config exec -- make -C easycrypt build install |
| 137 | + run: opam exec -- make -C easycrypt build install |
106 | 138 | - name: Detect SMT provers |
107 | 139 | run: | |
108 | 140 | rm -f ~/.why3.conf ~/.config/easycrypt/why3.conf |
109 | | - opam config exec -- easycrypt why3config |
| 141 | + opam exec -- easycrypt why3config |
110 | 142 | - name: Compile project |
111 | | - working-directory: project/${{ matrix.target[2] }} |
112 | | - run: opam config exec -- ec-runtest ${{ matrix.target[3] }} ${{ matrix.target[4] }} |
113 | | - - uses: actions/upload-artifact@v3 |
| 143 | + working-directory: project/${{ matrix.target.name }}/${{ matrix.target.subdir }} |
| 144 | + run: | |
| 145 | + opam exec -- easycrypt runtest \ |
| 146 | + -report report.log \ |
| 147 | + ${{ matrix.target.options }} \ |
| 148 | + ${{ matrix.target.config }} \ |
| 149 | + ${{ matrix.target.scenario }} |
| 150 | + - name: Compute real-path to report.log |
| 151 | + if: always() |
| 152 | + run: | |
| 153 | + echo "report=$(realpath project/${{ matrix.target.name }}/${{ matrix.target.subdir }})/report.log" >> $GITHUB_ENV |
| 154 | + - uses: actions/upload-artifact@v4 |
114 | 155 | name: Upload report.log |
115 | 156 | if: always() |
116 | 157 | with: |
117 | | - name: report.log (${{ matrix.target[0] }}) |
118 | | - path: report.log |
| 158 | + name: report.log (${{ matrix.target.name }}) |
| 159 | + path: ${{ env.report }} |
119 | 160 | if-no-files-found: ignore |
120 | 161 |
|
| 162 | + external-status: |
| 163 | + name: Check EasyCrypt External Projects (set-status) |
| 164 | + if: always() |
| 165 | + needs: [external] |
| 166 | + runs-on: ubuntu-20.04 |
| 167 | + steps: |
| 168 | + - uses: re-actors/alls-green@release/v1 |
| 169 | + with: |
| 170 | + jobs: ${{ toJSON(needs) }} |
| 171 | + allowed-skips: external |
| 172 | + |
121 | 173 | notification: |
122 | 174 | name: Notification |
123 | | - needs: [compile-opam, compile-nix, check, external] |
| 175 | + needs: [compile-opam, compile-nix, check, external, external-status] |
124 | 176 | if: | |
125 | 177 | (github.event_name == 'push') || |
126 | 178 | (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) |
|
0 commit comments