Skip to content

Commit 6bc0274

Browse files
committed
cache common submodules and share cp version
1 parent 79bd883 commit 6bc0274

File tree

4 files changed

+247
-138
lines changed

4 files changed

+247
-138
lines changed

.github/workflows/build.yml

Lines changed: 169 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,54 @@ jobs:
2121
runs-on: ubuntu-20.04
2222
outputs:
2323
build-doc: ${{ steps.set-matrix.outputs.build-doc }}
24+
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
2425
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
25-
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
2626
boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }}
27-
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
27+
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
28+
cp-version: ${{ steps.cp-version.outputs.cp-version }}
2829
steps:
2930
- name: Dump GitHub context
3031
run: echo "$GITHUB_CONTEXT"
3132
env:
3233
GITHUB_CONTEXT: ${{ toJson(github) }}
33-
- uses: actions/checkout@v3
34+
- name: Set up repository
35+
uses: actions/checkout@v3
3436
with:
3537
submodules: false
3638
fetch-depth: 1
37-
- name: Set up Python 3
39+
- name: Set up python
3840
uses: actions/setup-python@v4
3941
with:
4042
python-version: "3.x"
41-
- name: Get CP deps
42-
run: python tools/ci_fetch_deps.py test ${{ github.sha }}
43+
- name: Duplicate USB VID/PID check
44+
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
45+
- name: Create submodule status
46+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
47+
- name: Cache submodules
48+
uses: actions/cache@v3
49+
with:
50+
path: |
51+
.git/modules/
52+
extmod/ulab
53+
frozen/
54+
lib/
55+
tools/
56+
key: submodules-common-${{ hashFiles('submodule_status') }}
57+
- name: CircuitPython dependencies
58+
run: |
59+
python tools/ci_fetch_deps.py ${{ github.job }}
60+
echo "::group::Fetch history and tags"
61+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD
62+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA
63+
git repack -d
64+
echo "::endgroup::"
4365
- name: CircuitPython version
66+
id: cp-version
4467
run: |
45-
tools/describe || git log --parents HEAD~4..
46-
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
68+
CP_VERSION=$(tools/describe)
69+
echo "$CP_VERSION"
70+
echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV
71+
echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT
4772
- name: Install dependencies
4873
run: |
4974
sudo apt-get update
@@ -54,8 +79,6 @@ jobs:
5479
run: |
5580
gcc --version
5681
python3 --version
57-
- name: Duplicate USB VID/PID Check
58-
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
5982
- name: Build mpy-cross
6083
run: make -C mpy-cross -j2
6184
- name: Build unix port
@@ -160,25 +183,36 @@ jobs:
160183

161184
mpy-cross-mac:
162185
runs-on: macos-11
186+
needs: test
187+
if: ${{ needs.test.outputs.boards-aarch != '[]' || needs.test.outputs.boards-arm != '[]' || needs.scheduler.test.boards-espressif != '[]' || needs.scheduler.test.boards-riscv != '[]' }}
188+
env:
189+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
163190
steps:
164-
- name: Dump GitHub context
165-
env:
166-
GITHUB_CONTEXT: ${{ toJson(github) }}
167-
run: echo "$GITHUB_CONTEXT"
168-
- uses: actions/checkout@v3
191+
- name: Set up repository
192+
uses: actions/checkout@v3
169193
with:
170194
submodules: false
171195
fetch-depth: 1
172-
- name: Set up Python 3
196+
- name: Set up python
173197
uses: actions/setup-python@v4
174198
with:
175-
python-version: "3.10"
176-
- name: Get CP deps
177-
run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }}
199+
python-version: "3.x"
200+
- name: Create submodule status
201+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
202+
- name: Restore submodules
203+
uses: actions/cache/restore@v3
204+
with:
205+
path: |
206+
.git/modules/
207+
extmod/ulab
208+
frozen/
209+
lib/
210+
tools/
211+
key: submodules-common-${{ hashFiles('submodule_status') }}
212+
- name: CircuitPython dependencies
213+
run: python tools/ci_fetch_deps.py ${{ github.job }}
178214
- name: CircuitPython version
179-
run: |
180-
tools/describe || git log --parents HEAD~4..
181-
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
215+
run: tools/describe
182216
- name: Install dependencies
183217
run: |
184218
brew install gettext
@@ -222,21 +256,34 @@ jobs:
222256
runs-on: ubuntu-20.04
223257
needs: test
224258
if: ${{ needs.test.outputs.build-doc == 'True' }}
259+
env:
260+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
225261
steps:
226-
- uses: actions/checkout@v3
262+
- name: Set up repository
263+
uses: actions/checkout@v3
227264
with:
228265
submodules: false
229266
fetch-depth: 1
230-
- name: Get CP deps
231-
run: python tools/ci_fetch_deps.py docs ${{ github.sha }}
267+
- name: Create submodule status
268+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
269+
- name: Restore submodules
270+
uses: actions/cache/restore@v3
271+
with:
272+
path: |
273+
.git/modules/
274+
extmod/ulab
275+
frozen/
276+
lib/
277+
tools/
278+
key: submodules-common-${{ hashFiles('submodule_status') }}
279+
- name: CircuitPython dependencies
280+
run: python tools/ci_fetch_deps.py ${{ github.job }}
232281
- name: CircuitPython version
233-
run: |
234-
tools/describe || git log --parents HEAD~4..
235-
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
236-
- name: Set up Python 3
282+
run: tools/describe
283+
- name: Set up python
237284
uses: actions/setup-python@v4
238285
with:
239-
python-version: "3.10"
286+
python-version: "3.x"
240287
- name: Install dependencies
241288
run: |
242289
sudo apt-get update
@@ -285,22 +332,37 @@ jobs:
285332
build-arm:
286333
runs-on: ubuntu-20.04
287334
needs: test
335+
if: ${{ needs.test.outputs.boards-arm != '[]' }}
336+
env:
337+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
288338
strategy:
289339
fail-fast: false
290340
matrix:
291341
board: ${{ fromJSON(needs.test.outputs.boards-arm) }}
292-
if: ${{ needs.test.outputs.boards-arm != '[]' }}
293342
steps:
294-
- name: Set up Python 3
295-
uses: actions/setup-python@v4
296-
with:
297-
python-version: "3.10"
298-
- uses: actions/checkout@v3
343+
- name: Set up repository
344+
uses: actions/checkout@v3
299345
with:
300346
submodules: false
301347
fetch-depth: 1
302-
- name: Get CP deps
303-
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
348+
- name: Set up python
349+
uses: actions/setup-python@v4
350+
with:
351+
python-version: "3.x"
352+
- name: Create submodule status
353+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
354+
- name: Restore submodules
355+
uses: actions/cache/restore@v3
356+
with:
357+
path: |
358+
.git/modules/
359+
extmod/ulab
360+
frozen/
361+
lib/
362+
tools/
363+
key: submodules-common-${{ hashFiles('submodule_status') }}
364+
- name: CircuitPython dependencies
365+
run: python tools/ci_fetch_deps.py ${{ matrix.board }}
304366
- uses: carlosperate/arm-none-eabi-gcc-action@v1
305367
with:
306368
release: '10-2020-q4'
@@ -338,22 +400,37 @@ jobs:
338400
build-riscv:
339401
runs-on: ubuntu-20.04
340402
needs: test
403+
if: ${{ needs.test.outputs.boards-riscv != '[]' }}
404+
env:
405+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
341406
strategy:
342407
fail-fast: false
343408
matrix:
344409
board: ${{ fromJSON(needs.test.outputs.boards-riscv) }}
345-
if: ${{ needs.test.outputs.boards-riscv != '[]' }}
346410
steps:
347-
- name: Set up Python 3
348-
uses: actions/setup-python@v4
349-
with:
350-
python-version: "3.10"
351-
- uses: actions/checkout@v3
411+
- name: Set up repository
412+
uses: actions/checkout@v3
352413
with:
353414
submodules: false
354415
fetch-depth: 1
355-
- name: Get CP deps
356-
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
416+
- name: Set up python
417+
uses: actions/setup-python@v4
418+
with:
419+
python-version: "3.x"
420+
- name: Create submodule status
421+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
422+
- name: Restore submodules
423+
uses: actions/cache/restore@v3
424+
with:
425+
path: |
426+
.git/modules/
427+
extmod/ulab
428+
frozen/
429+
lib/
430+
tools/
431+
key: submodules-common-${{ hashFiles('submodule_status') }}
432+
- name: CircuitPython dependencies
433+
run: python tools/ci_fetch_deps.py ${{ matrix.board }}
357434
- name: Install dependencies
358435
run: |
359436
sudo apt-get install -y gettext
@@ -390,27 +467,40 @@ jobs:
390467
build-espressif:
391468
runs-on: ubuntu-20.04
392469
needs: test
470+
if: ${{ needs.test.outputs.boards-espressif != '[]' }}
471+
env:
472+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
393473
strategy:
394474
fail-fast: false
395475
matrix:
396476
board: ${{ fromJSON(needs.test.outputs.boards-espressif) }}
397-
if: ${{ needs.test.outputs.boards-espressif != '[]' }}
398477
steps:
399-
- name: Set up Python 3
478+
- name: Set up repository
479+
uses: actions/checkout@v3
480+
with:
481+
submodules: false
482+
fetch-depth: 1
483+
- name: Set up python
400484
id: py3
401485
uses: actions/setup-python@v4
402486
with:
403487
python-version: "3.10"
404-
- uses: actions/checkout@v3
488+
- name: Create submodule status
489+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
490+
- name: Restore submodules
491+
uses: actions/cache/restore@v3
405492
with:
406-
submodules: false
407-
fetch-depth: 1
408-
- name: Get CP deps
409-
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
493+
path: |
494+
.git/modules/
495+
extmod/ulab
496+
frozen/
497+
lib/
498+
tools/
499+
key: submodules-common-${{ hashFiles('submodule_status') }}
500+
- name: CircuitPython dependencies
501+
run: python tools/ci_fetch_deps.py ${{ matrix.board }}
410502
- name: CircuitPython version
411-
run: |
412-
tools/describe || git log --parents HEAD~4..
413-
echo >>$GITHUB_ENV CP_VERSION=$(tools/describe)
503+
run: tools/describe
414504
- uses: actions/cache@v3
415505
name: Fetch IDF tool cache
416506
id: idf-cache
@@ -481,22 +571,37 @@ jobs:
481571
build-aarch:
482572
runs-on: ubuntu-20.04
483573
needs: test
574+
if: ${{ needs.test.outputs.boards-aarch != '[]' }}
575+
env:
576+
CP_VERSION: ${{ needs.test.outputs.cp-version }}
484577
strategy:
485578
fail-fast: false
486579
matrix:
487580
board: ${{ fromJSON(needs.test.outputs.boards-aarch) }}
488-
if: ${{ needs.test.outputs.boards-aarch != '[]' }}
489581
steps:
490-
- name: Set up Python 3
491-
uses: actions/setup-python@v4
492-
with:
493-
python-version: "3.10"
494-
- uses: actions/checkout@v3
582+
- name: Set up repository
583+
uses: actions/checkout@v3
495584
with:
496585
submodules: false
497586
fetch-depth: 1
498-
- name: Get CP deps
499-
run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }}
587+
- name: Set up python
588+
uses: actions/setup-python@v4
589+
with:
590+
python-version: "3.x"
591+
- name: Create submodule status
592+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
593+
- name: Restore submodules
594+
uses: actions/cache/restore@v3
595+
with:
596+
path: |
597+
.git/modules/
598+
extmod/ulab
599+
frozen/
600+
lib/
601+
tools/
602+
key: submodules-common-${{ hashFiles('submodule_status') }}
603+
- name: CircuitPython dependencies
604+
run: python tools/ci_fetch_deps.py ${{ matrix.board }}
500605
- name: Install dependencies
501606
run: |
502607
sudo apt-get install -y gettext mtools

.github/workflows/ports_windows.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,32 @@ jobs:
7171
which python; python --version; python -c "import cascadetoml"
7272
which python3; python3 --version; python3 -c "import cascadetoml"
7373
74-
- uses: actions/checkout@v3
74+
- name: Set up repository
75+
uses: actions/checkout@v3
7576
with:
7677
submodules: false
7778
fetch-depth: 1
78-
- name: Get CP deps
79-
run: python tools/ci_fetch_deps.py windows ${{ github.sha }}
79+
- name: Create submodule status
80+
run: git submodule status extmod/ulab frozen/ lib/ tools/ >> submodule_status
81+
- name: Restore submodules
82+
uses: actions/cache/restore@v3
83+
with:
84+
path: |
85+
.git/modules/
86+
extmod/ulab
87+
frozen/
88+
lib/
89+
tools/
90+
key: submodules-common-${{ hashFiles('submodule_status') }}
91+
enableCrossOsArchive: true
92+
- name: CircuitPython dependencies
93+
run: |
94+
python tools/ci_fetch_deps.py windows
95+
echo "::group::Fetch history and tags"
96+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD
97+
git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA
98+
git repack -d
99+
echo "::endgroup::"
80100
- name: CircuitPython version
81101
run: |
82102
tools/describe || git log --parents HEAD~4..

0 commit comments

Comments
 (0)