CMake build, macOS ARM64 #674
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
name: CMake build, macOS ARM64 | |
on: | |
# Trigger the workflow on push or pull request | |
push: | |
#pull_request: # DANGEROUS! MUST be disabled for self-hosted runners! | |
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC. | |
schedule: | |
- cron: '0 18 * * *' | |
# Trigger the workflow manually | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref (Optional) | |
required: false | |
stress-test: | |
description: Stress Test (Optional, true or false) | |
required: false | |
verbose-makefile: | |
description: Verbose Makefile (Optional, true or false) | |
required: false | |
# Show the git ref in the workflow name if it is invoked manually. | |
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Manual run {0} , {1}, {2}', inputs.git-ref, inputs.stress-test, inputs.verbose-makefile) || '' }} | |
permissions: | |
contents: read | |
jobs: | |
cmake: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-14] | |
cc: [gcc, clang] | |
fc: [gfortran-11, gfortran-12, gfortran-13] | |
steps: | |
- name: Clone Repository (Latest) | |
uses: actions/checkout@v4 | |
if: github.event.inputs.git-ref == '' | |
with: | |
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
# As of 231227, checkout with ssh fails frequently on Windows runners. | |
submodules: recursive | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Clone Repository (Custom Ref) | |
uses: actions/checkout@v4 | |
if: github.event.inputs.git-ref != '' | |
with: | |
ref: ${{ github.event.inputs.git-ref }} | |
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
# As of 231227, checkout with ssh fails frequently on Windows runners. | |
submodules: recursive | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Miscellaneous setup | |
run: bash .github/scripts/misc_setup | |
- name: Build and test | |
shell: bash | |
run: | | |
export CC=${{ matrix.cc }} | |
CFLAGS="-Wall -Wextra -Wpedantic -Werror" | |
export FC=${{ matrix.fc }} | |
export FFLAGS='-Wall -Wextra -Wpedantic -Werror -fimplicit-none -fcheck=all -fstack-check -Wno-function-elimination' | |
$FC --version | |
$CC --version | |
cmake --version | |
VERBOSE_MAKEFILE=OFF | |
if [[ "${{ github.event.inputs.verbose-makefile }}" == "true" ]] ; then | |
VERBOSE_MAKEFILE=ON | |
fi | |
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=$VERBOSE_MAKEFILE -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_Fortran_FLAGS="${FFLAGS}" . | |
cmake --build . --target install | |
cmake --build . --target tests | |
ctest --output-on-failure -V -E stress | |
- name: Stress test | |
if: ${{ github.event_name == 'schedule' || github.event.inputs.stress-test == 'true' }} | |
shell: bash | |
run: | | |
ctest --output-on-failure -V -R stress | |
# The following job check whether the tests were successful or cancelled due to timeout. | |
# N.B.: Remember to specify `continue-on-error: true` for the job of the tests. | |
check_success_timeout: | |
runs-on: ubuntu-latest | |
if: ${{ !cancelled() }} | |
needs: cmake | |
steps: | |
- name: Clone the GitHub actions scripts | |
uses: actions/checkout@v4 | |
with: | |
repository: equipez/github_actions_scripts | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS | |
path: scripts | |
- name: Check whether the tests were successful or cancelled due to timeout | |
run: bash scripts/check_success_timeout_big_test ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.run_id }} |