-
Notifications
You must be signed in to change notification settings - Fork 68
161 lines (160 loc) · 6.25 KB
/
Copy pathbuild_libs.yml
File metadata and controls
161 lines (160 loc) · 6.25 KB
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
name: build libraries
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: {}
jobs:
changes:
runs-on: ubuntu-26.04
outputs:
tklog: ${{ steps.filter.outputs.tklog }}
tkassert: ${{ steps.filter.outputs.tkassert }}
tkrng: ${{ steps.filter.outputs.tkrng }}
tktokenswap: ${{ steps.filter.outputs.tktokenswap }}
tkwsm: ${{ steps.filter.outputs.tkwsm }}
libs: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4.0.3
id: filter
with:
base: ${{ github.ref }}
filters: |
tklog:
- 'libs/tklog/conanfile.py'
- '.github/workflows/build_libs.yml'
tkassert:
- 'libs/tkassert/conanfile.py'
- '.github/workflows/build_libs.yml'
tkrng:
- 'libs/tkrng/conanfile.py'
- '.github/workflows/build_libs.yml'
tktokenswap:
- 'libs/tktokenswap/conanfile.py'
- '.github/workflows/build_libs.yml'
tkwsm:
- 'libs/tkwsm/conanfile.py'
- '.github/workflows/build_libs.yml'
build_libraries:
name: build library
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
strategy:
matrix:
os: ['ubuntu-26.04', 'macos-15', 'macos-15-intel', 'macos-26', 'windows-2025-vs2026']
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: normalize line endings in conanfile and src directory
if: matrix.os == 'windows-2025-vs2026'
# This is necessary to ensure consistent revisions across platforms.
# Conan's revision hash is composed of hashes all the exported files, so
# we must normalize the line endings in these.
run: |
$lib_files = Get-ChildItem "libs/${{ matrix.lib }}" -File -Recurse
foreach ($f in $lib_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: Select Python 3.12
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/get-conan@v1.2
- name: Set up conan
shell: bash
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/${{ matrix.os }}
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: build ${{ matrix.lib }}
run: conan create -s build_type=${{ matrix.build_type }} -o boost/*:header_only=True libs/${{ matrix.lib }} --build=missing --user=tket --channel=stable --format json > ${{ matrix.lib }}.json
- name: build shared ${{ matrix.lib }}
if: matrix.lib == 'tklog'
run: conan create -s build_type=${{ matrix.build_type }} -o boost/*:header_only=True -o ${{ matrix.lib }}/*:shared=True libs/${{ matrix.lib }} --build=missing --user=tket --channel=stable
- name: get version
shell: bash
run: |
lib_label=`./libver ${{ matrix.lib }}.json ${{ matrix.lib }}`
echo "LIB_LABEL=${lib_label}" >> $GITHUB_ENV
- name: upload package
if: github.event_name == 'push'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload ${{ env.LIB_LABEL }} -r=tket-libs
manylinux_x86:
name: build library (manylinux x86)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ubuntu-latest
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
env:
UPLOAD_PACKAGE: "NO"
steps:
- uses: actions/checkout@v7
- name: set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_x86_64:latest /bin/bash
docker cp ./libs/${{ matrix.lib }} linux_build:/
docker cp ./libver linux_build:/
docker cp ./.github/workflows/linuxbuildlib linux_build:/
docker cp ./conan-profiles linux_build:/
- name: determine whether to upload package
if: github.event_name == 'push'
run: echo "UPLOAD_PACKAGE=YES" >> ${GITHUB_ENV}
- name: build ${{ matrix.lib }}
run: |
docker start linux_build
cat <<EOF > env-vars
TKLIB=${{ matrix.lib }}
UPLOAD_PACKAGE=${UPLOAD_PACKAGE}
JFROG_ARTIFACTORY_TOKEN_3=${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}
JFROG_ARTIFACTORY_USER_3=${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
CONAN_PROFILE=linux-x86_64-gcc14
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"
manylinux_arm64:
name: build library (manylinux arm64)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ubuntu-26.04-arm
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
env:
UPLOAD_PACKAGE: "NO"
steps:
- uses: actions/checkout@v7
- name: set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_aarch64:latest /bin/bash
docker cp ./libs/${{ matrix.lib }} linux_build:/
docker cp ./libver linux_build:/
docker cp ./.github/workflows/linuxbuildlib linux_build:/
docker cp ./conan-profiles linux_build:/
- name: determine whether to upload package
if: github.event_name == 'push'
run: echo "UPLOAD_PACKAGE=YES" >> ${GITHUB_ENV}
- name: build ${{ matrix.lib }}
run: |
docker start linux_build
cat <<EOF > env-vars
TKLIB=${{ matrix.lib }}
UPLOAD_PACKAGE=${UPLOAD_PACKAGE}
JFROG_ARTIFACTORY_TOKEN_3=${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}
JFROG_ARTIFACTORY_USER_3=${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
CONAN_PROFILE=linux-armv8-gcc14
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"