From 5dec1d4a91791b5b680e78ab62d812abc05c3281 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Thu, 14 Dec 2023 16:22:13 +0100 Subject: [PATCH] test --- .github/workflows/ci.ml | 105 ++++++-- .github/workflows/main.yml | 492 ++----------------------------------- 2 files changed, 111 insertions(+), 486 deletions(-) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 051f765d74c..2736f3a1ee9 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -258,12 +258,19 @@ let install_sys_packages packages ~descr ?cond platforms = let install_sys_opam ?cond = install_sys_packages ["opam"] ~descr:"Install system's opam package" ?cond let install_sys_dune ?cond = install_sys_packages ["dune"; "ocaml"] ~descr:"Install system's dune and ocaml packages" ?cond - +(* +oc:out_channel -> +workflow:'a -> +platforms:'b Lib.platform list -> +keys:(string * string) list -> +(Lib.job -> oc:out_channel -> workflow:'a -> 'c) -> 'c +*) let analyse_job ~oc ~workflow ~platforms ~keys f = let oses = List.map os_of_platform platforms in let outputs = let f (key, _) = (key, Printf.sprintf "${{ steps.keys.outputs.%s }}" key) in List.map f keys + @ ["binary_label", "${{ steps.label.outputs.binary_label }}"] in let keys = let set_key (name, value) = @@ -289,10 +296,21 @@ let analyse_job ~oc ~workflow ~platforms ~keys f = else None in + let upload_binary = + run "Determine uploading binary label" + ~shell:"bash" ~env:["GH_TOKEN","${{ secrets.GITHUB_TOKEN }}"] + ~id:"label" + [ + {|binary_label=$(gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep "PR:BINARIES" || echo "other")|}; + {|echo "$binary_label"|}; + {|echo "binary_label=$binary_label" >> $GITHUB_OUTPUT|} + ] + in job ~oc ~workflow ~runs_on:(Runner platforms) ~outputs ~section:"Caches" "Analyse" ++ only_with Windows (git_lf_checkouts ~cond:(Predicate(true, Runner Windows)) ~shell:"cmd" ~title:"Configure Git for Windows" ()) ++ checkout () ++ run "Determine cache keys" ~id:"keys" keys + ++ upload_binary ++ cache ?cond:linux_guard ~key_prefix:"steps.keys" ~check_only:true Archives ++ build_cache ?cond:not_windows_guard Archives ++ end_job f @@ -328,6 +346,49 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w let matrix = ((platform <> Windows), matrix, includes) in let needs = if platform = Windows then [analyse_job; cygwin_job] else [analyse_job] in let host = host_of_platform platform in + let upload_binaries = + let cond = + let label = + Predicate (true, Compare ("needs.Analyse.outputs.binary_label", "PR:BINARIES")) + in + match runner with + | MacOS -> label + | Windows -> + And (label, + Predicate (true, EndsWith ("matrix.host", "-pc-cygwin"))) + | Linux -> + And (label, + Predicate (true, Compare ("matrix.ocamlv", "4.14.1"))) + in + let withs = + let name = + match runner with + | Linux | MacOS -> + Literal ["opam-exe-${{ runner.os }}-${{ matrix.ocamlv }}"] + | Windows -> + Literal + ["opam-exe-${{ matrix.host }}-${{ matrix.ocamlv }}-${{ matrix.build }}"] + in + let paths = + let prefix = + match runner with + | MacOS -> "/Users/runner/local/bin/" + | Linux -> "/home/runner/local/bin/" + | Windows -> "D:\\Local\\bin\\" + in + let binaries = ["opam-installer"; "opam"] in + match runner with + | MacOS | Linux -> + Literal ((List.rev_map (fun s -> prefix ^ s)) binaries) + | Windows -> + Literal ((List.rev_map (fun s -> prefix ^ s ^ ".exe")) + ("opam-putenv":: binaries)) + in + [ "name", name; "path", paths; ] + in + uses "Upload opam binaries" "actions/upload-artifact@v3" + ~cond ~withs ~continue_on_error:true + in job ~oc ~workflow ~runs_on:(Runner [runner]) ?shell ?section ~needs ~matrix ("Build-" ^ name_of_platform platform) ++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"]) ++ only_on Windows (git_lf_checkouts ~cond:(Predicate(true, EndsWith("matrix.host", "-pc-cygwin"))) ~shell:"cmd" ~title:"Configure LF checkout for Cygwin" ()) @@ -338,6 +399,7 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w ++ only_on Windows (unpack_cygwin "${{ matrix.build }}" "${{ matrix.host }}") ++ build_cache OCaml platform "${{ matrix.ocamlv }}" host ++ run "Build" ["bash -exu .github/scripts/main/main.sh " ^ host] + ++ upload_binaries ++ not_on Windows (run "Test (basic)" ["bash -exu .github/scripts/main/test.sh"]) ++ only_on Windows (run "Test (basic - Cygwin)" ~cond:(Predicate(true, EndsWith("matrix.host", "-pc-cygwin"))) ["bash -exu .github/scripts/main/test.sh"]) ++ only_on Windows (run "Test (basic - native Windows)" ~env:[("OPAMROOT", {|D:\a\opam\opam\.opam|})] ~shell:"cmd" ~cond:(Predicate(false, EndsWith("matrix.host", "-pc-cygwin"))) @@ -463,6 +525,17 @@ let hygiene_job (type a) ~analyse_job (platform : a platform) ~oc ~workflow f = ++ run "Hygiene" ~cond:(Or(Predicate(true, Contains("steps.files.outputs.modified", "configure.ac")), Predicate(true, Contains("steps.files.outputs.all", "src_ext")))) ~env:[("BASE_REF_SHA", "${{ github.event.pull_request.base.sha }}"); ("PR_REF_SHA", "${{ github.event.pull_request.head.sha }}")] ["bash -exu .github/scripts/main/hygiene.sh"] ++ end_job f +let empty_job ~oc ~workflow f + ~analyse_job:_ + (* ~cygwin_job:_ *) + (* ~build_Windows_job:_ *) + (* ~build_Linux_job:_ *) + (* ~build_macOS_job:_ *) + = + job ~oc ~workflow ~runs_on:(Runner [Linux]) "NO-OP" + ++ run "no-op" ["echo something"] + ++ end_job f + let main oc : unit = let env = [ ("OPAMBSVERSION", "2.1.0"); @@ -486,20 +559,22 @@ let main oc : unit = ("opam-bs-cache", "${{ hashFiles('.github/scripts/main/opam-bs-cache.sh', '*.opam', '.github/scripts/main/preamble.sh') }}"); ] in workflow ~oc ~env "Builds, tests & co" - ++ analyse_job ~keys ~platforms:[Linux] (fun analyse_job -> - cygwin_job ~analyse_job (fun cygwin_job -> - main_build_job ~analyse_job ~cygwin_job ~section:"Build" Linux (4, 08) (fun build_linux_job -> - main_build_job ~analyse_job ~cygwin_job Windows latest_ocaml (fun build_windows_job -> - main_build_job ~analyse_job ~cygwin_job MacOS latest_ocaml (fun build_macOS_job -> - main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam tests" Linux (fun _ -> - main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS (fun _ -> - cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam cold" Linux (fun _ -> - solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Compile solver backends" Linux (fun _ -> - solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS (fun _ -> - upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Upgrade from 1.2 to current" Linux (fun _ -> - upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS (fun _ -> - hygiene_job ~analyse_job (Specific (Linux, "22.04")) (fun _ -> - end_workflow))))))))))))) + ++ analyse_job ~keys ~platforms:[Linux] @@ fun analyse_job -> + empty_job ~analyse_job @@ fun cygwin_job -> + main_build_job ~analyse_job ~cygwin_job ~section:"Build" Linux (4, 08) @@ fun build_linux_job -> +(* + main_build_job ~analyse_job ~cygwin_job Windows latest_ocaml @@ fun build_windows_job -> + main_build_job ~analyse_job ~cygwin_job MacOS latest_ocaml @@ fun build_macOS_job -> + main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam tests" Linux @@ fun _ -> + main_test_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS @@ fun _ -> + cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Opam cold" Linux @@ fun _ -> + solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Compile solver backends" Linux @@ fun _ -> + solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS @@ fun _ -> + upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ~section:"Upgrade from 1.2 to current" Linux @@ fun _ -> + upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job MacOS @@ fun _ -> + hygiene_job ~analyse_job (Specific (Linux, "22.04")) @@ fun _ -> +*) + end_workflow let () = let oc = open_out "main.yml" in diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ab24865e70..7d6e0990574 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,6 +66,7 @@ jobs: ocaml-cache: ${{ steps.keys.outputs.ocaml-cache }} cygwin: ${{ steps.keys.outputs.cygwin }} opam-bs-cache: ${{ steps.keys.outputs.opam-bs-cache }} + binary_label: ${{ steps.label.outputs.binary_label }} steps: - name: Checkout tree uses: actions/checkout@v3 @@ -80,6 +81,15 @@ jobs: 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: Determine uploading binary label + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: label + shell: bash + run: | + binary_label=$(gh api --jq '.labels.[].name' /repos/${{ github.repository }}/pulls/${{ github.event.number }} | grep "PR:BINARIES" || echo "other") + echo "$binary_label" + echo "binary_label=$binary_label" >> $GITHUB_OUTPUT - name: src_ext/archives and opam-repository Cache id: archives uses: ocaml-opam/cache@opam @@ -94,25 +104,11 @@ jobs: if: steps.archives.outputs.cache-hit != 'true' run: bash -exu .github/scripts/main/archives-cache.sh - Cygwin: - runs-on: windows-2019 - needs: Analyse + NO-OP: + runs-on: ubuntu-latest 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 + - name: no-op + run: echo something #### # Build @@ -149,460 +145,14 @@ jobs: 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 - - 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 (basic - Cygwin) - if: endsWith(matrix.host, '-pc-cygwin') - run: bash -exu .github/scripts/main/test.sh - - name: Test (basic - native Windows) - env: - OPAMROOT: D:\a\opam\opam\.opam - if: endsWith(matrix.host, '-pc-cygwin') == false - shell: cmd - run: | - set Path=D:\Cache\ocaml-local\bin;%Path% - if "${{ matrix.host }}" equ "x86_64-pc-windows" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - if "${{ matrix.host }}" equ "i686-pc-windows" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" - opam init --yes --bare default git+file://D:/opam-repository#${{ env.OPAM_TEST_REPO_SHA }} || exit /b 1 - opam switch --yes create default ocaml-system || exit /b 1 - opam env || exit /b 1 - opam install --yes lwt || exit /b 1 - opam list || exit /b 1 - opam config report || exit /b 1 - - name: Test (reftests) - run: bash -exu .github/scripts/main/reftests.sh ${{ matrix.host }} - - Build-macOS: - runs-on: macos-latest - needs: Analyse - strategy: - matrix: - ocamlv: [ 4.14.1 ] - fail-fast: true - steps: - - 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: Build - run: bash -exu .github/scripts/main/main.sh x86_64-apple-darwin - - name: Test (basic) - run: bash -exu .github/scripts/main/test.sh - -#### -# Opam tests -#### - Test-Linux: - runs-on: ubuntu-latest - needs: [ Analyse, Build-Linux ] - 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 - -#### -# Opam cold -#### - Cold-Linux: - runs-on: ubuntu-latest - needs: [ Analyse, Build-Linux ] - env: - OPAM_COLD: 1 - steps: - - name: Install bubblewrap - run: sudo apt install bubblewrap - - name: Checkout tree - uses: actions/checkout@v3 - - name: src_ext/archives and opam-repository Cache - id: archives - uses: ocaml-opam/cache@opam + - name: Upload opam binaries + if: needs.Analyse.outputs.binary_label == 'PR:BINARIES' && matrix.ocamlv == '4.14.1' + uses: actions/upload-artifact@v3 + continue-on-error: true with: + name: opam-exe-${{ runner.os }}-${{ matrix.ocamlv }} path: | - src_ext/archives - ~/opam-repository - key: ${{ needs.Analyse.outputs.archives }} - force-gzip: true - - name: Cold - run: | - make compiler - make lib-pkg - bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu + /home/runner/local/bin/opam + /home/runner/local/bin/opam-installer - name: Test (basic) run: bash -exu .github/scripts/main/test.sh - -#### -# Compile solver backends -#### - Solvers-Linux: - runs-on: ubuntu-latest - needs: [ Analyse, Build-Linux ] - strategy: - matrix: - solver: [ z3, 0install ] - ocamlv: [ 4.14.1 ] - fail-fast: false - env: - SOLVER: ${{ matrix.solver }} - OPAMBSROOT: ~/.cache/opam.${{ matrix.solver }}.cached - steps: - - name: Install bubblewrap - run: sudo apt install bubblewrap - - 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-${{ matrix.solver }}-${{ 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 - run: bash -exu .github/scripts/main/solvers.sh - - Solvers-macOS: - runs-on: macos-latest - needs: [ Analyse, Build-macOS ] - strategy: - matrix: - solver: [ z3, 0install ] - ocamlv: [ 4.14.1 ] - fail-fast: false - env: - SOLVER: ${{ matrix.solver }} - OPAMBSROOT: ~/.cache/opam.${{ matrix.solver }}.cached - steps: - - 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-${{ matrix.solver }}-${{ 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 - run: bash -exu .github/scripts/main/solvers.sh - -#### -# Upgrade from 1.2 to current -#### - Upgrade-Linux: - runs-on: ubuntu-latest - needs: [ Analyse, Build-Linux ] - strategy: - matrix: - ocamlv: [ 4.14.1 ] - fail-fast: false - steps: - - name: Install bubblewrap - run: sudo apt install bubblewrap - - name: Checkout tree - uses: actions/checkout@v3 - - name: opam 1.2 root Cache - uses: actions/cache@v3 - with: - path: ${{ env.OPAM12CACHE }} - key: ${{ runner.os }}-opam1.2-root - - 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: Build - env: - OPAM_UPGRADE: 1 - run: bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu - - name: Test (upgrade) - run: bash -exu .github/scripts/main/upgrade.sh - - Upgrade-macOS: - runs-on: macos-latest - needs: [ Analyse, Build-macOS ] - strategy: - matrix: - ocamlv: [ 4.14.1 ] - fail-fast: false - steps: - - name: Checkout tree - uses: actions/checkout@v3 - - name: opam 1.2 root Cache - uses: actions/cache@v3 - with: - path: ${{ env.OPAM12CACHE }} - key: ${{ runner.os }}-opam1.2-root - - 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: Build - env: - OPAM_UPGRADE: 1 - run: bash -exu .github/scripts/main/main.sh x86_64-apple-darwin - - name: Test (upgrade) - run: bash -exu .github/scripts/main/upgrade.sh - -#### -# 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@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: Get changed files - id: files - uses: Ana06/get-changed-files@v2.2.0 - - 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.all, 'src_ext') - run: bash -exu .github/scripts/main/hygiene.sh