wip #1510
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: Builds, tests & co | |
on: | |
push: | |
env: | |
OPAMBSVERSION: 2.1.0 | |
OPAMBSROOT: ~/.cache/.opam.cached | |
OPAM12CACHE: ~/.cache/opam1.2/cache | |
OPAM_REPO: https://github.com/ocaml/opam-repository.git | |
OPAM_TEST_REPO_SHA: 67e940587b8aca227f511e1943bcd31eabe6b1db | |
OPAM_REPO_SHA: 67e940587b8aca227f511e1943bcd31eabe6b1db | |
SOLVER: | |
CYGWIN_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/ | |
CYGWIN_ROOT: D:\cygwin | |
CYGWIN: winsymlinks:native | |
CYGWIN_EPOCH: 3 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
#### | |
# Caches | |
#### | |
Analyse: | |
runs-on: ubuntu-latest | |
outputs: | |
archives: ${{ steps.keys.outputs.archives }} | |
ocaml-cache: ${{ steps.keys.outputs.ocaml-cache }} | |
cygwin: ${{ steps.keys.outputs.cygwin }} | |
opam-bs-cache: ${{ steps.keys.outputs.opam-bs-cache }} | |
steps: | |
- name: Checkout tree | |
uses: actions/checkout@v4 | |
- name: Determine cache keys | |
id: keys | |
run: | | |
echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }} | |
echo archives=archives-1-${{ hashFiles('src_ext/Makefile.dune', 'src_ext/Makefile.sources', 'src_ext/Makefile', '.github/scripts/common/preamble.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/archives-cache.sh') }}-${{ env.OPAM_REPO_SHA }} >> $GITHUB_OUTPUT | |
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} | |
echo ocaml-cache=${{ hashFiles('src_ext/Makefile.dune', '.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh') }} >> $GITHUB_OUTPUT | |
echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }} | |
echo cygwin=${{ hashFiles('.github/scripts/cygwin.cmd') }}-${{ env.CYGWIN_EPOCH }} >> $GITHUB_OUTPUT | |
echo opam-bs-cache=${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }} | |
echo opam-bs-cache=${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }} >> $GITHUB_OUTPUT | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ steps.keys.outputs.archives }} | |
lookup-only: true | |
enableCrossOsArchive: true | |
- name: Create src_ext/archives and opam-repository cache | |
if: steps.archives.outputs.cache-hit != 'true' | |
run: bash -exu .github/scripts/main/archives-cache.sh | |
#### | |
# Build | |
#### | |
Build-Linux: | |
runs-on: ubuntu-latest | |
needs: Analyse | |
strategy: | |
matrix: | |
ocamlv: [ 4.08.1, 4.14.2, 5.3.0 ] | |
fail-fast: true | |
steps: | |
- name: Install bubblewrap | |
run: sudo apt install bubblewrap | |
- name: Disable AppArmor | |
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
- name: Checkout tree | |
uses: actions/checkout@v4 | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
enableCrossOsArchive: true | |
- name: OCaml ${{ matrix.ocamlv }} Cache | |
id: ocaml-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ocaml-local/** | |
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ needs.Analyse.outputs.ocaml-cache }} | |
- name: Create OCaml ${{ matrix.ocamlv }} cache | |
if: steps.ocaml-cache.outputs.cache-hit != 'true' | |
run: bash -exu .github/scripts/main/ocaml-cache.sh ${{ runner.os }} ${{ matrix.ocamlv }} | |
- name: Build | |
run: bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu | |
- name: Test (basic) | |
run: bash -exu .github/scripts/main/test.sh | |
Depends-Linux: | |
runs-on: ubuntu-latest | |
needs: [ Analyse, Build-Linux ] | |
strategy: | |
matrix: | |
ocamlv: [ 4.14.2, 5.3.0 ] | |
fail-fast: false | |
env: | |
OPAM_DEPENDS: 1 | |
steps: | |
- name: Install bubblewrap | |
run: sudo apt install bubblewrap | |
- name: Disable AppArmor | |
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
- name: Checkout tree | |
uses: actions/checkout@v4 | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
enableCrossOsArchive: true | |
- name: OCaml ${{ matrix.ocamlv }} Cache | |
id: ocaml-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ocaml-local/** | |
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ needs.Analyse.outputs.ocaml-cache }} | |
- name: Create OCaml ${{ matrix.ocamlv }} cache | |
if: steps.ocaml-cache.outputs.cache-hit != 'true' | |
run: bash -exu .github/scripts/main/ocaml-cache.sh ${{ runner.os }} ${{ matrix.ocamlv }} | |
- name: opam bootstrap Cache | |
id: opam-bootstrap | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.OPAMBSROOT }}/** | |
~/.cache/opam-local/bin/** | |
key: opamdepends-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ needs.Analyse.outputs.opam-bs-cache }} | |
- name: Create opam bootstrap cache | |
if: steps.opam-bootstrap.outputs.cache-hit != 'true' | |
run: bash -exu .github/scripts/main/opam-bs-cache.sh | |
- name: Compile | |
env: | |
BASE_REF_SHA: ${{ github.event.pull_request.base.sha }} | |
PR_REF_SHA: ${{ github.event.pull_request.head.sha }} | |
run: bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu | |
#### | |
# Around opam tests | |
#### | |
Hygiene: | |
runs-on: ubuntu-22.04 | |
needs: Analyse | |
steps: | |
- name: Install system's dune and ocaml packages | |
run: sudo apt install dune ocaml | |
- name: Checkout tree | |
uses: actions/checkout@v4 | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: actions/cache@v4 | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
enableCrossOsArchive: true | |
- name: Get changed files | |
id: files | |
uses: Ana06/[email protected] | |
- name: Changed files list | |
run: | | |
for changed_file in ${{ steps.files.outputs.modified }}; do | |
echo "M ${changed_file}." | |
done | |
for changed_file in ${{ steps.files.outputs.removed }}; do | |
echo "D ${changed_file}." | |
done | |
for changed_file in ${{ steps.files.outputs.added }}; do | |
echo "A ${changed_file}." | |
done | |
for changed_file in ${{ steps.files.outputs.renamed }}; do | |
echo "AD ${changed_file}." | |
done | |
- name: Hygiene | |
env: | |
BASE_REF_SHA: ${{ github.event.pull_request.base.sha }} | |
PR_REF_SHA: ${{ github.event.pull_request.head.sha }} | |
if: contains(steps.files.outputs.modified, 'configure.ac') || contains(steps.files.outputs.modified, 'shell/install.sh') || contains(steps.files.outputs.all, 'src_ext') || contains(steps.files.outputs.all, '.github/workflows') | |
run: bash -exu .github/scripts/main/hygiene.sh |