Skip to content

Commit 050cc15

Browse files
committed
Update github actions to build python images in parallel
- They take about 10 minutes each to build
1 parent 30b142d commit 050cc15

File tree

3 files changed

+82
-5
lines changed

3 files changed

+82
-5
lines changed

.github/workflows/main.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: CI
22

33
on: [push, pull_request, workflow_dispatch]
44

5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
59
jobs:
610
build:
711
name: Build
@@ -14,3 +18,74 @@ jobs:
1418
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
1519
make push
1620
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
21+
22+
build-minimal:
23+
name: Build Minimal
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- run: make update
28+
- run: make build/minimal-cross
29+
- run: |
30+
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
31+
make push/minimal-cross
32+
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
33+
34+
- run: make save/minimal-cross
35+
- uses: actions/upload-artifact@v3
36+
with:
37+
name: roborio
38+
path: roborio.tar.gz
39+
retention-days: 1
40+
- uses: actions/upload-artifact@v3
41+
with:
42+
name: raspbian
43+
path: raspbian.tar.gz
44+
retention-days: 1
45+
- uses: actions/upload-artifact@v3
46+
with:
47+
name: aarch64
48+
path: aarch64.tar.gz
49+
retention-days: 1
50+
51+
build-python:
52+
name: Build Python Images
53+
needs: [build-minimal]
54+
runs-on: ubuntu-latest
55+
strategy:
56+
matrix:
57+
type:
58+
- raspbian
59+
- aarch64
60+
pyversion:
61+
- py38
62+
- py39
63+
- py310
64+
- py311
65+
- py312
66+
include:
67+
- type: roborio
68+
pyversion: py312
69+
70+
steps:
71+
- uses: actions/checkout@v3
72+
73+
- name: Download image
74+
uses: actions/download-artifact@v3
75+
with:
76+
name: ${{ matrix.type }}
77+
path: img
78+
79+
- name: Load image
80+
run: |
81+
gunzip -c img/${{ matrix.type }}.tar.gz | docker load
82+
rm img/${{ matrix.type }}.tar.gz
83+
84+
- name: Build image
85+
run: make build/cross-${{ matrix.type }}-${{ matrix.pyversion }}
86+
87+
- name: Upload image
88+
run: |
89+
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
90+
make push/cross-${{ matrix.type }}-${{ matrix.pyversion }}
91+
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,11 @@ push/minimal-cross: push/minimal-base
6767
push/opensdk:
6868
docker push ${DOCKER_USER}/opensdk-ubuntu:${OPENSDK_UBUNTU}
6969

70+
71+
.PHONY: save/minimal-cross
72+
save/minimal-cross:
73+
docker save ${DOCKER_USER}/roborio-cross-ubuntu-minimal:2024-${UBUNTU} | gzip > roborio.tar.gz
74+
docker save ${DOCKER_USER}/raspbian-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > raspbian.tar.gz
75+
docker save ${DOCKER_USER}/aarch64-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > aarch64.tar.gz
76+
7077
include cross-ubuntu-py/py.mk

cross-ubuntu-py/py.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ VERSION_ROBORIO=2024
1717
TARGET_HOST_ROBORIO=arm-frc2024-linux-gnueabi
1818
AC_TARGET_HOST_ROBORIO=armv7l-frc2024-linux-gnueabi
1919

20-
.PHONY: save-minimal-images
21-
save-minimal-images:
22-
docker save ${DOCKER_USER}/roborio-cross-ubuntu-minimal:2024-${UBUNTU} | gzip > roborio.tar.gz
23-
docker save ${DOCKER_USER}/raspbian-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > raspbian.tar.gz
24-
docker save ${DOCKER_USER}/aarch64-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > aarch64.tar.gz
2520

2621
.PHONY: build/cross-python
2722
build/cross-python: build/cross-raspbian-py38 build/cross-aarch64-py38 build/cross-raspbian-py39 build/cross-aarch64-py39 build/cross-raspbian-py310 build/cross-aarch64-py310 build/cross-raspbian-py311 build/cross-aarch64-py311 build/cross-roborio-py312 build/cross-raspbian-py312 build/cross-aarch64-py312

0 commit comments

Comments
 (0)