Skip to content

Commit 17e03c4

Browse files
committed
ci max parallelism
1 parent 23bb17c commit 17e03c4

File tree

7 files changed

+244
-129
lines changed

7 files changed

+244
-129
lines changed

.github/actions/fetch_submodules/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: 'Fetch Submodules'
22

33
inputs:
4+
target:
5+
description: 'The target for ci_fetch_deps'
6+
required: false
7+
type: string
8+
49
submodules:
510
description: 'The submodules to cache'
611
required: false
@@ -63,7 +68,7 @@ runs:
6368

6469
- name: CircuitPython dependencies
6570
id: cp-deps
66-
run: python tools/ci_fetch_deps.py ${{ matrix.board || github.job }}
71+
run: python tools/ci_fetch_deps.py ${{ inputs.target || matrix.board || github.job }}
6772
shell: bash
6873

6974
- name: CircuitPython version

.github/actions/mpy_cross/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Set up mpy-cross
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Download mpy-cross
7+
id: download-mpy-cross
8+
continue-on-error: true
9+
uses: actions/download-artifact@v3
10+
with:
11+
name: mpy-cross
12+
path: mpy-cross
13+
14+
- name: Make mpy-cross executable
15+
if: steps.download-mpy-cross.outcome == 'success'
16+
run: sudo chmod +x mpy-cross/mpy-cross
17+
shell: bash
18+
19+
- name: Build mpy-cross
20+
if: steps.download-mpy-cross.outcome == 'failure'
21+
run: make -C mpy-cross -j2
22+
shell: bash
23+
24+
- name: Upload mpy-cross
25+
continue-on-error: true
26+
if: steps.download-mpy-cross.outcome == 'failure'
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: mpy-cross
30+
path: mpy-cross/mpy-cross

.github/workflows/build-boards.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ jobs:
2525
matrix:
2626
board: ${{ fromJSON(inputs.boards) }}
2727
steps:
28-
- name: Dump GitHub context
29-
run: echo "$GITHUB_CONTEXT"
30-
env:
31-
GITHUB_CONTEXT: ${{ toJson(github) }}
3228
- name: Set up repository
3329
uses: actions/checkout@v3
3430
with:
@@ -49,6 +45,9 @@ jobs:
4945
uses: ./.github/actions/external_deps
5046
with:
5147
platform: ${{ inputs.platform }}
48+
- name: Set up mpy-cross
49+
if: steps.set-up-submodules.outputs.frozen == 'True'
50+
uses: ./.github/actions/mpy_cross
5251

5352
- name: Versions
5453
run: |
@@ -63,16 +62,6 @@ jobs:
6362
riscv64-unknown-elf-gcc --version || true
6463
mkfs.fat --version || true
6564
66-
- name: Download mpy-cross
67-
if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }}
68-
uses: actions/download-artifact@v3
69-
with:
70-
name: mpy-cross
71-
path: mpy-cross
72-
- name: Make mpy-cross executable
73-
if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }}
74-
run: sudo chmod +x mpy-cross/mpy-cross
75-
7665
- name: Set up build failure matcher
7766
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
7867
- name: Build

.github/workflows/build-mpy-cross.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build mpy-cross
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cp-version:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-22.04
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
mpy-cross: ["static", "static-aarch64", "static-mingw", "static-raspbian"]
17+
env:
18+
CP_VERSION: ${{ inputs.cp-version }}
19+
EX_static-mingw: static.exe
20+
OS_static: linux-amd64
21+
OS_static-aarch64: linux-aarch64
22+
OS_static-mingw: windows
23+
OS_static-raspbian: linux-raspbian
24+
steps:
25+
- name: Set up repository
26+
uses: actions/checkout@v3
27+
with:
28+
submodules: false
29+
fetch-depth: 1
30+
31+
- name: Set up python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: 3.x
35+
36+
- name: Set up submodules
37+
uses: ./.github/actions/fetch_submodules
38+
with:
39+
target: mpy-cross
40+
41+
- name: Install dependencies
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install -y gettext
45+
46+
- name: Install toolchain (aarch64)
47+
if: matrix.mpy-cross == 'static-aarch64'
48+
run: sudo apt-get install -y gcc-aarch64-linux-gnu
49+
50+
- name: Install toolchain (mingw)
51+
if: matrix.mpy-cross == 'static-mingw'
52+
run: sudo apt-get install -y mingw-w64
53+
54+
- name: Build mpy-cross.${{ matrix.mpy-cross }}
55+
run: make -C mpy-cross -j2 -f Makefile.${{ matrix.mpy-cross }}
56+
57+
- name: Upload artifact
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }}
61+
path: mpy-cross/mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }}
62+
63+
- name: Upload to S3
64+
if: >-
65+
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') ||
66+
(github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
67+
env:
68+
AWS_PAGER: ''
69+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
70+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71+
run: >-
72+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp
73+
mpy-cross/mpy-cross.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }}
74+
s3://adafruit-circuit-python/bin/mpy-cross/$OS_${{ matrix.mpy-cross }}/mpy-cross-$CP_VERSION.${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }}
75+
--no-progress --region us-east-1

0 commit comments

Comments
 (0)