Skip to content

5.3 support: Backport attributes on constant fix (#2624) #810

5.3 support: Backport attributes on constant fix (#2624)

5.3 support: Backport attributes on constant fix (#2624) #810

Workflow file for this run

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: Format
run: opam exec -- dune fmt
- 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
# Using a specific version because of https://github.com/actions/upload-artifact/issues/590
uses: actions/[email protected]
with:
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
path: _build/install/default/bin/ocamlformat
test-branch:
if: ${{ github.ref != 'refs/heads/main' }}
needs: build-linux
runs-on: ubuntu-latest
strategy:
matrix:
profile:
- conventional
- ocamlformat
- janestreet
# To enable comparing with ocp-indent:
# 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/[email protected]
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' || '' }}