Skip to content

Commit c0b6ce6

Browse files
committed
Cache linux dependencies to reduce failures
We have been seeing some failures while downloading dependencies for linux builds. Lets cache them for each workflow run to reduce potential failures.
1 parent 50db72e commit c0b6ce6

1 file changed

Lines changed: 40 additions & 13 deletions

File tree

.github/workflows/build-native-action.yml

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,30 @@ on:
1010

1111
jobs:
1212

13-
build_linux:
13+
download-dependencies:
14+
name: Download Python Build Dependencies
15+
runs-on:
16+
- ubuntu-24.04
17+
strategy:
18+
fail-fast: true
19+
env:
20+
RELENV_DATA: ${{ github.workspace }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Set up Python 3.11
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.11'
27+
- name: Download Dependencies
28+
run: |
29+
python3 -m relenv build --download-only
30+
- name: Cache Dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ${{ github.workspace }}/download
34+
key: ${{ github.run_id }}-dependencies
1435

36+
build_linux:
1537
strategy:
1638
fail-fast: false
1739
matrix:
@@ -28,16 +50,16 @@ jobs:
2850
target: x86_64
2951
- host: aarch64
3052
target: aarch64
31-
53+
needs:
54+
- download-dependencies
3255
name: "Python ${{ matrix.version }} Linux ${{ matrix.target }} on ${{ matrix.host }}"
3356
runs-on:
3457
- ${{ (contains(matrix.host, 'x86_64') && 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
35-
3658
env:
3759
RELENV_DATA: ${{ github.workspace }}
38-
3960
steps:
4061
- name: "Throttle Builds"
62+
if: false
4163
shell: bash
4264
run: |
4365
t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t"
@@ -61,6 +83,12 @@ jobs:
6183
venv/bin/python3 --version
6284
venv/bin/python3 -c 'import os; print(os.name)'
6385
86+
- name: Restore Cached Dependencies
87+
uses: actions/cache/restore@v4
88+
with:
89+
path: ${{ github.workspace }}/download
90+
key: ${{ github.run_id }}-dependencies
91+
6492
- name: Build
6593
run: |
6694
venv/bin/python3 -m relenv build --no-pretty --arch=${{ matrix.target }} --python=${{ matrix.version }}
@@ -83,9 +111,7 @@ jobs:
83111

84112
build_macos_12_x86_64:
85113
name: "Python macOS"
86-
87114
runs-on: macos-13
88-
89115
strategy:
90116
fail-fast: false
91117
matrix:
@@ -96,12 +122,11 @@ jobs:
96122
- 3.13.5
97123
arch:
98124
- x86_64
99-
100125
env:
101126
RELENV_DATA: ${{ github.workspace }}
102-
103127
steps:
104128
- name: "Throttle Builds"
129+
if: false
105130
shell: bash
106131
run: |
107132
t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t"
@@ -160,11 +185,15 @@ jobs:
160185
- 3.13.5
161186
arch:
162187
- arm64
163-
164188
env:
165189
RELENV_DATA: ${{ github.workspace }}
166-
167190
steps:
191+
- name: "Throttle Builds"
192+
if: false
193+
shell: bash
194+
run: |
195+
t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t"
196+
168197
- uses: actions/checkout@v3
169198

170199
- name: Patch include
@@ -207,7 +236,6 @@ jobs:
207236
build_windows:
208237
name: "Python Windows"
209238
runs-on: windows-latest
210-
211239
strategy:
212240
fail-fast: false
213241
matrix:
@@ -219,12 +247,11 @@ jobs:
219247
arch:
220248
- amd64
221249
- x86
222-
223250
env:
224251
RELENV_DATA: ${{ github.workspace }}
225-
226252
steps:
227253
- name: "Throttle Builds"
254+
if: false
228255
shell: bash
229256
run: |
230257
t=$(python3 -c 'import random, sys; sys.stdout.write(str(random.randint(0, 600)))'); echo "Sleeping $t seconds"; sleep "$t"

0 commit comments

Comments
 (0)