Skip to content

Force earlier macOS runner with later Python version #997

Force earlier macOS runner with later Python version

Force earlier macOS runner with later Python version #997

# Useful documentation for GitHub Actions workflows:
# https://docs.github.com/en/actions/using-workflows/about-workflows
name: push-github-action
# Useful documentation for `on`:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
on:
# Run CI whenever a push is made to any branch
push: null
# Run CI on the tip of any open pull request
pull_request: null
# Allow CI to be run manually in GitHub Actions UI
workflow_dispatch: null
jobs:
build-macos:
strategy:
matrix:
os:
# NOTE: Earliest macOS supported by Crystal is macOS 10.14
#- macos-10.14 # no longer supported by GitHub Actions
#- macos-10.15 # no longer supported by GitHub Actions
#- macos-11 # no longer supported by GitHub Actions after 6/28/2024
#- macos-12 # same as macos-latest as of 2023-03-22
- macos-13
#- macos-14 # ARM-based; forces earlier versions of Python to be used
python-version: ["3.8.18", "3.9"]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 23 # 150% of normal time: 15 min, as of 2024-02-16
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
# NOTE: Poetry 1.5.0 cannot use "poetry run" to run make-mac.sh
run: pipx install "poetry>=1.4.0,<1.5.0"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Upgrade pip and related tools
run: python3 -m pip install --upgrade pip setuptools wheel
- name: Install dependencies with Poetry
# If build takes a very long time, then it's likely that the version
# of wxPython installed does not offer a precompiled wheel for this
# version of Python. Check the wxPython PyPI page to confirm.
timeout-minutes: 2 # normally takes 6s, as of 2023-03-03
run: poetry install
- name: Display SQLite version and JSON support
run: |
python3 -c "import sqlite3; print('SQLite %s' % sqlite3.sqlite_version)"
poetry run python -c "from crystal.util.xsqlite3 import sqlite_has_json_support; print('JSON Support: ' + ('yes' if sqlite_has_json_support else 'NO'))"
- name: Run non-UI tests
run: poetry run python -m pytest
- name: Build .app and disk image
working-directory: "./setup"
# --app-only: Don't build disk image because it intermittently fails
# with "hdiutil create failed - Resource busy" in CI
run: "CRYSTAL_SUPPORT_SCREENSHOTS=True poetry run ./make-mac.sh --app-only"
- name: Run UI tests
# NOTE: Use `TERM=__interactive__` to force Crystal to print stdout and stderr
# rather than sending them to log files
run: |
CRYSTAL_SCREENSHOTS_DIRPATH=$GITHUB_WORKSPACE/screenshots TERM=__interactive__ CRYSTAL_FAULTHANDLER=True "setup/dist/Crystal Web Archiver.app/Contents/MacOS/Crystal Web Archiver" --test
- name: Upload screenshot if test failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.os }}-${{ matrix.python-version }}
path: ${{ github.workspace }}/screenshots/**/*
if-no-files-found: ignore
# NOTE: Must remove the --app-only option from make-mac.sh above to
# reinstate build of *.dmg disk image
#- name: Upload distribution artifact
# # Only export distribution artifact for earliest supported Python and OS
# if: (matrix.python-version == '3.8') && (matrix.os == 'macos-10.14')
# uses: actions/upload-artifact@v3
# with:
# name: dist-mac
# path: setup/dist-mac/*.dmg
# if-no-files-found: warn