diff --git a/.github/workflows/macos.yml b/.github/workflows/macos-arm.yml similarity index 96% rename from .github/workflows/macos.yml rename to .github/workflows/macos-arm.yml index 4f5989691e..68154561ce 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos-arm.yml @@ -45,7 +45,7 @@ env: jobs: Macos_platform: name: Macos - runs-on: macos-latest + runs-on: self-hosted strategy: fail-fast: false matrix: @@ -75,6 +75,9 @@ jobs: brew cleanup # See https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6351357 brew config + # Trying to avoid Error: No available tap homebrew/core or homebrew/cask. + brew tap --force homebrew/cask + brew tap --force homebrew/core brew untap homebrew/core homebrew/cask brew config brew update @@ -125,10 +128,11 @@ jobs: pip3 install macpack - name: 'Build DMG installer' - uses: Wandalen/wretry.action@v1.3.0 + uses: Wandalen/wretry.action@master with: attempt_limit: 5 attempt_delay: 5000 + shell: bash command: | eval $(opam env) macos/create_installer_macos.sh @@ -150,7 +154,7 @@ jobs: Macos_smoke: name: Smoke test Macos needs: Macos_platform - runs-on: macos-latest + runs-on: self-hosted strategy: fail-fast: false matrix: diff --git a/.github/workflows/macos-intel.yml b/.github/workflows/macos-intel.yml new file mode 100644 index 0000000000..106d7ddf65 --- /dev/null +++ b/.github/workflows/macos-intel.yml @@ -0,0 +1,190 @@ +# 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.18~2023.11' + - '8.18~mc2~2023.11' + - '8.17~2023.08' + + steps: + - name: Git checkout + uses: actions/checkout@v2 + + - 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 + # Trying to avoid Error: No available tap homebrew/core or homebrew/cask. + brew tap --force homebrew/cask + brew tap --force homebrew/core + 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 + + - 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: Install bash (needed by smoke scripts) + run: brew install bash + + - name: Create smoke test kit + shell: bash + run: | + eval $(opam env) + export MACOSX_DEPLOYMENT_TARGET=10.13 + shell_scripts/create_smoke_test_kit.sh + + - name: 'Upload smoke test kit' + uses: actions/upload-artifact@v2 + 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@master + with: + attempt_limit: 5 + attempt_delay: 5000 + shell: bash + command: | + eval $(opam env) + macos/create_installer_macos.sh + + - name: 'Upload DMG script logs on failure' + uses: actions/upload-artifact@v2 + if: failure() + with: + name: 'DMG script error logs ${{matrix.variant}}' + path: macos_installer/logs/ + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + 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.18~2023.11' + - '8.18~mc2~2023.11' + - '8.17~2023.08' + + steps: + - name: Install bash + run: brew install bash + + - name: 'Download Artifact' + uses: actions/download-artifact@v2 + id: download + with: + name: 'Macos installer ${{matrix.variant}} x86_64' + + - name: 'Download smoke test kit' + uses: actions/download-artifact@v2 + 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: | + export PATH="$PATH:$(cd /Applications/Coq-Platform*.app/Contents/Resources/bin/; pwd)" + cd ${{steps.download-smoke.outputs.download-path}} + chmod a+x ./run-smoke-test.sh + ./run-smoke-test.sh diff --git a/macos/create_installer_macos.sh b/macos/create_installer_macos.sh index 656befe5e4..6eabfb0bdc 100755 --- a/macos/create_installer_macos.sh +++ b/macos/create_installer_macos.sh @@ -115,12 +115,13 @@ echo "##### Coq version = ${COQ_VERSION} (Mac app version=${COQ_VERSION_MACOS}) set +e PORTCMD="$(which port)" +BREWCMD="$(which brew)" set -e if [ -z "${PORTCMD}" ]; then PKG_MANAGER=brew - PKG_MANAGER_ROOT="/usr/local/" - PKG_MANAGER_ROOT_STRIP="/usr/local/Cellar/*/*/" # one * for the package name and one for its version + PKG_MANAGER_ROOT="${BREWCMD%bin/brew}" + PKG_MANAGER_ROOT_STRIP="${PKG_MANAGER_ROOT}Cellar/*/*/" # one * for the package name and one for its version else PKG_MANAGER=port # If someone knows a better way to find out where port is installed, please let me know!