-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 2.5 KB
/
pip.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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