Skip to content

Commit

Permalink
Update github actions to build python images in parallel
Browse files Browse the repository at this point in the history
- They take about 10 minutes each to build
  • Loading branch information
virtuald committed Oct 17, 2023
1 parent 30b142d commit 059d695
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 5 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: CI

on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
Expand All @@ -14,3 +18,74 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
make push
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
build-minimal:
name: Build Minimal
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make update
- run: make build/minimal-cross
- run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
make push/minimal-cross
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
- run: make save/minimal-images
- uses: actions/upload-artifact@v3
with:
name: roborio
path: roborio.tar.gz
retention-days: 1
- uses: actions/upload-artifact@v3
with:
name: raspbian
path: raspbian.tar.gz
retention-days: 1
- uses: actions/upload-artifact@v3
with:
name: aarch64
path: aarch64.tar.gz
retention-days: 1

build-python:
name: Build Python Images
needs: [build-minimal]
runs-on: ubuntu-latest
strategy:
matrix:
type:
- raspbian
- aarch64
pyversion:
- py38
- py39
- py310
- py311
- py312
include:
- type: roborio
pyversion: py312

steps:
- uses: actions/checkout@v3

- name: Download image
uses: actions/download-artifact@v3
with:
name: ${{ matrix.type }}
path: img

- name: Load image
run: |
gunzip -c img/${{ matrix.type }}.tar.gz | docker load
rm img/${{ matrix.type }}.tar.gz
- name: Build image
run: make build/cross-${{ matrix.type }}-${{ matrix.pyversion }}

- name: Upload image
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
make push/cross-${{ matrix.type }}-${{ matrix.pyversion }}
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,11 @@ push/minimal-cross: push/minimal-base
push/opensdk:
docker push ${DOCKER_USER}/opensdk-ubuntu:${OPENSDK_UBUNTU}


.PHONY: save/minimal-cross
save/minimal-cross:
docker save ${DOCKER_USER}/roborio-cross-ubuntu-minimal:2024-${UBUNTU} | gzip > roborio.tar.gz
docker save ${DOCKER_USER}/raspbian-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > raspbian.tar.gz
docker save ${DOCKER_USER}/aarch64-cross-ubuntu-minimal:bullseye-${UBUNTU} | gzip > aarch64.tar.gz

include cross-ubuntu-py/py.mk
5 changes: 0 additions & 5 deletions cross-ubuntu-py/py.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ VERSION_ROBORIO=2024
TARGET_HOST_ROBORIO=arm-frc2024-linux-gnueabi
AC_TARGET_HOST_ROBORIO=armv7l-frc2024-linux-gnueabi

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

.PHONY: build/cross-python
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
Expand Down

0 comments on commit 059d695

Please sign in to comment.