Runtime osx-arm64 #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: ${{ inputs.ignore_cache || !steps.cache-check.outputs.cache-hit }} | |
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: ${{ inputs.ignore_cache || !steps.cache-check.outputs.cache-hit }} | |
run: cmake --build build | |
- name: Test | |
if: ${{ inputs.ignore_cache || !steps.cache-check.outputs.cache-hit }} | |
working-directory: build | |
run: ctest | |
- name: Copy artifact | |
if: ${{ inputs.ignore_cache || !steps.cache-check.outputs.cache-hit }} | |
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: ${{ inputs.ignore_cache && steps.cache-check.outputs.cache-hit }} | |
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: ${{ inputs.ignore_cache || !steps.cache-check.outputs.cache-hit }} | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
Xmss/runtimes/** | |
key: ${{ steps.cache-key.outputs.value }} | |
enableCrossOsArchive: true |