Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Macos CI #328

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/macos.yml → .github/workflows/macos-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ env:
jobs:
Macos_platform:
name: Macos
runs-on: macos-latest
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rtetley : since my shell based fix didn't work (hdiutil somehow crashes so badly that it kills the containing shell) I tried your fix. One issue: the shell: bash line seems to be not supported, but I used Wandalen/wretry.action@v1 rather than @master.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this PR it seemed to work fine ? Does it only fail when it requires a retry ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't fail, it just gives a warning.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, likely my bad. I thought that using abbreviated version numbers (like @v1) is a github feature, but apparently it is a feature of many github actions implemented by duplicating tags - the wretry doesn't have this. So I got some random version. I will try again wit a proper version tag.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it again with:

      - name: 'Build DMG installer'
        uses: Wandalen/[email protected]
        with:
          attempt_limit: 5
          attempt_delay: 5000
          shell: bash
          command: |
            eval $(opam env)
            macos/create_installer_macos.sh

This still gives a warning:

Unexpected input(s) 'shell', valid inputs are ['action', 'command', 'with', 'current_path', 'attempt_limit', 'attempt_delay']

As far as I can tell the tag v1.3.0 is identical to master (I don't like to have master versions of actions in CI).

Do you have a reference which suggests that the shell key is allowed? It would be useful to make this explicit, but it also works without it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no, unfortunately no :-/ I hadn't noticed the warning before... I also have it on this PR...

command: |
eval $(opam env)
macos/create_installer_macos.sh
Expand All @@ -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:
Expand Down
190 changes: 190 additions & 0 deletions .github/workflows/macos-intel.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions macos/create_installer_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
Loading