try to cache opam in CI #227
Workflow file for this run
This file contains 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: deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
persist-credentials: false | ||
- name: cache | ||
id: cache-opam | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-opam | ||
with: | ||
path: | | ||
~/work/owi/owi/_opam/ | ||
key: ${{ runner.os }}-deploy-${{ env.cache-name }}-${{ hashFiles('**/*.opam') }} | ||
- name: setup-ocaml | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: "5.1" | ||
dune-cache: true | ||
opam-depext: true | ||
opam-pin: true | ||
allow-prerelease-opam: true | ||
- name: depext | ||
run: | | ||
opam depext -y owi | ||
- name: setup-deploy | ||
if: steps.cache-opam.outputs.cache-hit != 'true' | ||
run: | | ||
opam install -y ./*.opam --deps-only --with-test --with-doc | ||
- name: api | ||
run: | | ||
touch doc/.nojekyll | ||
opam exec -- dune build @doc | ||
mv _build/default/_doc/_html doc/api | ||
- name: coverage | ||
run: | | ||
BISECT_FILE=$(pwd)/bisect opam exec -- dune runtest --force --instrument-with bisect_ppx | ||
opam exec -- bisect-ppx-report html -o doc/coverage | ||
- name: coverage-badge | ||
run: | | ||
label=coverage | ||
percentage=$(opam exec -- bisect-ppx-report summary | sed -E 's/.*\((..).*/\1/g') | ||
color=$(printf "%x%x%x" $((255-$percentage)) $((155+$percentage)) 85) | ||
opam exec -- ocb --style classic --label $label --status $percentage'%' --color $color > doc/coverage/badge.svg | ||
- name: deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: doc/ | ||
CLEAN: true |