Fix job names #21
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: Main workflow | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
jobs: | |
build-test-doc: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
ocaml-compiler: | |
- 4.14.x | |
runs-on: ${{ matrix.os }} | |
outputs: | |
ref: ${{ steps.vars.outputs.ref }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use OCaml ${{ matrix.ocaml-compiler }} | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
- name: Install dependencies | |
run: opam install . --deps-only --with-test | |
- name: Build library | |
run: opam exec -- dune build | |
- name: Run unit tests | |
run: opam exec -- dune test | |
- name: Build documentation | |
run: | | |
opam install odoc | |
opam exec -- dune build @doc | |
- id: vars | |
shell: bash | |
run: echo "##[set-output name=ref;]$(echo ${GITHUB_REF#refs/heads/})" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: doc-${{ steps.vars.outputs.ref }} | |
path: _build/default/_doc/_html/ | |
build-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
# - macos-latest | |
# - windows-latest | |
ocaml-compiler: | |
- 5.1.x | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use OCaml ${{ matrix.ocaml-compiler }} | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
- name: Install dependencies | |
run: opam install . --deps-only --with-test | |
- name: Build library | |
run: opam exec -- dune build | |
- name: Run unit tests | |
run: opam exec -- dune test | |
doc: | |
needs: build-test-doc | |
if: github.event_name == 'push' && | |
( github.ref == 'refs/heads/main' || startsWith(github.ref,'refs/tags') ) | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout gh-pages | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
- name: Remove previous doc | |
run: rm -rf ${{ needs.build-test-doc.outputs.ref }} | |
- name: Retrieve new documentation | |
uses: actions/download-artifact@v2 | |
with: | |
name: doc-${{ needs.build-test-doc.outputs.ref }} | |
path: ${{ needs.build-test-doc.outputs.ref }} | |
- name: Deploy documentation | |
run: | | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git config user.name "${{ github.actor }}" | |
git add ${{ needs.build-test-doc.outputs.ref }} | |
git commit -m "Deploy ${GITHUB_SHA}" | |
git push -f "https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git" gh-pages |