CI: try to fix OPAM cache #132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "CI" | |
| on: | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'agda2lambox.cabal' | |
| - 'cabal.project' | |
| - 'Makefile' | |
| - '.github/workflows/**' | |
| push: | |
| paths: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'agda2lambox.cabal' | |
| - 'cabal.project' | |
| - 'Makefile' | |
| - '.github/workflows/**' | |
| branches: [master] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} / GHC ${{ matrix.ghc }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04] | |
| cabal: [3.12.1] | |
| ghc: [9.10.1] | |
| ocaml: [4.14.2] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up GHC | |
| uses: haskell-actions/setup@v2 | |
| id: setup | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: ${{ matrix.cabal }} | |
| - name: Configure the build | |
| run: | | |
| cabal configure --disable-documentation | |
| cabal build all --dry-run | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| id: cache | |
| env: | |
| key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }} | |
| with: | |
| path: ${{ steps.setup.outputs.cabal-store }} | |
| key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} | |
| restore-keys: ${{ env.key }}- | |
| - name: Install dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: cabal build all --only-dependencies | |
| - name: Save cached dependencies | |
| uses: actions/cache/save@v4 | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup.outputs.cabal-store }} | |
| key: ${{ steps.cache.outputs.cache-primary-key }} | |
| - name: Build | |
| run: make build | |
| - name: Test | |
| run: make test | |
| - name: Checkout Peregrine | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: peregrine-project/peregrine-tool | |
| ref: 6e3971e07897f17e06cd21c4e20558ea4161861a | |
| path: peregrine-tool | |
| - name: Restore OPAM cache | |
| id: opam-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: "~/.opam" | |
| key: opam-${{matrix.ocaml}}-${{hashFiles('peregrine-tool/.github/rocq-peregrine.opam.locked')}} | |
| restore-keys: | | |
| opam-${{matrix.ocaml}}- | |
| - run: sudo apt-get update | |
| - name: Set up OCaml | |
| # uses: ocaml/setup-ocaml@v3 | |
| uses: avsm/setup-ocaml@v1 | |
| with: | |
| # ocaml-compiler: ${{ matrix.ocaml }} | |
| ocaml-version: ${{ matrix.ocaml }} | |
| - name: Build Peregrine dependencies | |
| # if: ${{ !steps.opam-cache.outputs.cache-hit }} | |
| working-directory: peregrine-tool/ | |
| run: | | |
| opam repo add rocq-released https://rocq-prover.org/opam/released | |
| opam install --deps-only -j4 .github/rocq-peregrine.opam.locked | |
| opam clean -a -c -s --logs | |
| - name: Install Peregrine | |
| working-directory: peregrine-tool/ | |
| run: | | |
| eval $(opam env) && opam install -j4 ./rocq-peregrine.opam | |
| - name: Generate HTML | |
| run: | | |
| sudo apt-get install -y pandoc zsh wabt | |
| eval $(opam env) && make html | |
| - name: Deploy HTML website | |
| if: github.ref == 'refs/heads/master' | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: test/html | |
| - name: OPAM cache clean-up | |
| run: | | |
| opam remove rocq-peregrine | |
| opam pin remove rocq-peregrine | |
| eval $(opam env) | |
| opam clean -a -c -s --logs |