Skip to content

Kind 2 Nightlies / Release #349

Kind 2 Nightlies / Release

Kind 2 Nightlies / Release #349

Workflow file for this run

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