Skip to content

Commit 7abe8bb

Browse files
committed
ci: build pythonbuild in its own job
We can build this once so there isn't redundancy across jobs.
1 parent 5e1143a commit 7abe8bb

File tree

2 files changed

+83
-21
lines changed

2 files changed

+83
-21
lines changed

.github/workflows/linux.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,36 @@ jobs:
4747
name: sccache
4848
path: target/x86_64-unknown-linux-musl/release/sccache
4949

50+
pythonbuild:
51+
runs-on: 'ubuntu-20.04'
52+
steps:
53+
- uses: actions/checkout@v2
54+
55+
- name: Install Rust
56+
uses: actions-rs/toolchain@v1
57+
with:
58+
toolchain: stable
59+
default: true
60+
profile: minimal
61+
62+
- uses: actions/cache@v2
63+
with:
64+
path: |
65+
~/.cargo/registry
66+
~/.cargo/git
67+
target
68+
key: ${{ runner.os }}-pythonbuild-${{ hashFiles('Cargo.lock') }}
69+
70+
- name: Build
71+
run: |
72+
cargo build --release
73+
74+
- name: Upload pythonbuild Executable
75+
uses: actions/upload-artifact@v2
76+
with:
77+
name: pythonbuild
78+
path: target/release/pythonbuild
79+
5080
build:
5181
strategy:
5282
fail-fast: false
@@ -70,6 +100,7 @@ jobs:
70100
optimizations: 'pgo'
71101

72102
needs:
103+
- pythonbuild
73104
- sccache
74105
runs-on: 'ubuntu-20.04'
75106
env:
@@ -87,18 +118,17 @@ jobs:
87118
with:
88119
python-version: '3.8'
89120

90-
- name: Install Rust
91-
uses: actions-rs/toolchain@v1
92-
with:
93-
toolchain: stable
94-
default: true
95-
profile: minimal
96-
97121
- name: Download sccache
98122
uses: actions/download-artifact@v2
99123
with:
100124
name: sccache
101125

126+
- name: Download pythonbuild
127+
uses: actions/download-artifact@v2
128+
with:
129+
name: pythonbuild
130+
path: build
131+
102132
- name: Start sccache
103133
run: |
104134
chmod +x sccache
@@ -119,7 +149,8 @@ jobs:
119149
- name: Validate Distribution
120150
run: |
121151
export RUSTC_WRAPPER=$(pwd)/sccache
122-
cargo run -- validate-distribution dist/*.tar.zst
152+
chmod +x build/pythonbuild
153+
build/pythonbuild validate-distribution dist/*.tar.zst
123154
124155
- name: Upload Distribution
125156
uses: actions/upload-artifact@v2

.github/workflows/macos.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,36 @@ jobs:
4141
name: sccache
4242
path: target/release/sccache
4343

44+
pythonbuild:
45+
runs-on: 'macos-10.15'
46+
steps:
47+
- uses: actions/checkout@v2
48+
49+
- name: Install Rust
50+
uses: actions-rs/toolchain@v1
51+
with:
52+
toolchain: stable
53+
default: true
54+
profile: minimal
55+
56+
- uses: actions/cache@v2
57+
with:
58+
path: |
59+
~/.cargo/registry
60+
~/.cargo/git
61+
target
62+
key: ${{ runner.os }}-pythonbuild-${{ hashFiles('Cargo.lock') }}
63+
64+
- name: Build
65+
run: |
66+
cargo build --release
67+
68+
- name: Upload pythonbuild Executable
69+
uses: actions/upload-artifact@v2
70+
with:
71+
name: pythonbuild
72+
path: target/release/pythonbuild
73+
4474
build:
4575
strategy:
4676
fail-fast: false
@@ -51,7 +81,9 @@ jobs:
5181
optimizations:
5282
- 'debug'
5383
- 'pgo'
54-
needs: sccache
84+
needs:
85+
- pythonbuild
86+
- sccache
5587
runs-on: 'macos-10.15'
5688
env:
5789
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -68,18 +100,17 @@ jobs:
68100
with:
69101
python-version: '3.8'
70102

71-
- name: Install Rust
72-
uses: actions-rs/toolchain@v1
73-
with:
74-
toolchain: stable
75-
default: true
76-
profile: minimal
77-
78103
- name: Download sccache
79104
uses: actions/download-artifact@v2
80105
with:
81106
name: sccache
82107

108+
- name: Download pythonbuild
109+
uses: actions/download-artifact@v2
110+
with:
111+
name: pythonbuild
112+
path: build
113+
83114
- name: Start sccache
84115
run: |
85116
chmod +x sccache
@@ -90,16 +121,16 @@ jobs:
90121
export PYBUILD_RELEASE_TAG=$(git log -n 1 --date=format:%Y%m%dT%H%M --pretty=format:%ad)
91122
./build-macos.py --python ${{ matrix.py }} --optimizations ${{ matrix.optimizations }}
92123
93-
- name: Validate Distribution
94-
run: |
95-
export RUSTC_WRAPPER=$(pwd)/sccache
96-
cargo run -- validate-distribution dist/*.tar.zst
97-
98124
- name: Stop sccache
99125
continue-on-error: true
100126
run: |
101127
./sccache --stop-server
102128
129+
- name: Validate Distribution
130+
run: |
131+
chmod +x build/pythonbuild
132+
build/pythonbuild validate-distribution dist/*.tar.zst
133+
103134
- name: Upload Distributions
104135
uses: actions/upload-artifact@v2
105136
with:

0 commit comments

Comments
 (0)