Backport 5.2 compilerlibs changes #391
Workflow file for this run
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: Build on Linux | |
# Build and run tests on ubuntu-latest. | |
# The built binary is uploaded for later use in test-branch. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-linux: | |
strategy: | |
matrix: | |
ocaml-compiler: | |
# Don't include every versions. OCaml-CI already covers that | |
- 4.14.x | |
runs-on: ubuntu-latest | |
steps: | |
# Clone the project | |
- uses: actions/checkout@v2 | |
with: | |
# Don't checkout the implicit merge commit to avoid wrong substitution | |
ref: ${{ github.event.pull_request.head.sha }} | |
# Setup | |
- name: Setup OCaml ${{ matrix.ocaml-version }} | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
- name: Opam dependencies | |
run: opam install --deps-only -t . | |
- name: Build | |
run: | | |
opam exec -- dune subst | |
opam exec -- dune build -p ocamlformat-lib,ocamlformat | |
- name: Runtest | |
run: opam exec -- dune runtest | |
- name: Check manpages | |
run: opam exec -- dune build @gen_manpage --auto-promote | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ocamlformat-${{ runner.os }}-${{ runner.arch }} | |
path: _build/install/default/bin/ocamlformat | |
test-branch: | |
needs: build-linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
profile: | |
- conventional | |
- ocamlformat | |
- janestreet | |
include: | |
- ocp_indent: true | |
ocp_indent_config: JaneStreet | |
profile: janestreet | |
steps: | |
- name: Install ocp-indent | |
if: ${{ matrix.ocp_indent }} | |
run: | | |
sudo apt install -y ocp-indent | |
sudo touch /etc/ocamlfind.conf | |
# Clone the project | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: test-extra/code | |
key: test-extra-code | |
- name: Fetch main build of ocamlformat | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build-linux.yml | |
workflow_conclusion: "" | |
check_artifacts: true | |
branch: main | |
name: ocamlformat-${{ runner.os }}-${{ runner.arch }} | |
path: ocamlformat-a | |
- name: Fetch new build of ocamlformat | |
uses: actions/download-artifact@v3 | |
with: | |
name: ocamlformat-${{ runner.os }}-${{ runner.arch }} | |
path: ocamlformat-b | |
- name: Test ${{ matrix.profile }} profile | |
run: | | |
chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat | |
./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}' | |
shell: bash | |
env: | |
OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }} | |
TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }} |