-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (102 loc) · 3 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# 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:
strategy:
fail-fast: false
matrix:
platform: [windows-latest, 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 conan 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: Configure Conan
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan profile detect --force
- name: Clean Conan cache (pre-build)
if: steps.cache-conan.outputs.cache-hit != 'true'
run: |
conan cache clean "*" --build
conan cache clean "*" --download
conan cache clean "*" --source
conan remove --confirm "*"
- name: Install build dependencies
run: |
conan install . \
-s build_type=Release \
-s compiler.cppstd=17 \
--output-folder conan_build \
-o '*/*:shared=True' \
--build=missing
- 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: Build and install
env:
CMAKE_ARGS: "-DCMAKE_PREFIX_PATH=${{ github.workspace}}/conan_build"
run: pip install --verbose .
- name: Test
run: python -c 'import hictkpy; print(hictkpy.__version__)'