-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (144 loc) · 4.86 KB
/
packaging.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Copyright (C) 2024 Roberto Rossini <roberros@uio.no>
# SPDX-License-Identifier: MIT
name: Test packaging
on:
push:
branches: [main]
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/packaging.yml"
- "cmake/**"
- "src/**"
- "test/packaging/**"
- "CMakeLists.txt"
- "conanfile.py"
pull_request:
paths:
- ".github/workflows/build-conan-deps.yml"
- ".github/workflows/packaging.yml"
- "cmake/**"
- "src/**"
- "test/packaging/**"
- "CMakeLists.txt"
- "conanfile.py"
# 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-conan-deps:
name: Build Conan deps
uses: paulsengroup/hictk/.github/workflows/build-conan-deps.yml@main
with:
os: ubuntu-20.04
test-find-package:
runs-on: ubuntu-latest
name: Test find_package()
needs: build-conan-deps
container:
image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-18
options: "--user=root"
env:
CONAN_HOME: "/opt/conan/"
steps:
- uses: actions/checkout@v4
- name: Fix permissions
run: |
chown -R $(id -u):$(id -g) $PWD
- name: Restore Conan cache
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore CMake configs
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps.outputs.cmake-prefix-release-key }}
path: /tmp/cmake-prefix-rel.tar
fail-on-cache-miss: true
- name: Extract CMake configs
run: |
mkdir conan-env
tar -xf /tmp/cmake-prefix-rel.tar -C conan-env/ --strip-components=1
- name: Configure project
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-DHICTK_ENABLE_TESTING=OFF \
-DHICTK_BUILD_TOOLS=OFF \
-DCMAKE_PREFIX_PATH="$PWD/conan-env" \
-DCMAKE_INSTALL_PREFIX=hictk_install \
-S . \
-B hictk_build
- name: Install hictk
run: |
cmake --build hictk_build/
cmake --install hictk_build/
- name: Configure test project
run: |
CMAKE_PREFIX_PATH="$PWD/conan-env;$PWD/hictk_install/lib/cmake/hictk/"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-S test/packaging/test_find_package \
-B test_find_package_build
- name: Build test project
run: cmake --build test_find_package_build
- name: Test binary
run: test_find_package_build/hictk_test_find_package
test-add-subdirectory:
runs-on: ubuntu-latest
name: Test add_subdirectory()
needs: build-conan-deps
container:
image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-18
options: "--user=root"
env:
CONAN_HOME: "/opt/conan/"
steps:
- uses: actions/checkout@v4
- name: Fix permissions
run: |
chown -R $(id -u):$(id -g) $PWD
- name: Restore Conan cache
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps.outputs.conan-key }}
path: ${{ env.CONAN_HOME }}/p
fail-on-cache-miss: true
- name: Restore CMake configs
uses: actions/cache/restore@v4
with:
key: ${{ needs.build-conan-deps.outputs.cmake-prefix-release-key }}
path: /tmp/cmake-prefix-rel.tar
fail-on-cache-miss: true
- name: Extract CMake configs
run: |
mkdir conan-env
tar -xf /tmp/cmake-prefix-rel.tar -C conan-env/ --strip-components=1
- name: Configure project
run: |
ln -s "$PWD" test/packaging/test_add_subdirectory/hictk_root
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$PWD/conan-env" \
-S test/packaging/test_add_subdirectory \
-B test_add_subdirectory_build
- name: Build test project
run: cmake --build test_add_subdirectory_build
- name: Test binary
run: test_add_subdirectory_build/hictk_test_add_subdirectory
packaging-status-check:
name: Status Check (packaging)
if: ${{ always() }}
runs-on: ubuntu-latest
needs:
- test-find-package
- test-add-subdirectory
steps:
- name: Collect job results
if: |
needs.test-find-package.result != 'success' ||
needs.test-add-subdirectory.result != 'success'
run: exit 1