-
Notifications
You must be signed in to change notification settings - Fork 23
188 lines (177 loc) · 5.69 KB
/
build.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
177
178
179
180
181
182
183
184
185
186
187
188
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@v3
- 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.17
container: quay.io/pypa/manylinux2014_x86_64
steps:
- name: Show GLIBC
run: ldd --version
# We need to avoid using NodeJS v20, because it doesn't work with glibc 2.17.
# See https://github.com/actions/checkout/issues/1809.
- name: Fix NodeJS version
run: |
yum install wget -y
touch "$HOME/.bashrc"
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 16.16.0
- 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.81.0
override: true
- uses: Swatinem/[email protected]
with:
key: x64
- name: Compile
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: build
args: --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@v3
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@v3
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.81.0
override: true
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.arch }}
- name: Compile
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: build
args: --target ${{ matrix.arch }} --no-default-features --profile dist
use-cross: true
- 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@v3
with:
name: archive-${{ matrix.name }}
path: ${{ steps.archive.outputs.archive-name }}
build-python-binding:
needs: [ set-env ]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: Swatinem/[email protected]
with:
key: pyhq
- uses: messense/maturin-action@v1
env:
CARGO_PROFILE_DIST_PANIC: unwind
CARGO_PROFILE_DIST_STRIP: none
CARGO_TARGET_DIR: target
with:
docker-options: -e HQ_BUILD_VERSION=${{ needs.set-env.outputs.version }}
maturin-version: 1.3.0
manylinux: 2014
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 -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
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: build
- name: Test Python wheel
run: |
source venv/bin/activate
python3 -m pytest tests/pyapi
- name: Upload test artifacts
uses: actions/upload-artifact@v3
with:
name: archive-pyhq
path: wheels/hyperqueue-*.whl