Skip to content

Commit

Permalink
Add trunk-build github action
Browse files Browse the repository at this point in the history
Adds an action that builds with the latest supported trunk.

I heavily reused the work of @shym from ocaml-ppx#410, thank you for this
contribution!

Signed-off-by: Nathan Rebours <[email protected]>
  • Loading branch information
NathanReb committed Jun 12, 2024
1 parent a0d7c8e commit 4b1c672
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
51 changes: 51 additions & 0 deletions .github/workflows/trunk-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build on `trunk`

on:
push:
pull_request:
schedule:
# Every weekday, at 5:43 UTC
- cron: '43 5 * * 1-5'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Pick up a robust cache prefix
id: setup
run: |
# Ensure that cache is flushed when trunk is updated
cache_prefix="$(git ls-remote https://github.com/ocaml/ocaml.git refs/heads/trunk | cut -f 1)"
echo "cache_prefix=$cache_prefix" >> "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT"
- name: Install OCaml compiler
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 'ocaml-variants.5.3.0+trunk'
dune-cache: true
cache-prefix: ${{ steps.setup.outputs.cache_prefix }}

- name: Install ppxlib dependencies
run: |
opam install ./ppxlib.opam --deps-only
- name: Show configuration
run: |
opam exec -- ocamlc -config
opam config list
opam exec -- dune printenv
opam list
- name: Build the ppxlib
run: opam exec -- dune build -p ppxlib @install

- name: Install test dependencies
run: |
opam install ./ppxlib.opam --deps-only -t
opam exec -- dune build -p ppxlib @runtest
continue-on-error: true
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Ppxlib - Meta-programming for OCaml

[![ocaml-ci status][ocaml-ci-img]][ocaml-ci] [![AppVeyor status][appveyor-img]][appveyor]
[![ocaml-ci status][ocaml-ci-img]][ocaml-ci] [![trunk-build-status][trunk-build-img]][trunk-build] [![AppVeyor status][appveyor-img]][appveyor]

[ocaml-ci]: https://ci.ocamllabs.io/github/ocaml-ppx/ppxlib
[ocaml-ci-img]: https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Focaml-ppx%2Fppxlib%2Fmain&logo=ocaml
[appveyor]: https://ci.appveyor.com/project/diml/ppxlib/branch/main
[appveyor-img]: https://ci.appveyor.com/api/projects/status/bogbsm33uvh083jx?svg=true
[trunk-build]: https://github.com/ocaml-ppx/ppxlib/actions/workflows/trunk-build.yml
[trunk-build-img]: https://github.com/ocaml-ppx/ppxlib/actions/workflows/trunk-build.yml/badge.svg?branch=main

[Ppxlib documentation][doc]

Expand Down

0 comments on commit 4b1c672

Please sign in to comment.