Macos #1942
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
# Main doc: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions | |
# Runners spec: https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners | |
# Glob expressions: https://github.com/actions/toolkit/tree/main/packages/glob | |
name: Macos | |
############################################################################### | |
# Schedule: | |
# - push on any branch whose name matches v** or master | |
# - any pull request | |
############################################################################### | |
on: | |
push: | |
branches: | |
- 2021.02 | |
- 2021.09 | |
- main | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: 'Arguments for the platform script:' | |
required: true | |
default: '-extent=x -parallel=p -jobs=2 -large=e -compcert=y -set-switch=y' | |
############################################################################### | |
# Platform script options shared among all jobs | |
############################################################################### | |
env: | |
PLATFORM_ARGS: -extent=x -parallel=p -jobs=2 -large=e -compcert=y -set-switch=y | |
COQREGTESTING: y | |
HOMEBREW_NO_INSTALL_FROM_API: | |
# See https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6351357 | |
############################################################################### | |
# Macos | |
# | |
# CAVEATS: | |
# - COQREGTESTING broken, it makes the script loop, so we install opam by hand | |
############################################################################### | |
jobs: | |
Macos_platform: | |
name: Macos | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
variant: | |
# Keep this in sync with the Smoke test below | |
- '8.19~2024.10' | |
- '8.18~2023.11' | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Set PLATFORM | |
if: ${{ github.event.inputs.platform != '' }} | |
run: echo "PLATFORM=${{ github.event.inputs.platform }}" >> $GITHUB_ENV | |
- name: Cleanup, update and upgrade HomeBrew | |
# This is to avoid errors of these kinds: | |
# - ==> Downloading https://ghcr.io/v2/homebrew/core/harfbuzz/manifests/5.1.0 | |
# Error: adwaita-icon-theme: Failed to download resource "harfbuzz_bottle_manifest" | |
# The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON): | |
# - dyld[45184]: Library not loaded: '/usr/local/opt/libunistring/lib/libunistring.2.dylib' | |
# Referenced from: '/usr/local/Cellar/wget/1.21.3/bin/wget' | |
# Reason: tried: '/usr/local/opt/libunistring/lib/libunistring.2.dylib' (no such file), | |
run: | | |
brew cleanup | |
# See https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6351357 | |
brew config | |
brew untap homebrew/core homebrew/cask | |
brew config | |
brew update | |
# Note: brew upgrade does fail regularly, but brew is anyway in a better state afterwards | |
brew upgrade || true | |
# make sure we are using homebrew python, since we install some python packages via homebrew | |
brew install python3 | |
brew link --overwrite python3 | |
ls -l $(which python3) | |
ls -l $(which pip3) | |
# create a virtual environment so that we can use pip3 | |
# (since python 3.12 using pip3 on package manager installed python requires a virtual environment) | |
python3 -m venv .venv | |
. .venv/bin/activate | |
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | |
echo PATH=$PATH >> $GITHUB_ENV | |
ls -l $(which python3) | |
ls -l $(which pip3) | |
- name: Install homebrew packages required by main script | |
run: brew install wget | |
- name: Run common platform script | |
shell: bash | |
run: ./coq_platform_make.sh -packages=${{matrix.variant}} $PLATFORM_ARGS -dumplogs | |
- name: 'Upload opam log folder on failure' | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: 'Opam log folder ${{matrix.variant}}' | |
path: /Users/runner/.opam/log/ | |
- name: 'Upload opam build folder on failure' | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: 'Opam build folder ${{matrix.variant}}' | |
path: /Users/runner/.opam/CP*${{matrix.variant}}/.opam-switch/build | |
- name: Install bash (needed by smoke scripts) | |
run: brew install bash | |
- name: Create smoke test kit | |
shell: bash | |
run: | | |
eval $(opam env) | |
shell_scripts/create_smoke_test_kit.sh | |
- name: 'Upload smoke test kit' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Smoke Test Kit Macos ${{matrix.variant}}' | |
path: smoke-test-kit/ | |
retention-days: 5 | |
- name: Install findutils, coreutils and macpack (needed by DMG script) | |
run: | | |
brew install findutils | |
brew install coreutils | |
pip3 install macpack | |
- name: 'Build DMG installer' | |
uses: Wandalen/wretry.action@v3 | |
with: | |
attempt_limit: 5 | |
attempt_delay: 5000 | |
command: | | |
eval $(opam env) | |
macos/create_installer_macos.sh | |
- name: 'Upload DMG script logs on failure' | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: 'DMG script error logs ${{matrix.variant}}' | |
path: macos_installer/logs/ | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'Macos installer ${{matrix.variant}} x86_64' | |
path: macos_installer/Coq-Platform-*.dmg | |
retention-days: 5 | |
Macos_smoke: | |
name: Smoke test Macos | |
needs: Macos_platform | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
variant: | |
- '8.19~2024.10' | |
- '8.18~2023.11' | |
steps: | |
- name: Install bash | |
run: brew install bash | |
- name: 'Download Artifact' | |
uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: 'Macos installer ${{matrix.variant}} x86_64' | |
- name: 'Download smoke test kit' | |
uses: actions/download-artifact@v4 | |
id: download-smoke | |
with: | |
name: 'Smoke Test Kit Macos ${{matrix.variant}}' | |
- name: 'Run Installer' | |
shell: bash | |
run: | | |
cd ${{steps.download.outputs.download-path}} | |
DMG=$(ls Coq-Platform-*.dmg) | |
hdiutil attach $DMG | |
cp -r /Volumes/${DMG%%.dmg}/Coq-Platform*.app /Applications/ | |
hdiutil detach /Volumes/${DMG%%.dmg}/ | |
- name: 'Smoke coqc' | |
shell: bash | |
run: | | |
cd /Applications/Coq-Platform*.app/Contents/Resources/bin/ | |
./coqc -v | |
- name: 'Run Macos smoke test kit' | |
shell: bash | |
run: | | |
ls /Applications/Coq-Platform*.app | |
export PATH="$PATH:$(cd /Applications/Coq-Platform*.app/Contents/Resources/bin/; pwd)" | |
export COQLIB=$(coqc -where) | |
cd ${{steps.download-smoke.outputs.download-path}} | |
chmod a+x ./run-smoke-test.sh | |
./run-smoke-test.sh |