Skip to content

Commit

Permalink
Update GitHub Actions workflows (#1923)
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <mrtops03@gmail.com>
  • Loading branch information
ecdye authored Oct 24, 2024
1 parent b557494 commit 267df26
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 215 deletions.
106 changes: 37 additions & 69 deletions .github/workflows/bats-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,81 +35,49 @@ on:
- '.github/workflows/bats-action.yml'

jobs:
rpi4-bats:
bats-tests:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: sudo -E ./tests/ci-setup.bash github
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.rpi4-BATS
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/rpi4-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: BATS tests on virtual 64bit RPi4 running Debian Bullseye
run: |
docker run --rm --name "openhabian-rpi4" -d localhost:5000/openhabian/rpi4-openhabian
docker exec -i "openhabian-rpi4" bash -c 'bats --tap --recursive --filter "development-." .'
docker exec -i "openhabian-rpi4" bash -c 'bats --tap --recursive --filter "unit-." .'
docker exec -i "openhabian-rpi4" bash -c 'bats --tap --recursive --filter "installation-." .'
docker exec -i "openhabian-rpi4" bash -c 'bats --tap --recursive --filter "destructive-." .'
docker stop "openhabian-rpi4"
shell: bash
amd64-bats:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
platform: [rpi4, amd64]

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: sudo -E ./tests/ci-setup.bash github
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.amd64-BATS
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/amd64-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: BATS tests on generic Debian Bullseye 64bit
run: |
docker run --rm --name "openhabian-amd64" -d localhost:5000/openhabian/amd64-openhabian
docker exec -i "openhabian-amd64" bash -c 'bats --tap --recursive --filter "development-." .'
docker exec -i "openhabian-amd64" bash -c 'bats --tap --recursive --filter "unit-." .'
docker exec -i "openhabian-amd64" bash -c 'bats --tap --recursive --filter "installation-." .'
docker exec -i "openhabian-amd64" bash -c 'bats --tap --recursive --filter "destructive-." .'
docker stop "openhabian-amd64"
shell: bash
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: sudo -E ./tests/ci-setup.bash github
- name: Set up QEMU
if: ${{ matrix.platform == 'rpi4' }}
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.${{ matrix.platform }}-BATS
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/${{ matrix.platform }}-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: BATS tests on ${{ matrix.platform }} platform
run: |
docker run --rm --name "openhabian-${{ matrix.platform }}" -d localhost:5000/openhabian/${{ matrix.platform }}-openhabian
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "development-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "unit-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "installation-." .'
docker exec -i "openhabian-${{ matrix.platform }}" bash -c 'bats --tap --recursive --filter "destructive-." .'
docker stop "openhabian-${{ matrix.platform }}"
shell: bash
194 changes: 53 additions & 141 deletions .github/workflows/installation-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,154 +29,66 @@ on:
- '!.github/workflows/installation-action.yml'

jobs:
rpi3-64-zulujdk21:
installation-tests:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
sudo -E ./tests/ci-setup.bash github
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.rpi3-64-installation
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/rpi3-64-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: openHABian installation test with Azul Zulu JDK 21 on a virtual RPi3-64
run: |
docker run --privileged --rm --name "openhabian-rpi3-64" -d localhost:5000/openhabian/rpi3-64-openhabian
docker exec -i "openhabian-rpi3-64" bash -c './build.bash local-test && /boot/first-boot.bash'
shell: bash
amd64-openjdk17:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
sudo -E ./tests/ci-setup.bash github
sed -i 's|^java_opt=.*$|java_opt=17|' build-image/openhabian.conf
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.amd64-installation
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/amd64-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: openHABian installation test with OpenJDK 17 on native amd64
run: |
docker run --privileged --rm --name "openhabian-amd64" -d localhost:5000/openhabian/amd64-openhabian
docker exec -i "openhabian-amd64" bash -c './build.bash local-test && /boot/first-boot.bash'
shell: bash
rpi3-openjdk17:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
strategy:
matrix:
platform: [rpi5-openjdk17, rpi3-openjdk17, amd64-openjdk17, rpi3-bellsoft21]
include:

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
sudo -E ./tests/ci-setup.bash github
sed -i 's|^java_opt=.*$|java_opt=17|' build-image/openhabian.conf
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.rpi3-installation
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/rpi3-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: openHABian installation test with OpenJDK 17 on a virtual RPi3
run: |
docker run --privileged --rm --name "openhabian-rpi3" -d localhost:5000/openhabian/rpi3-openhabian
docker exec -i "openhabian-rpi3" bash -c './build.bash local-test && /boot/first-boot.bash'
shell: bash
rpi3-64-openjdk17:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
- platform: rpi5-openjdk17
dockerfile: ./tests/Dockerfile.rpi5-installation
qemu_platform: arm64
java_opt: "17"
- platform: rpi3-openjdk17
dockerfile: ./tests/Dockerfile.rpi3-installation
qemu_platform: arm
java_opt: "17"
- platform: amd64-openjdk17
dockerfile: ./tests/Dockerfile.amd64-installation
qemu_platform: ""
java_opt: "17"
- platform: rpi3-bellsoft21
dockerfile: ./tests/Dockerfile.rpi3-installation
qemu_platform: arm
java_opt: "BellSoft21"
continue-on-error: true # Experimental currently

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
sudo -E ./tests/ci-setup.bash github
sed -i 's|^java_opt=.*$|java_opt=17|' build-image/openhabian.conf
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ./tests/Dockerfile.rpi3-64-installation
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/rpi3-64-openhabian:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: openHABian installation test with OpenJDK 17 on a virtual RPi3-64
run: |
docker run --privileged --rm --name "openhabian-rpi3-64" -d localhost:5000/openhabian/rpi3-64-openhabian
docker exec -i "openhabian-rpi3-64" bash -c './build.bash local-test && /boot/first-boot.bash'
shell: bash
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
sudo -E ./tests/ci-setup.bash github
sed -i 's|^java_opt=.*$|java_opt=${{ matrix.java_opt }}|' build-image/openhabian.conf
- name: Set up QEMU
if: ${{ matrix.qemu_platform != '' }}
uses: docker/setup-qemu-action@v3.2.0
with:
platforms: ${{ matrix.qemu_platform }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
with:
driver-opts: network=host
- name: Build Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
file: ${{ matrix.dockerfile }}
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/${{ matrix.platform }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
- name: openHABian installation test with ${{ matrix.platform }}
run: |
docker run --privileged --rm --name "openhabian-${{ matrix.platform }}" -d localhost:5000/openhabian/${{ matrix.platform }}
docker exec -i "openhabian-${{ matrix.platform }}" bash -c './build.bash local-test && /boot/first-boot.bash'
shell: bash
7 changes: 5 additions & 2 deletions functions/java-jre.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ java_install() {
java_alternatives_reset
rm -rf /opt/jdk
fi

openjdk_install_apt "$1"
if [[ $1 == "BellSoft21" ]]; then
liberica_install_apt
else
openjdk_install_apt "$1"
fi

if openhab_is_installed; then
cond_redirect systemctl restart openhab.service
Expand Down
2 changes: 1 addition & 1 deletion tests/Dockerfile.rpi3-installation
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Note RPi3 base (first RPi to have aarch64 available) WITH 32bit OS
# Note RPi3 base WITH 32bit OS for legacy (or soon to be) testing
FROM balenalib/raspberrypi3-debian:bookworm-build

Check warning on line 2 in tests/Dockerfile.rpi3-installation

View workflow job for this annotation

GitHub Actions / installation-tests (rpi3-openjdk17)

Base image platform does not match expected target platform

InvalidBaseImagePlatform: Base image balenalib/raspberrypi3-debian:bookworm-build was pulled with platform "linux/arm/v7", expected "linux/amd64" for current build

Check warning on line 2 in tests/Dockerfile.rpi3-installation

View workflow job for this annotation

GitHub Actions / installation-tests (rpi3-bellsoft21)

Base image platform does not match expected target platform

InvalidBaseImagePlatform: Base image balenalib/raspberrypi3-debian:bookworm-build was pulled with platform "linux/arm/v7", expected "linux/amd64" for current build

ENV DOCKER=1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Note RPi3 base (first RPi to have aarch64 available) WITH 64bit OS
FROM balenalib/raspberrypi3-64-debian:bookworm-build
FROM balenalib/raspberrypi5-debian:bookworm-build

Check warning on line 1 in tests/Dockerfile.rpi5-installation

View workflow job for this annotation

GitHub Actions / installation-tests (rpi5-openjdk17)

Base image platform does not match expected target platform

InvalidBaseImagePlatform: Base image balenalib/raspberrypi5-debian:bookworm-build was pulled with platform "linux/arm64", expected "linux/amd64" for current build

ENV DOCKER=1
ENV UDEV=1
Expand Down

0 comments on commit 267df26

Please sign in to comment.