Skip to content

Commit

Permalink
Split it
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Oct 17, 2023
1 parent 393b437 commit 289c918
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 61 deletions.
71 changes: 60 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,68 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- run: make update
- run: make build
- run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
make push
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
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]
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: ${{ matrix.type }}.tar.gz

- name: Load image
run: |
gunzip -c ${{ matrix.type }}.tar.gz | docker load -
rm ${{ 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' }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ update:
docker pull docker.io/ubuntu:${UBUNTU}
docker pull docker.io/ubuntu:${OPENSDK_UBUNTU}

build: build/base build/cross build/cross-python build/opensdk
build: build/base build/cross build/opensdk

build/base:
cd ubuntu-base && \
Expand Down Expand Up @@ -41,7 +41,7 @@ build/opensdk:
cd opensdk/ubuntu && \
docker build -t ${DOCKER_USER}/opensdk-ubuntu:${OPENSDK_UBUNTU} --build-arg OPENSDK_UBUNTU=${OPENSDK_UBUNTU} .

push: $(patsubst %,push/%, base cross cross-python opensdk)
push: $(patsubst %,push/%, base cross opensdk)

push/base:
docker push ${DOCKER_USER}/ubuntu-base:${UBUNTU}
Expand Down
142 changes: 94 additions & 48 deletions cross-ubuntu-py/py.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,25 @@ 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: py38_RASPBIAN py38_AARCH64 py39_RASPBIAN py39_AARCH64 py310_RASPBIAN py310_AARCH64 py311_RASPBIAN py311_AARCH64 py312_ROBORIO py312_RASPBIAN py312_AARCH64
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

.PHONY: push/cross-python
push/cross-python: push/cross-raspbian-py38 push/cross-aarch64-py38 push/cross-raspbian-py39 push/cross-aarch64-py39 push/cross-raspbian-py310 push/cross-aarch64-py310 push/cross-raspbian-py311 push/cross-aarch64-py311 push/cross-roborio-py312 push/cross-raspbian-py312 push/cross-aarch64-py312


#
# Python 3.8
#

.PHONY: py38_RASPBIAN
py38_RASPBIAN: build/cross
.PHONY: build/cross-raspbian-py38
build/cross-raspbian-py38:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py38 \
Expand All @@ -35,8 +45,13 @@ py38_RASPBIAN: build/cross
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py38

.PHONY: py38_AARCH64
py38_AARCH64: build/cross
.PHONY: push/cross-raspbian-py38
push/cross-raspbian-py38:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py38


.PHONY: build/cross-aarch64-py38
build/cross-aarch64-py38:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py38 \
Expand All @@ -46,12 +61,17 @@ py38_AARCH64: build/cross
--build-arg VERSION=$(VERSION_AARCH64) \
-f Dockerfile.py38

.PHONY: push/cross-aarch64-py38
push/cross-aarch64-py38:
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py38


#
# Python 3.9
#

.PHONY: py39_RASPBIAN
py39_RASPBIAN: build/cross
.PHONY: build/cross-raspbian-py39
build/cross-raspbian-py39:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py39 \
Expand All @@ -61,8 +81,13 @@ py39_RASPBIAN: build/cross
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py39

.PHONY: py39_AARCH64
py39_AARCH64: build/cross
.PHONY: push/cross-raspbian-py39
push/cross-raspbian-py39:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py39


.PHONY: build/cross-aarch64-py39
build/cross-aarch64-py39:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py39 \
Expand All @@ -72,12 +97,17 @@ py39_AARCH64: build/cross
--build-arg VERSION=$(VERSION_AARCH64) \
-f Dockerfile.py39

.PHONY: push/cross-aarch64-py39
push/cross-aarch64-py39:
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py39


#
# Python 3.10
#

.PHONY: py310_RASPBIAN
py310_RASPBIAN: build/cross
.PHONY: build/cross-raspbian-py310
build/cross-raspbian-py310:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py310 \
Expand All @@ -87,8 +117,13 @@ py310_RASPBIAN: build/cross
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py310

.PHONY: py310_AARCH64
py310_AARCH64: build/cross
.PHONY: push/cross-raspbian-py310
push/cross-raspbian-py310:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py310


.PHONY: build/cross-aarch64-py310
build/cross-aarch64-py310:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py310 \
Expand All @@ -98,12 +133,17 @@ py310_AARCH64: build/cross
--build-arg VERSION=$(VERSION_AARCH64) \
-f Dockerfile.py310

.PHONY: push/cross-aarch64-py310
push/cross-aarch64-py310:
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py310


#
# Python 3.11
#

.PHONY: py311_RASPBIAN
py311_RASPBIAN: build/cross
.PHONY: build/cross-raspbian-py311
build/cross-raspbian-py311:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py311 \
Expand All @@ -113,8 +153,13 @@ py311_RASPBIAN: build/cross
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py311

.PHONY: py311_AARCH64
py311_AARCH64: build/cross
.PHONY: push/cross-raspbian-py311
push/cross-raspbian-py311:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py311


.PHONY: build/cross-aarch64-py311
build/cross-aarch64-py311:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py311 \
Expand All @@ -124,13 +169,34 @@ py311_AARCH64: build/cross
--build-arg VERSION=$(VERSION_AARCH64) \
-f Dockerfile.py311

.PHONY: push/cross-aarch64-py311
push/cross-aarch64-py311:
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py311



#
# Python 3.12
#

.PHONY: py312_ROBORIO
py312_ROBORIO: build/cross
.PHONY: build/cross-raspbian-py312
build/cross-raspbian-py312:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py312 \
--build-arg ARCH=$(TYPE_RASPBIAN) \
--build-arg TARGET_HOST=$(TARGET_HOST_RASPBIAN) \
--build-arg AC_TARGET_HOST=$(AC_TARGET_HOST_RASPBIAN) \
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py312

.PHONY: push/cross-raspbian-py312
push/cross-raspbian-py312:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py312


.PHONY: build/cross-roborio-py312
build/cross-roborio-py312:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_ROBORIO)-cross-ubuntu:$(VERSION_ROBORIO)-$(UBUNTU)-py312 \
Expand All @@ -141,19 +207,14 @@ py312_ROBORIO: build/cross
--build-arg MACHINE_ARG="--machine=roborio" \
-f Dockerfile.py312

.PHONY: py312_RASPBIAN
py312_RASPBIAN: build/cross
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py312 \
--build-arg ARCH=$(TYPE_RASPBIAN) \
--build-arg TARGET_HOST=$(TARGET_HOST_RASPBIAN) \
--build-arg AC_TARGET_HOST=$(AC_TARGET_HOST_RASPBIAN) \
--build-arg VERSION=$(VERSION_RASPBIAN) \
-f Dockerfile.py312
.PHONY: push/cross-roborio-py312
push/cross-roborio-py312:
docker push wpilib/$(TYPE_ROBORIO)-cross-ubuntu:$(VERSION_ROBORIO)-$(UBUNTU)-py312



.PHONY: py312_AARCH64
py312_AARCH64: build/cross
.PHONY: build/cross-aarch64-py312
build/cross-aarch64-py312:
cd cross-ubuntu-py && \
docker build . \
-t wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py312 \
Expand All @@ -163,21 +224,6 @@ py312_AARCH64: build/cross
--build-arg VERSION=$(VERSION_AARCH64) \
-f Dockerfile.py312


.PHONY: push/cross-python
push/cross-python:
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py38
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py38

docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py39
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py39

docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py310
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py310

docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py311
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py311

docker push wpilib/$(TYPE_ROBORIO)-cross-ubuntu:$(VERSION_ROBORIO)-$(UBUNTU)-py312
docker push wpilib/$(TYPE_RASPBIAN)-cross-ubuntu:$(VERSION_RASPBIAN)-$(UBUNTU)-py312
.PHONY: push/cross-aarch64-py312
push/cross-aarch64-py312:
docker push wpilib/$(TYPE_AARCH64)-cross-ubuntu:$(VERSION_AARCH64)-$(UBUNTU)-py312

0 comments on commit 289c918

Please sign in to comment.