squash #1458
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: | |
pull_request: | |
paths: | |
- 'src/**' | |
- '!src/tools/**' | |
- 'src_ext/**' | |
- 'dune' | |
- 'dune-project' | |
- '*.opam' | |
- 'Makefile*' | |
- 'configure*' | |
- '.github/scripts/**' | |
- '.github/workflows/main.yml' | |
- 'tests/**' | |
- '!tests/bench/**' | |
- 'shell/' | |
push: | |
branches: | |
- 'master' | |
- '2.**' | |
- 'init-test.debug' | |
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: c687553afb80373165068d67f33512b7ad39e6a3 | |
OPAM_REPO_SHA: c687553afb80373165068d67f33512b7ad39e6a3 | |
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@v3 | |
- name: Determine cache keys | |
id: keys | |
run: | | |
echo archives=archives-1-${{ hashFiles('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.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('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.sh') }} | |
echo ocaml-cache=${{ hashFiles('.github/scripts/main/ocaml-cache.sh', '.github/scripts/main/preamble.sh', '.github/scripts/main/create-ocaml-cache.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: ocaml-opam/cache@opam | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ steps.keys.outputs.archives }} | |
check-only: true | |
force-gzip: 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 | |
Cygwin: | |
runs-on: windows-2019 | |
needs: Analyse | |
steps: | |
- name: Cygwin64 Cache | |
id: cygwin64 | |
uses: ocaml-opam/cache@opam | |
with: | |
path: D:\Cache\cygwin\x86_64-pc-cygwin | |
key: cygwin64-${{ needs.Analyse.outputs.cygwin }} | |
check-only: true | |
force-gzip: true | |
- name: Checkout tree | |
if: steps.cygwin64.outputs.cache-hit != 'true' | |
uses: actions/checkout@v3 | |
- name: Create Cygwin64 cache | |
if: steps.cygwin64.outputs.cache-hit != 'true' | |
shell: cmd | |
run: .github\scripts\cygwin.cmd x86_64-pc-cygwin D:\Cache\cygwin create | |
#### | |
# Build | |
#### | |
Build-Windows: | |
runs-on: windows-2019 | |
needs: [ Analyse, Cygwin ] | |
strategy: | |
matrix: | |
host: [ x86_64-pc-cygwin, i686-w64-mingw32, x86_64-w64-mingw32, i686-pc-windows, x86_64-pc-windows ] | |
build: [ x86_64-pc-cygwin ] | |
ocamlv: [ 4.14.1 ] | |
fail-fast: false | |
defaults: | |
run: | |
shell: D:\cygwin\bin\bash.exe {0} | |
steps: | |
- name: Configure LF checkout for Cygwin | |
if: endsWith(matrix.host, '-pc-cygwin') | |
shell: cmd | |
run: | | |
git config --system core.autocrlf false | |
git config --system core.eol lf | |
- name: Checkout tree | |
uses: actions/checkout@v3 | |
- name: Cygwin64 Cache | |
id: cygwin64 | |
if: matrix.build == 'x86_64-pc-cygwin' | |
uses: ocaml-opam/cache@opam | |
with: | |
path: D:\Cache\cygwin\x86_64-pc-cygwin | |
key: cygwin64-${{ needs.Analyse.outputs.cygwin }} | |
force-gzip: true | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: ocaml-opam/cache@opam | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
force-gzip: true | |
- name: OCaml ${{ matrix.ocamlv }} Cache | |
id: ocaml-cache | |
uses: ocaml-opam/cache@opam | |
with: | |
path: D:\Cache\ocaml-local.tar | |
key: ${{ runner.os }}-${{ matrix.host }}-ocaml-${{ matrix.ocamlv }}-${{ needs.Analyse.outputs.ocaml-cache }} | |
force-gzip: true | |
- name: Unpack Cygwin | |
shell: cmd | |
run: .github\scripts\cygwin.cmd ${{ matrix.build }} D:\Cache\cygwin ${{ matrix.host }} | |
- name: Unpack OCaml ${{ matrix.ocamlv }} | |
run: bash -exu .github/scripts/main/ocaml-cache.sh ${{ runner.os }} ${{ matrix.ocamlv }} ${{ matrix.host }} | |
- name: Build | |
run: bash -exu .github/scripts/main/main.sh ${{ matrix.host }} | |
- name: Test "static" binaries on Windows | |
if: endsWith(matrix.host, '-pc-cygwin') == false | |
run: ldd ./opam.exe | test "$(grep -v -F /cygdrive/c/Windows/)" = '' | |
- name: Test (reftests) | |
run: bash -exu .github/scripts/main/reftests.sh ${{ matrix.host }} | |
#### | |
# Opam tests | |
#### | |
Test-Linux: | |
runs-on: ubuntu-latest | |
needs: [ Analyse ] | |
strategy: | |
matrix: | |
ocamlv: [ 4.14.1 ] | |
fail-fast: false | |
env: | |
OPAM_TEST: 1 | |
steps: | |
- name: Checkout tree | |
uses: actions/checkout@v3 | |
- name: Install bubblewrap | |
run: sudo apt install bubblewrap | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: ocaml-opam/cache@opam | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
force-gzip: true | |
- name: OCaml ${{ matrix.ocamlv }} Cache | |
id: ocaml-cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: | | |
${{ env.OPAMBSROOT }}/** | |
~/.cache/opam-local/bin/** | |
key: opam-${{ 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: opam-rt Cache | |
id: opam-rt | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/opam-rt/** | |
key: ${{ runner.os }}-opam-rt-${{ matrix.ocamlv }} | |
- name: Build (and test) | |
run: bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu | |
- name: Test (opam-rt) | |
run: bash -exu .github/scripts/main/opam-rt.sh | |
Test-macOS: | |
runs-on: macos-latest | |
needs: Analyse | |
strategy: | |
matrix: | |
ocamlv: [ 4.14.1 ] | |
fail-fast: false | |
env: | |
OPAM_TEST: 1 | |
steps: | |
- name: Install gnu coreutils | |
run: brew install coreutils | |
- name: Checkout tree | |
uses: actions/checkout@v3 | |
- name: src_ext/archives and opam-repository Cache | |
id: archives | |
uses: ocaml-opam/cache@opam | |
with: | |
path: | | |
src_ext/archives | |
~/opam-repository | |
key: ${{ needs.Analyse.outputs.archives }} | |
force-gzip: true | |
- name: OCaml ${{ matrix.ocamlv }} Cache | |
id: ocaml-cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: | | |
${{ env.OPAMBSROOT }}/** | |
~/.cache/opam-local/bin/** | |
key: opam-${{ 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: opam-rt Cache | |
id: opam-rt | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/opam-rt/** | |
key: ${{ runner.os }}-opam-rt-${{ matrix.ocamlv }} | |
- name: Build (and test) | |
run: bash -exu .github/scripts/main/main.sh x86_64-apple-darwin | |
- name: Test (opam-rt) | |
run: bash -exu .github/scripts/main/opam-rt.sh |