Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/actions/test-oxcaml/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Setup OxCaml with a predefined set of opam packages
inputs:
ocaml-compiler:
description: The OCaml compiler switch to install
required: true

opam-disable-sandboxing:
description: Disable the opam sandboxing feature.
required: false
default: "false"

runs:
using: "composite"
steps:
- name: Install required packages on Linux
shell: sh
run: |
set -e
if [ "$(uname)" = "Linux" ]; then
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "Detected Linux distro: $ID"
case "$ID" in
ubuntu|debian)
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential curl git rsync sudo unzip nano
;;
arch)
pacman -Sy --noconfirm make gcc patch tar ca-certificates git \
rsync curl sudo bash nano coreutils xz ncurses diffutils \
unzip
;;
*)
echo "Unsupported Linux distro: $ID"
exit 1
;;
esac
else
echo "Missing /etc/os-release on Linux?"
exit 1
fi
else
# Installing autoconf beforehand prevents recompilation of the
# compiler when restoring from the cache
brew install autoconf
fi

- name: Get hash of the ocaml-variant opam file
id: hash-opam-file
shell: bash
env:
OCAML_COMPILER: ${{ inputs.ocaml-compiler }}
run: |
set -e
OPAM_FILE="packages/ocaml-variants/${OCAML_COMPILER}/opam"

if command -v sha256sum >/dev/null 2>&1; then
COMMAND="sha256sum"
elif command -v shasum >/dev/null 2>&1; then
COMMAND="shasum -a 256"
else
echo "ERROR: Neither sha256sum nor shasum is available." >&2
exit 1
fi

HASH=$($COMMAND "$OPAM_FILE" | awk '{print $1}')
echo "hash=${HASH}" >> "$GITHUB_OUTPUT"

- uses: ocaml/[email protected]
with:
cache-prefix: ${{ steps.hash-opam-file.outputs.hash }}
ocaml-compiler: ${{ inputs.ocaml-compiler }}
opam-pin: false
opam-disable-sandboxing: ${{ inputs.opam-disable-sandboxing }}
opam-repositories: |
oxcaml: .
default: https://github.com/ocaml/opam-repository.git

- name: Install common opam packages
shell: bash
run: |
opam --version
opam repository list
opam list
opam install ocamlformat merlin ocaml-lsp-server utop parallel core_unix
opam list
60 changes: 33 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,47 @@ on:
schedule:
- cron: "30 0 * * *"

# For info on the OS versions, architecture, etc., see
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

jobs:
test-setup:
env:
OCAML_VARIANT: ocaml-variants.5.2.0+ox
test-linux:
strategy:
fail-fast: false
matrix:
# For info on the OS versions, architecture, etc., see
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest]
image: [ubuntu:24.04, debian:bookworm]
os: [ubuntu-latest, ubuntu-24.04-arm]
include:
- image: archlinux:latest
os: ubuntu-latest
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.image }}
steps:
- name: Check OS info
run: |
uname -a

- name: Checkout the repository
uses: actions/checkout@v4

- name: Get hash of the ocaml-variant opam file
id: hash-opam-file
run: |
HASH=$(shasum -a 256 packages/ocaml-variants/${OCAML_VARIANT}/opam | awk '{print $1}')
echo "hash=${HASH}" >> "$GITHUB_OUTPUT"

- uses: ocaml/setup-ocaml@v3
- name: Run Test OxCaml action
uses: ./.github/actions/test-oxcaml
with:
# Invalidate cache when opam file for the ocaml-variant changes
cache-prefix: ${{ steps.hash-opam-file.outputs.hash }}
ocaml-compiler: ${{ env.OCAML_VARIANT }}
opam-pin: false
opam-repositories: |
oxcaml: .
default: https://github.com/ocaml/opam-repository.git
ocaml-compiler: ocaml-variants.5.2.0+ox
opam-disable-sandboxing: true

- name: opam install packages
run: |
opam --version
opam repository list
opam list
opam install ocamlformat merlin ocaml-lsp-server utop parallel core_unix
opam list
test-macos:
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Run Test OxCaml action
uses: ./.github/actions/test-oxcaml
with:
ocaml-compiler: ocaml-variants.5.2.0+ox
Loading