Skip to content

Commit 5351714

Browse files
committed
ci: split pyoxy executable build into own workflow
We incur some redundancy to build the pyoxidizer executable. I don't care. That's what sccache is for. As part of this we upgraded the Linux build environment slightly.
1 parent d9e53ba commit 5351714

File tree

4 files changed

+143
-139
lines changed

4 files changed

+143
-139
lines changed

.github/workflows/pyoxy.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
on:
2+
push:
3+
pull_request:
4+
schedule:
5+
- cron: '13 15 * * *'
6+
jobs:
7+
build-linux:
8+
runs-on: 'ubuntu-20.04'
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- uses: ./.github/actions/rust-bootstrap
13+
with:
14+
rust_toolchain: stable
15+
16+
- name: Restore Docker Image Cache
17+
id: cache-image
18+
uses: actions/cache@v2
19+
with:
20+
path: ~/image.tar
21+
key: ${{ runner.os }}-${{ hashFiles('ci/linux-portable-binary.Dockerfile') }}
22+
23+
- name: Build Docker Image
24+
if: steps.cache-image.outputs.cache-hit != 'true'
25+
run: |
26+
cd ci
27+
docker build -f linux-portable-binary.Dockerfile -t pyoxidizer:build .
28+
docker save -o ~/image.tar pyoxidizer:build
29+
30+
- name: Load Docker Image
31+
if: steps.cache-image.outputs.cache-hit == 'true'
32+
run: |
33+
docker load -i ~/image.tar
34+
35+
- name: Build pyoxy Linux Executable
36+
run: |
37+
just actions-build-pyoxy-linux
38+
39+
- name: Upload
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: exe-pyoxy-x86_64-unknown-linux-gnu
43+
path: upload/pyoxy
44+
45+
# This is nearly identical to build-exe.yml and could likely be consolidated
46+
# with some additional parameters to that workflow.
47+
build-macos:
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
target_triple:
52+
- 'aarch64-apple-darwin'
53+
- 'x86_64-apple-darwin'
54+
runs-on: 'macos-11'
55+
env:
56+
IN_CI: '1'
57+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
58+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
59+
SCCACHE_BUCKET: 'pyoxidizer-sccache'
60+
SCCACHE_S3_USE_SSL: '1'
61+
# Prevent sccache server from stopping due to inactivity.
62+
SCCACHE_IDLE_TIMEOUT: '0'
63+
RUSTC_WRAPPER: sccache
64+
steps:
65+
- uses: actions/checkout@v3
66+
with:
67+
fetch-depth: 0
68+
69+
- uses: ./.github/actions/rust-bootstrap
70+
with:
71+
rust_toolchain: stable
72+
73+
- name: Build
74+
run: |
75+
just actions-build-pyoxy-macos ${{ matrix.target_triple }}
76+
77+
- name: Upload
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: exe-pyoxy-${{ matrix.target_triple }}
81+
path: upload/pyoxy
82+
83+
macos-universal:
84+
needs:
85+
- build-macos
86+
runs-on: 'macos-11'
87+
steps:
88+
- uses: actions/checkout@v3
89+
with:
90+
fetch-depth: 0
91+
92+
- uses: ./.github/actions/install-just
93+
94+
- name: Download aarch64 executable
95+
uses: actions/download-artifact@v3
96+
with:
97+
name: exe-pyoxy-aarch64-apple-darwin
98+
path: pyoxy-aarch64
99+
100+
- name: Download x86-64 executable
101+
uses: actions/download-artifact@v3
102+
with:
103+
name: exe-pyoxy-x86_64-apple-darwin
104+
path: pyoxy-x86-64
105+
106+
- name: Produce Universal Binary
107+
run: |
108+
just actions-macos-universal pyoxy
109+
110+
- name: Upload Universal Executable
111+
uses: actions/upload-artifact@v3
112+
with:
113+
name: exe-pyoxy-macos-universal
114+
path: uploads/pyoxy

.github/workflows/release.yml

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -332,140 +332,3 @@ jobs:
332332
with:
333333
name: pyoxidizer-wheels
334334
path: dist
335-
336-
pyoxy-linux-x86_64-bin:
337-
needs:
338-
- pyoxidizer-exes
339-
runs-on: 'ubuntu-20.04'
340-
steps:
341-
- uses: actions/checkout@v2
342-
343-
- name: Download PyOxidizer Linux Executable
344-
uses: actions/download-artifact@v3
345-
with:
346-
name: exe-pyoxidizer-x86_64-unknown-linux-musl
347-
path: /usr/local/bin/
348-
349-
- name: Restore Docker Image Cache
350-
id: cache-image
351-
uses: actions/cache@v2
352-
with:
353-
path: ~/image.tar
354-
key: ${{ runner.os }}-${{ hashFiles('ci/linux-portable-binary.Dockerfile') }}
355-
356-
- name: Build Docker Image
357-
if: steps.cache-image.outputs.cache-hit != 'true'
358-
run: |
359-
cd ci
360-
docker build -f linux-portable-binary.Dockerfile -t pyoxidizer:build .
361-
docker save -o ~/image.tar pyoxidizer:build
362-
363-
- name: Load Docker Image
364-
if: steps.cache-image.outputs.cache-hit == 'true'
365-
run: |
366-
docker load -i ~/image.tar
367-
368-
- name: Build pyoxy Linux Executable
369-
run: |
370-
chmod +x /usr/local/bin/pyoxidizer
371-
372-
mkdir -p pyoxy/build target
373-
chmod 777 pyoxy/build target
374-
docker run --rm -v $(pwd):/pyoxidizer -v /usr/local/bin:/opt/bin pyoxidizer:build /pyoxidizer/ci/build-pyoxy-linux.sh
375-
376-
mkdir -p dist/x86_64-unknown-linux-gnu
377-
cp target/release/pyoxy dist/x86_64-unknown-linux-gnu/
378-
379-
- name: Upload Executable
380-
uses: actions/upload-artifact@v3
381-
with:
382-
name: pyoxy-linux-bin
383-
path: |
384-
dist/*/*
385-
386-
pyoxy-macos-exe:
387-
strategy:
388-
fail-fast: false
389-
matrix:
390-
target_triple:
391-
- 'aarch64-apple-darwin'
392-
- 'x86_64-apple-darwin'
393-
runs-on: 'macos-11'
394-
env:
395-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
396-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
397-
SCCACHE_BUCKET: 'pyoxidizer-sccache'
398-
SCCACHE_S3_USE_SSL: '1'
399-
steps:
400-
- uses: ./.github/actions/install-just
401-
402-
- uses: actions/checkout@v2
403-
404-
- uses: actions-rs/toolchain@v1
405-
with:
406-
toolchain: stable
407-
default: true
408-
profile: minimal
409-
target: ${{ matrix.target_triple }}
410-
411-
- name: Install sccache
412-
run: |
413-
just actions-install-sccache-macos
414-
sccache --start-server
415-
416-
- name: Build pyoxy Executable
417-
env:
418-
RUSTC_WRAPPER: sccache
419-
run: |
420-
case "${{ matrix.target_triple }}" in
421-
aarch64-apple-darwin)
422-
export SDKROOT=/Applications/Xcode_12.5.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
423-
export OSX_DEPLOYMENT_TARGET=11.0
424-
;;
425-
x86_64-apple-darwin)
426-
export OSX_DEPLOYMENT_TARGET=10.9
427-
;;
428-
*)
429-
echo "unhandled target triple: ${{ matrix.target_triple }}"
430-
exit 1
431-
;;
432-
esac
433-
434-
rustc --version
435-
cargo run --bin pyoxidizer -- build --release --target-triple ${{ matrix.target_triple }} --path pyoxy
436-
437-
PYO3_CONFIG_FILE=$(pwd)/pyoxy/build/${{ matrix.target_triple }}/release/resources/pyo3-build-config-file.txt cargo build --bin pyoxy --target ${{ matrix.target_triple }} --release
438-
439-
mkdir -p dist/${{ matrix.target_triple }}
440-
mv target/${{ matrix.target_triple }}/release/pyoxy dist/${{ matrix.target_triple }}/
441-
442-
- name: Upload Executable
443-
uses: actions/upload-artifact@v3
444-
with:
445-
name: pyoxy-macos_exes
446-
path: |
447-
dist/*/*
448-
449-
pyoxy-macos-universal-exe:
450-
needs:
451-
- pyoxy-macos-exe
452-
runs-on: 'macos-11'
453-
steps:
454-
- name: Download CLI exes
455-
uses: actions/download-artifact@v3
456-
with:
457-
name: pyoxy-macos_exes
458-
path: inputs
459-
460-
- name: Produce Universal Binary
461-
run: |
462-
mkdir -p dist/macos-universal
463-
lipo inputs/*/pyoxy -create -output dist/macos-universal/pyoxy
464-
chmod +x dist/macos-universal/pyoxy
465-
lipo dist/macos-universal/pyoxy -info
466-
467-
- name: Upload Universal Executable
468-
uses: actions/upload-artifact@v3
469-
with:
470-
name: pyoxy-macos_universal_exe
471-
path: dist/*/pyoxy

Justfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ actions-bootstrap-rust-macos: actions-install-sccache-macos
5757
actions-bootstrap-rust-windows: actions-install-sccache-windows
5858

5959
actions-build-exe bin triple:
60+
#!/usr/bin/env bash
61+
set -euxo pipefail
62+
6063
export MACOSX_DEPLOYMENT_TARGET={{macosx_deployment_target}}
6164
cargo build --release --bin {{bin}} --target {{triple}} {{ if bin == "rcodesign" { rcodesign_extra_build_flags } else { "" } }}
6265
mkdir upload
@@ -69,6 +72,30 @@ actions-macos-universal exe:
6972
chmod +x uploads/{{exe}}
7073
lipo uploads/{{exe}} -info
7174

75+
actions-build-pyoxy-linux:
76+
cargo build --bin pyoxidizer --target x86_64-unknown-linux-musl
77+
cp target/x86_64-unknown-linux-musl/debug/pyoxidizer /usr/local/bin/pyoxidizer
78+
79+
mkdir -p pyoxy/build target
80+
chmod 777 pyoxy/build target
81+
docker run --rm -v $(pwd):/pyoxidizer -v /usr/local/bin:/opt/bin pyoxidizer:build /pyoxidizer/ci/build-pyoxy-linux.sh
82+
83+
mkdir upload
84+
cp target/release/pyoxy upload/
85+
86+
actions-build-pyoxy-macos triple:
87+
#!/usr/bin/env bash
88+
set -euxo pipefail
89+
90+
export SDKROOT=/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk
91+
export MACOSX_DEPLOYMENT_TARGET={{macosx_deployment_target}}
92+
cargo run --bin pyoxidizer -- build --release --target-triple {{triple}} --path pyoxy
93+
PYO3_CONFIG_FILE=$(pwd)/pyoxy/build/{{triple}}/release/resources/pyo3-build-config-file.txt cargo build --bin pyoxy --target {{triple}} --release
94+
95+
mkdir upload
96+
cp target/{{triple}}/release/pyoxy upload/
97+
sccache --stop-server
98+
7299
_remote-sign-exe ref workflow run_id artifact exe_name rcodesign_branch="main":
73100
gh workflow run sign-apple-exe.yml \
74101
--ref {{ref}} \

ci/linux-portable-binary.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CMD ["/bin/bash", "--login"]
1818
WORKDIR '/build'
1919

2020
RUN for s in debian_jessie debian_jessie-updates debian-security_jessie/updates; do \
21-
echo "deb http://snapshot.debian.org/archive/${s%_*}/20211022T210008Z/ ${s#*_} main"; \
21+
echo "deb http://snapshot.debian.org/archive/${s%_*}/20220429T205342Z/ ${s#*_} main"; \
2222
done > /etc/apt/sources.list && \
2323
( echo 'quiet "true";'; \
2424
echo 'APT::Get::Assume-Yes "true";'; \
@@ -64,7 +64,7 @@ USER build
6464
RUN curl --insecure https://raw.githubusercontent.com/rust-lang/rustup/ce5817a94ac372804babe32626ba7fd2d5e1b6ac/rustup-init.sh > rustup-init.sh && \
6565
echo 'a3cb081f88a6789d104518b30d4aa410009cd08c3822a1226991d6cf0442a0f8 rustup-init.sh' | sha256sum -c - && \
6666
chmod +x rustup-init.sh && \
67-
./rustup-init.sh -y --default-toolchain 1.56.1 --profile minimal
67+
./rustup-init.sh -y --default-toolchain 1.60.0 --profile minimal
6868

6969
RUN curl --insecure -L https://github.com/indygreg/python-build-standalone/releases/download/20210724/cpython-3.9.6-x86_64-unknown-linux-gnu-install_only-20210724T1424.tar.gz > python.tar.gz && \
7070
echo 'a5e1f952a50a3a660922a7b558911d56c4d046078c67a83ec048f81ee4d3b8bd python.tar.gz' | sha256sum -c - && \

0 commit comments

Comments
 (0)