Skip to content

generate binaries #1434

generate binaries

generate binaries #1434

Workflow file for this run

name: Builds, tests & co
on:
push:
paths:
- 'src/**'
- '!src/tools/**'
- 'src_ext/**'
- 'dune'
- 'dune-project'
- '*.opam'
- 'Makefile*'
- 'configure*'
pull_request:
paths:
- 'src/**'
- '!src/tools/**'
- 'src_ext/**'
- 'dune'
- 'dune-project'
- '*.opam'
- 'Makefile*'
- 'configure*'
- '.github/scripts/**'
- '.github/workflows/main.yml'
- 'tests/**'
- '!tests/bench/**'
- 'shell/'
# paths-ignore:
# - 'release/**'
# - 'shell/**'
# - 'admin-scripts/**'
# - 'doc/**'
# - 'CHANGES'
# - 'LICENSE'
# - 'CONTRIBUTING.md'
# - 'master_changes.md'
# - 'README.md'
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: b251e0d9d0a8bcb0742d4d495c70f479effe16c2
OPAM_REPO_SHA: b251e0d9d0a8bcb0742d4d495c70f479effe16c2
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
NO-OP:
runs-on: ubuntu-latest
steps:
- name: no-op
run: echo something
####
# Build
####
Build-Linux:
runs-on: ubuntu-latest
needs: Analyse
strategy:
matrix:
ocamlv: [ 4.08.1, 4.14.1 ]
fail-fast: true
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: Build
run: bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu
- name: Check binary label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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=$BINARY_LABEL" >> $GITHUB_ENV
- name: Upload opam binaries
if: env.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: |
/home/runner/local/bin/opam
/home/runner/local/bin/opam-installer
retention-days: 1