Skip to content

Upgrade to OCamlformat 0.26.0 #426

Upgrade to OCamlformat 0.26.0

Upgrade to OCamlformat 0.26.0 #426

Workflow file for this run

name: CI
on:
push:
# branches: [ main ]
pull_request:
branches: [ main ]
jobs:
linux-build:
strategy:
matrix:
platform:
- { name: "linux/amd64", filename_suffix: "linux-amd64", target_arch: "x86_64" }
- { name: "linux/arm64", filename_suffix: "linux-arm64", target_arch: "arm64" }
runAllTests:
- ${{ startsWith(github.ref, 'refs/tags/') }}
exclude:
- platform: { name: "linux/arm64", filename_suffix: "linux-arm64", target_arch: "arm64" }
runAllTests: false
fail-fast: false
runs-on: ubuntu-latest
env:
OCAMLPLATFORM_PLATFORM: ${{ matrix.platform.name }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed to fetch tags
# The latest tag is needed to build the release tarball but
# actions/checkout fails to fetch it properly.
# https://github.com/actions/checkout/issues/882
- name: Fetch tags
run: git fetch --tags --force origin
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
- name: Build
run: ./test/run_test.sh
- name: Check images
run: docker image ls
- name: "Test: install"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh install
- name: "Test: ocaml5"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh ocaml5
- name: "Test: install with latest opam"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh install-with-latest-opam
- name: "Test: version"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh version
- name: "Test: install-in-small-project"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh install-in-small-project
- name: "Test: odoc"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh odoc
- name: "Test: ocamlformat"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh ocamlformat
- name: "Test: ocamlformat_user_installed"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh ocamlformat_user_installed
- name: "Test: reinstall_cached"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh reinstall_cached
- name: "Test: reinstall_ocamlformat"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh reinstall_ocamlformat
- name: "Test: version dependency"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh version_dependent
- name: "Test: pinned-compiler"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh pinned-compiler
- name: "Test: continue-when-build-fails"
if: ${{matrix.platform.target_arch == 'x86_64'}}
run: ./test/run_test.sh continue-when-build-fails
- name: Build release tarball
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p release; chmod a+rw release;
docker buildx build --platform ${{ matrix.platform.name }} --load \
-f src/distrib/release.Dockerfile \
-t ocaml-platform-release-${{ matrix.platform.name }} .
docker run --platform ${{ matrix.platform.name }} -v $PWD/release:/release \
-e VERSION=$GITHUB_REF_NAME \
-e TARGETOS=linux \
-e TARGETARCH=${{ matrix.platform.target_arch }} \
-e OUTPUT=/release \
ocaml-platform-release-${{ matrix.platform.name }} \
opam exec -- bash src/distrib/release.sh
- name: upload archives
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: archives
path: release/*
mac-build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
ocaml-compiler:
- 4.14.x
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# See the same step in the linux build
- name: Fetch tags
run: git fetch --tags --force origin
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: ${{ matrix.os != 'macos-latest' }}
- name: Install dependencies
run: opam install --deps-only --with-test --with-doc -y .
- name: Build release tarball
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p release;
export OUTPUT=$PWD/release;
export TARGETOS=macos;
export TARGETARCH=x86_64;
export VERSION=$GITHUB_REF_NAME;
opam exec -- bash src/distrib/release.sh
- name: upload archives
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: archives
path: release/*
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-build, mac-build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: archives
path: archives
- name: Generate installer script
run:
export VERSION=${GITHUB_REF#refs/tags/};
export ARCHIVES_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/$VERSION;
bash src/distrib/make_installer.sh archives/* > installer.sh
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
installer.sh
archives/*