Skip to content

Runtime osx-arm64

Runtime osx-arm64 #2

# SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
#
# SPDX-License-Identifier: MIT
# This file requires LF line endings, as it is used in GitHub action hashes.
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# This file requires LF line endings, as it is used in cross-platform GitHub action hashes.
name: Runtime osx-arm64
on:
workflow_dispatch:
inputs:
ignore_cache:
description: 'Force building of the runtime, even if a cached result already exists.'
type: boolean
required: true
default: true
workflow_call:
inputs:
ignore_cache:
description: 'Force building of the runtime, even if a cached result already exists.'
type: boolean
required: false
default: false
env:
RUNTIME: osx-arm64
permissions:
contents: read
actions: write
jobs:
build-osx-arm64:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Calculate cache key
id: cache-key
run: |
echo "value=runtime-${{ env.RUNTIME }}-${{ hashFiles('.gitmodules', 'libc/libc.c', '.github/workflows/runtime-osx-arm64.yml') }}" \
>> "$GITHUB_OUTPUT"
- name: Check existing cache
id: cache-check
uses: actions/cache/restore@v4
with:
path: |
Xmss/runtimes/**
key: ${{ steps.cache-key.outputs.value }}
enableCrossOsArchive: true
lookup-only: true
- name: Configure
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
run: >
cmake
-S xmss-library
-B build
-DBUILD_SHARED_LIBS=ON
-DXMSS_C99_COMPATIBLE=OFF
-DCMAKE_C_COMPILER=clang
-DCMAKE_C_FLAGS="-Wno-error=implicit-int-conversion"
- name: Build
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
run: cmake --build build
- name: Test
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
working-directory: build
run: ctest
- name: Copy artifact
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
run: |
mkdir -p "Xmss/runtimes/${{ env.RUNTIME }}/native"
cp build/src/libxmss.dylib "Xmss/runtimes/${{ env.RUNTIME }}/native/xmss.dylib"
- name: Delete existing cache
if: ${{ steps.cache-check.outputs.cache-hit && inputs.ignore_cache }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ steps.cache-key.outputs.value }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save cache
if: ${{ !steps.cache-check.outputs.cache-hit || !inputs.ignore_cache }}
uses: actions/cache/save@v4
with:
path: |
Xmss/runtimes/**
key: ${{ steps.cache-key.outputs.value }}
enableCrossOsArchive: true