Skip to content

Commit bbfe9a3

Browse files
committed
Add dune pkg binary release workflow
When a tag is pushed, a github action will build the project using dune package management and release the binaries under the tag on github. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
1 parent b81258d commit bbfe9a3

97 files changed

Lines changed: 2622 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# The actions/cache github action allows builds of tags to use artifacts cached
2+
# by builds of the default branch, but doesn't allow builds of tags to use
3+
# artifacts cached by other tags. Thus to make the dependencies of the project
4+
# available to the "release" workflow, they are built and cached by this
5+
# workflow.
6+
7+
name: Build and Cache Dependencies
8+
9+
on:
10+
push:
11+
branches:
12+
- 'main'
13+
14+
jobs:
15+
release-unix:
16+
name: Build and cache deps for ${{ matrix.name }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- os: macos-15-intel
22+
name: x86_64-macos
23+
- os: macos-15
24+
name: aarch64-macos
25+
- os: ubuntu-latest
26+
name: x86_64-linux-gnu
27+
steps:
28+
29+
- uses: actions/checkout@v4
30+
31+
- uses: ocaml-dune/setup-dune@v0
32+
33+
- name: Cache build artifacts
34+
id: artifact-cache
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
_build
39+
~/.cache/dune
40+
key: ${{ matrix.name }}-artifacts-${{ hashFiles('dune.lock') }}
41+
42+
- name: Build the project
43+
run: dune build @install --release --only-packages container-image

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release-unix:
10+
name: Release for ${{ matrix.name }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: macos-15-intel
16+
name: x86_64-macos
17+
- os: macos-15
18+
name: aarch64-macos
19+
- os: ubuntu-latest
20+
name: x86_64-linux-gnu
21+
steps:
22+
23+
- uses: actions/checkout@v4
24+
25+
- uses: ocaml-dune/setup-dune@v0
26+
27+
- name: Load dependencies from the cache
28+
id: artifact-cache
29+
uses: actions/cache/restore@v4
30+
with:
31+
path: |
32+
_build
33+
~/.cache/dune
34+
key: ${{ matrix.name }}-artifacts-${{ hashFiles('dune.lock') }}
35+
36+
- name: Build the project
37+
run: dune build @install --release --only-packages container-image
38+
39+
- run: echo OUT_NAME=container-image-${{ github.ref_name }}-${{ matrix.name }} >> $GITHUB_ENV
40+
41+
- name: Release a tarball of build outputs
42+
run: |
43+
mkdir -p "$OUT_NAME"
44+
cp -rlf _build/install/default/* "$OUT_NAME"
45+
tar czf "$OUT_NAME.tar.gz" "$OUT_NAME"
46+
47+
- name: Upload assets
48+
uses: ncipollo/release-action@v1
49+
with:
50+
allowUpdates: true
51+
artifacts: "*.tar.gz"

dune.lock/alcotest.1.9.1.pkg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(version 1.9.1)
2+
3+
(build
4+
(all_platforms
5+
((action
6+
(progn
7+
(when %{pkg-self:dev} (run dune subst))
8+
(run dune build -p %{pkg-self:name} -j %{jobs} @install))))))
9+
10+
(depends
11+
(all_platforms
12+
(dune ocaml fmt astring cmdliner re stdlib-shims uutf ocaml-syntax-shims)))
13+
14+
(source
15+
(fetch
16+
(url
17+
https://github.com/mirage/alcotest/releases/download/1.9.1/alcotest-1.9.1.tbz)
18+
(checksum
19+
sha256=1e29c3b41d4329062105b723dfda3aff86b8cef5e7c7500d0e491fc5fd78e482)))

dune.lock/angstrom.0.16.1.pkg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
(version 0.16.1)
2+
3+
(build
4+
(all_platforms
5+
((action
6+
(progn
7+
(when %{pkg-self:dev} (run dune subst))
8+
(run dune build -p %{pkg-self:name} -j %{jobs}))))))
9+
10+
(depends
11+
(all_platforms
12+
(ocaml dune bigstringaf ocaml-syntax-shims)))
13+
14+
(source
15+
(fetch
16+
(url https://github.com/inhabitedtype/angstrom/archive/0.16.1.tar.gz)
17+
(checksum md5=a9e096b4b2b8e4e3bb17d472bbccaad0)))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(version 0.3.2)
2+
3+
(build
4+
(all_platforms
5+
((action
6+
(progn
7+
(when %{pkg-self:dev} (run dune subst))
8+
(run dune build -p %{pkg-self:name} -j %{jobs}))))))
9+
10+
(depends
11+
(all_platforms
12+
(ocaml dune ptime)))
13+
14+
(source
15+
(fetch
16+
(url
17+
https://github.com/mirleft/ocaml-asn1-combinators/releases/download/v0.3.2/asn1-combinators-0.3.2.tbz)
18+
(checksum
19+
sha256=2b26985f6e2722073dcd9f84355bd6757e12643b5a48e30b3c07ff7cfb0d8a7f)))

dune.lock/astring.0.8.5.pkg

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(version 0.8.5)
2+
3+
(build
4+
(all_platforms
5+
((action (run ocaml pkg/pkg.ml build --pinned %{pkg-self:pinned})))))
6+
7+
(depends
8+
(all_platforms
9+
(ocaml ocamlfind ocamlbuild topkg)))
10+
11+
(source
12+
(fetch
13+
(url https://erratique.ch/software/astring/releases/astring-0.8.5.tbz)
14+
(checksum
15+
sha256=865692630c07c3ab87c66cdfc2734c0fdfc9c34a57f8e89ffec7c7d15e7a70fa)))

dune.lock/base-domains.base.pkg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(version base)
2+
3+
(depends
4+
(all_platforms (ocaml)))

dune.lock/base-threads.base.pkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(version base)

dune.lock/base-unix.base.pkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(version base)

dune.lock/base.v0.17.3.pkg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(version v0.17.3)
2+
3+
(build
4+
(all_platforms ((action (run dune build -p %{pkg-self:name} -j %{jobs})))))
5+
6+
(depends
7+
(all_platforms
8+
(ocaml ocaml_intrinsics_kernel sexplib0 dune dune-configurator)))
9+
10+
(source
11+
(fetch
12+
(url https://github.com/janestreet/base/archive/refs/tags/v0.17.3.tar.gz)
13+
(checksum md5=2100b0ed13fecf43be86ed45c5b2cc4d)))

0 commit comments

Comments
 (0)