Skip to content

Commit f525ec3

Browse files
committed
Cache deps
1 parent 50db72e commit f525ec3

1 file changed

Lines changed: 53 additions & 13 deletions

File tree

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

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

1111
jobs:
1212

13-
build_linux:
13+
download-dependencies:
14+
strategy:
15+
fail-fast: true
16+
env:
17+
RELENV_DATA: ${{ github.workspace }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python 3.11
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
- name: Install Dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y python3-virtualenv
28+
virtualenv venv
29+
venv/bin/python3 -m pip install nox ppbt
30+
- name: Download Dependencies
31+
run: |
32+
venv/bin/python3 -m relenv build --download-only
33+
- name: Cache Dependencies
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ github.workspace }}/download
37+
key: ${{ github.run_id }}-dependencies
38+
1439

40+
build_linux:
1541
strategy:
1642
fail-fast: false
1743
matrix:
@@ -28,14 +54,13 @@ jobs:
2854
target: x86_64
2955
- host: aarch64
3056
target: aarch64
31-
57+
needs:
58+
- download-depedencies
3259
name: "Python ${{ matrix.version }} Linux ${{ matrix.target }} on ${{ matrix.host }}"
3360
runs-on:
3461
- ${{ (contains(matrix.host, 'x86_64') && 'ubuntu-24.04') || 'ubuntu-24.04-arm' }}
35-
3662
env:
3763
RELENV_DATA: ${{ github.workspace }}
38-
3964
steps:
4065
- name: "Throttle Builds"
4166
shell: bash
@@ -61,6 +86,12 @@ jobs:
6186
venv/bin/python3 --version
6287
venv/bin/python3 -c 'import os; print(os.name)'
6388
89+
- name: Restore Cached Dependencies
90+
uses: actions/cache/restore@v4
91+
with:
92+
path: ${{ github.workspace }}/download
93+
key: ${{ github.run_id }}-dependencies
94+
6495
- name: Build
6596
run: |
6697
venv/bin/python3 -m relenv build --no-pretty --arch=${{ matrix.target }} --python=${{ matrix.version }}
@@ -83,9 +114,7 @@ jobs:
83114

84115
build_macos_12_x86_64:
85116
name: "Python macOS"
86-
87117
runs-on: macos-13
88-
89118
strategy:
90119
fail-fast: false
91120
matrix:
@@ -96,10 +125,10 @@ jobs:
96125
- 3.13.5
97126
arch:
98127
- x86_64
99-
100128
env:
101129
RELENV_DATA: ${{ github.workspace }}
102-
130+
needs:
131+
- download-dependencies
103132
steps:
104133
- name: "Throttle Builds"
105134
shell: bash
@@ -126,6 +155,13 @@ jobs:
126155
run: |
127156
pip3 install nox
128157
158+
- name: Restore Cached Dependencies
159+
uses: actions/cache/restore@v4
160+
with:
161+
path: ${{ github.workspace }}/download
162+
key: ${{ github.run_id }}-dependencies
163+
164+
129165
- name: Build
130166
run: |
131167
python3 -m relenv build --no-pretty --python=${{ matrix.version }}
@@ -160,10 +196,10 @@ jobs:
160196
- 3.13.5
161197
arch:
162198
- arm64
163-
164199
env:
165200
RELENV_DATA: ${{ github.workspace }}
166-
201+
needs:
202+
- download-dependencies
167203
steps:
168204
- uses: actions/checkout@v3
169205

@@ -185,6 +221,13 @@ jobs:
185221
run: |
186222
brew install nox
187223
224+
- name: Restore Cached Dependencies
225+
uses: actions/cache/restore@v4
226+
with:
227+
path: ${{ github.workspace }}/download
228+
key: ${{ github.run_id }}-dependencies
229+
230+
188231
- name: Build
189232
run: |
190233
python3 -m relenv build --no-pretty --python=${{ matrix.version }}
@@ -207,7 +250,6 @@ jobs:
207250
build_windows:
208251
name: "Python Windows"
209252
runs-on: windows-latest
210-
211253
strategy:
212254
fail-fast: false
213255
matrix:
@@ -219,10 +261,8 @@ jobs:
219261
arch:
220262
- amd64
221263
- x86
222-
223264
env:
224265
RELENV_DATA: ${{ github.workspace }}
225-
226266
steps:
227267
- name: "Throttle Builds"
228268
shell: bash

0 commit comments

Comments
 (0)