Fix macOS builds #72
Workflow file for this run
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
# Copyright (C) 2023 Roberto Rossini ([email protected]) | |
# SPDX-License-Identifier: MIT | |
name: Pip | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths: | |
- ".github/workflows/pip.yml" | |
- "cmake/**" | |
- "src/**" | |
- "test/**" | |
- "CMakeLists.txt" | |
- "conanfile.txt" | |
- "pyproject.toml" | |
- "setup.cfg" | |
- "setup.py" | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
paths: | |
- ".github/workflows/pip.yml" | |
- "cmake/**" | |
- "src/**" | |
- "test/**" | |
- "CMakeLists.txt" | |
- "conanfile.txt" | |
- "pyproject.toml" | |
- "setup.cfg" | |
- "setup.py" | |
env: | |
CONAN_HOME: "${{ github.workspace }}/conan/" | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-project: | |
strategy: | |
fail-fast: false | |
matrix: | |
# platform: [windows-latest, macos-latest, ubuntu-latest] | |
platform: [macos-latest, ubuntu-latest] | |
python-version: ["3.7", "3.11"] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Add requirements | |
run: python -m pip install --upgrade wheel setuptools | |
- name: Generate cache key | |
id: cache-key | |
run: | | |
hash="${{ hashFiles('conanfile.txt', '.github/workflows/pip.yml') }}" | |
echo "conan-key=pip-$hash" >> $GITHUB_OUTPUT | |
- name: Restore Conan cache | |
id: cache-conan | |
uses: actions/cache/restore@v3 | |
with: | |
key: conan-${{ steps.cache-key.outputs.conan-key }} | |
path: ${{ env.CONAN_HOME }} | |
- name: Build and install | |
run: pip install --verbose .[test] | |
- name: Clean Conan cache (post-build) | |
if: steps.cache-conan.outputs.cache-hit != 'true' | |
run: | | |
conan cache clean "*" --build | |
conan cache clean "*" --download | |
conan cache clean "*" --source | |
- name: Save Conan cache | |
uses: actions/cache/save@v3 | |
if: steps.cache-conan.outputs.cache-hit != 'true' | |
with: | |
key: conan-${{ steps.cache-key.outputs.conan-key }} | |
path: ${{ env.CONAN_HOME }} | |
- name: Test | |
run: python -m pytest test | |
pip-status-check: | |
name: Status Check (pip) | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: | |
- build-project | |
steps: | |
- name: Collect job results | |
if: needs.build-project.result != 'success' | |
run: exit 1 |