Improve tests #471
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/pip.yml" | |
- "cmake/**" | |
- "src/**" | |
- "test/**" | |
- "utils/devel/stubgen.py" | |
- "CMakeLists.txt" | |
- "conanfile.py" | |
- "pyproject.toml" | |
pull_request: | |
paths: | |
- ".github/workflows/pip.yml" | |
- "cmake/**" | |
- "src/**" | |
- "test/**" | |
- "utils/devel/stubgen.py" | |
- "CMakeLists.txt" | |
- "conanfile.py" | |
- "pyproject.toml" | |
env: | |
CONAN_HOME: "${{ github.workspace }}/.conan2/" | |
HICTK_CI: "1" | |
# 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: | |
os: [windows-2019, macos-latest, ubuntu-latest] | |
python-version: ["3.9", "3.13"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
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.py') }}" | |
echo "conan-key=pip-${{ matrix.os }}-$hash" >> $GITHUB_OUTPUT | |
- name: Restore Conan cache | |
id: cache-conan | |
uses: actions/cache/restore@v4 | |
with: | |
key: conan-${{ steps.cache-key.outputs.conan-key }} | |
path: ${{ env.CONAN_HOME }}/p | |
- name: Override default compilers (macOS) | |
if: matrix.os == 'macos-latest' | |
run: | | |
echo 'CC=clang' >> $GITHUB_ENV | |
echo 'CXX=clang++' >> $GITHUB_ENV | |
- name: Build and install | |
run: pip install --verbose '.[all,test]' | |
- name: Save Conan cache | |
uses: actions/cache/save@v4 | |
if: steps.cache-conan.outputs.cache-hit != 'true' | |
with: | |
key: conan-${{ steps.cache-key.outputs.conan-key }} | |
path: ${{ env.CONAN_HOME }}/p | |
- name: Test | |
run: python -m pytest test -v | |
pip-status-check: | |
name: Status Check (CI) | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: | |
- build-project | |
steps: | |
- name: Collect job results | |
if: needs.build-project.result != 'success' | |
run: exit 1 |