-
Notifications
You must be signed in to change notification settings - Fork 29
176 lines (155 loc) · 5.61 KB
/
kind2-release.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Kind 2 Nightlies / Release
on:
workflow_dispatch:
# Run the nightly build at 8 AM UTC / 2 AM Central
schedule:
- cron: "0 8 * * *"
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
jobs:
get-nightly-ready:
if: github.repository == 'kind2-mc/kind2' && !startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Delete old assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ids=$(gh release view nightly --json assets --jq '.assets | map(.name) | .[]')
for id in $ids;
do
gh release delete-asset nightly $id -y
done
- name: Update nightly tag
run: |
git config user.name github-actions
git config user.email [email protected]
git tag -f nightly
git push --tags -f
create-new-release:
if: github.repository == 'kind2-mc/kind2' && startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Create new release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > Release_Notes.txt << EOF
TODO:
- Generate and upload user_documentation.pdf
- Replace this text with the release notes
- Publish the release!"
EOF
gh release create $GITHUB_REF_NAME --verify-tag --draft \
--title "Kind 2 $GITHUB_REF_NAME" --notes-file Release_Notes.txt \
--repo $GITHUB_REPOSITORY
build:
if: |
always()
&& github.repository == 'kind2-mc/kind2'
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
needs: [get-nightly-ready, create-new-release]
strategy:
matrix:
name: [ linux-x86_64, linux-arm64, macos-x86_64, macos-arm64 ]
ocaml-version: [ 5.3.0 ]
macos-target: [ 12 ]
include:
- name: linux-x86_64
os: ubuntu-latest
- name: linux-arm64
os: ubuntu-24.04-arm
- name: macos-x86_64
os: macos-13
bottle-suffix: monterey
libsodium-version: 1.0.20
libsodium-sha256: 0556f27feb8d4b5f31edf42e392eb4901daa5b9dbb8510499aa196c9e77134c6
zeromq-version: 4.3.5
zeromq-sha256: c8c1cafdffdc020cf504bc59888d61a016df6cdfc12650d89a43a846edb77ef2
- name: macos-arm64
os: macos-14
bottle-suffix: arm64_monterey
libsodium-version: 1.0.20
libsodium-sha256: 25377f9e16747b9af732be608a966b580287d0854c2d530f23eea1235bca1ff7
zeromq-version: 4.3.5
zeromq-sha256: 3a8bc264cb466f765f65f73b0db3c202899656efa11b2df37bd961a224589e20
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Kind 2 linux binary
if: runner.os == 'Linux'
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
context: ./
target: builder
load: true
tags: kind2:latest
- name: Extract Kind 2 linux binary
id: extract
if: runner.os == 'Linux'
uses: shrink/actions-docker-extract@v3
with:
image: kind2:latest
path: /home/opam/kind2-build/bin/kind2
destination: ./bin/
- name: Update package information (macOS)
if: runner.os == 'macOS'
run: brew update
# Build Kind 2 binaries compatible with old versions of macOS
- name: Set MACOSX_DEPLOYMENT_TARGET
if: runner.os == 'macOS'
run: echo "MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos-target }}" >> $GITHUB_ENV
- name: Install ZeroMQ and its dependency (libsodium)
if: runner.os == 'macOS'
run: |
LIBSODIUM_BOTTLE=libsodium-${{ matrix.libsodium-version }}.${{ matrix.bottle-suffix }}.bottle.tar.gz
curl -L -H "Authorization: Bearer QQ==" -o $LIBSODIUM_BOTTLE https://ghcr.io/v2/homebrew/core/libsodium/blobs/sha256:${{ matrix.libsodium-sha256 }}
brew reinstall -f $LIBSODIUM_BOTTLE
ZEROMQ_BOTTLE=zeromq-${{ matrix.zeromq-version }}.${{ matrix.bottle-suffix }}.bottle.tar.gz
curl -L -H "Authorization: Bearer QQ==" -o $ZEROMQ_BOTTLE https://ghcr.io/v2/homebrew/core/zeromq/blobs/sha256:${{ matrix.zeromq-sha256 }}
brew install -f $ZEROMQ_BOTTLE
- name: Build Kind 2 macOS binary
if: runner.os == 'macOS'
uses: ./.github/actions/build-kind2
with:
ocaml-version: ${{ matrix.ocaml-version }}
cache-prefix: macos${{ matrix.macos-target }}
flambda: true
build-target: static
- name: Test Kind 2 binary
run: ./bin/kind2 --version
- name: Create asset
id: create_asset
run: |
cd bin
chmod u+x kind2
if [[ "$GITHUB_REF" =~ ^refs/tags/v.* ]]; then
vtag=$GITHUB_REF_NAME
echo "release=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
else
vtag=$(date "+%Y-%m-%d")
echo "release=nightly" >> $GITHUB_OUTPUT
fi
if [[ "$RUNNER_OS" == "Linux" ]]; then
ptag="${{ matrix.name }}"
else
ptag="macos-${{ matrix.macos-target }}-$(uname -m)"
fi
tarball=kind2-$vtag-$ptag.tar.gz
tar -czf $tarball kind2
echo "filepath=./bin/$tarball" >> $GITHUB_OUTPUT
- name: Upload release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.create_asset.outputs.release }} \
${{ steps.create_asset.outputs.filepath }} \
--repo $GITHUB_REPOSITORY