-
Notifications
You must be signed in to change notification settings - Fork 3
126 lines (124 loc) · 3.71 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: CI
on:
pull_request:
push:
branches:
- master
release:
types:
- published
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os:
- macos-13 # Intel (x86_64)
- macos-latest # M1 (aarch64)
- ubuntu-latest
- windows-latest
ocaml-compiler:
- 4.03.x
- 4.04.x
- 4.05.x
- 4.06.x
- 4.07.x
- 4.08.x
- 4.09.x
- 4.10.x
- 4.11.x
- 4.12.x
- 4.13.x
- 4.14.x
- 5.0.x
- 5.1.x
- 5.2.x
- 5.3.x
- 5.4.x
exclude:
# See https://github.com/ocaml/setup-ocaml?tab=readme-ov-file#ocaml-compiler-support-matrix
- os: macos-latest
ocaml-compiler: 4.03.x
- os: macos-latest
ocaml-compiler: 4.04.x
- os: macos-latest
ocaml-compiler: 4.05.x
- os: macos-latest
ocaml-compiler: 4.06.x
- os: macos-latest
ocaml-compiler: 4.07.x
- os: macos-latest
ocaml-compiler: 4.08.x
- os: macos-latest
ocaml-compiler: 4.09.x
- os: macos-latest
ocaml-compiler: 4.11.x
- os: windows-latest
ocaml-compiler: 4.03.x
- os: windows-latest
ocaml-compiler: 4.04.x
- os: windows-latest
ocaml-compiler: 4.05.x
- os: windows-latest
ocaml-compiler: 4.06.x
- os: windows-latest
ocaml-compiler: 4.07.x
- os: windows-latest
ocaml-compiler: 4.08.x
- os: windows-latest
ocaml-compiler: 4.09.x
- os: windows-latest
ocaml-compiler: 4.10.x
- os: windows-latest
ocaml-compiler: 4.11.x
- os: windows-latest
ocaml-compiler: 4.12.x
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- run: opam install . --deps-only --with-test
- run: opam exec -- dune build
- run: opam exec -- dune runtest
build-and-push-image:
runs-on: ubuntu-latest
needs:
- build-and-test
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=schedule,pattern=nightly,enable=true,priority=1000
type=ref,event=branch,enable=true,priority=600
type=ref,event=tag,enable=true,priority=600
type=ref,event=pr,prefix=pr-,enable=true,priority=600
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}