-
Notifications
You must be signed in to change notification settings - Fork 44
190 lines (177 loc) · 5.76 KB
/
build.yml
File metadata and controls
190 lines (177 loc) · 5.76 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Build artifacts
on:
push:
branches:
- main
pull_request:
workflow_call:
inputs:
version:
required: true
type: string
sha:
required: false
default: ${{ github.sha }}
type: string
jobs:
set-env:
runs-on: ubuntu-latest
outputs:
version: ${{ env.HQ_VERSION }}
sha: ${{ env.HQ_SHA }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set version
run: |
echo "HQ_VERSION=${{ inputs.version || 'dev' }}" | tee -a $GITHUB_ENV
- name: Set sha
run: |
echo "HQ_SHA=${{ inputs.sha || github.sha }}" | tee -a $GITHUB_ENV
build-binaries-x64:
needs: [ set-env ]
runs-on: ubuntu-latest
# Use a container with GLIBC 2.28
container: quay.io/pypa/manylinux_2_28_x86_64
steps:
- name: Show GLIBC
run: ldd --version
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.93.1
override: true
- uses: Swatinem/rust-cache@v2
with:
key: x64
# Needed for the highs dependency
- name: Install Clang
run: yum install clang -y
- name: Compile
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
run: cargo build --profile dist
- name: Compress debuginfo
run: objcopy --compress-debug-sections=zlib-gnu target/dist/hq
- name: Prepare archive
id: archive
run: |
export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-x64.tar.gz
tar -czvf $ARCHIVE_NAME -C target/dist hq
echo "::set-output name=archive-name::$ARCHIVE_NAME"
- name: Store archive
uses: actions/upload-artifact@v4
with:
name: archive-x64
path: ${{ steps.archive.outputs.archive-name }}
build-binaries-ext:
needs: [ set-env ]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: powerpc64le-unknown-linux-gnu
name: powerpc64
- arch: armv7-unknown-linux-gnueabihf
name: raspberry-pi
- arch: aarch64-unknown-linux-gnu
name: arm64-linux
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.93.1
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.arch }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross --locked --rev d8e00ce3940124e67591346cbe234c415fcfc6eb
- name: Compile
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
run: cross build --target ${{ matrix.arch }} --no-default-features --features dashboard,highs --profile dist
- name: Prepare archive
id: archive
run: |
export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-${{ matrix.name }}.tar.gz
tar -czvf $ARCHIVE_NAME -C target/${{ matrix.arch }}/dist hq
echo "::set-output name=archive-name::$ARCHIVE_NAME"
- name: Store archive
uses: actions/upload-artifact@v4
with:
name: archive-${{ matrix.name }}
path: ${{ steps.archive.outputs.archive-name }}
build-python-binding:
needs: [ set-env ]
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.93.1
override: true
- uses: Swatinem/rust-cache@v2
with:
key: pyhq
# Needed for the highs dependency
- name: Install Clang and Python development headers
run: yum install clang python3.12-devel -y
- name: Install pip
run: python3 -m ensurepip
- uses: messense/maturin-action@v1
env:
CARGO_PROFILE_DIST_PANIC: unwind
CARGO_PROFILE_DIST_STRIP: none
CARGO_TARGET_DIR: target
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
maturin-version: 1.3.0
container: off
manylinux: 2_28
command: build
args: --manifest-path crates/pyhq/Cargo.toml --profile dist --out wheels
- name: Install Python wheel
run: |
python3 -m venv venv
source venv/bin/activate
python3 --version
python3 -m pip install -U setuptools wheel pip
python3 -m pip install -r tests/requirements.txt
WHEEL=`realpath wheels/*.whl`
python3 -m pip install $WHEEL[all]
- name: Test Python wheel version
run: |
source venv/bin/activate
python3 -c "import hyperqueue; print(hyperqueue.get_version())" > version.txt
cat version.txt
echo "${{ needs.set-env.outputs.version }}" > version-expected.txt
cat version-expected.txt
cmp --silent version-expected.txt version.txt
- name: Compile
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
run: cargo build
- name: Test Python wheel
run: |
source venv/bin/activate
python3 -m pytest tests/pyapi
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: archive-pyhq
path: wheels/hyperqueue-*.whl