Skip to content

Commit

Permalink
Update Actions tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ethan Dye <[email protected]>
  • Loading branch information
ecdye committed Jan 13, 2025
1 parent 4e4343f commit 742ec53
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/bats-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ jobs:
strategy:
matrix:
platform: [rpi4, amd64]
include:
- platform: rpi4
buildx_platform: linux/arm64
continue-on-error: true # We want to test platforms independently
- platform: amd64
buildx_platform: linux/amd64
continue-on-error: true # We want to test platforms independently

steps:
- name: Checkout repository
Expand All @@ -70,12 +77,13 @@ jobs:
file: ./tests/Dockerfile.${{ matrix.platform }}-BATS
builder: ${{ steps.buildx.outputs.name }}
tags: localhost:5000/openhabian/${{ matrix.platform }}-openhabian:latest
platforms: ${{ matrix.buildx_platform }}
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 run --rm --name "openhabian-${{ matrix.platform }}" --platform ${{ matrix.buildx_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-." .'
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/installation-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,34 @@ jobs:

strategy:
matrix:
platform: [rpi5-openjdk17, rpi3-openjdk17, amd64-openjdk17, rpi3-bellsoft21]
platform: [rpi5-openjdk17, rpi3-openjdk17, amd64-openjdk17, rpi5-openjdk21, rpi5-temurin21]
include:

- platform: rpi5-openjdk17
dockerfile: ./tests/Dockerfile.rpi5-installation
qemu_platform: arm64
buildx_platform: linux/arm64
java_opt: "17"
- platform: rpi3-openjdk17
dockerfile: ./tests/Dockerfile.rpi3-installation
qemu_platform: arm
buildx_platform: linux/arm/v7
java_opt: "17"
- platform: amd64-openjdk17
dockerfile: ./tests/Dockerfile.amd64-installation
qemu_platform: ""
buildx_platform: linux/amd64
java_opt: "17"
- platform: rpi3-bellsoft21
dockerfile: ./tests/Dockerfile.rpi3-installation
qemu_platform: arm
java_opt: "BellSoft21"
- platform: rpi5-openjdk21
dockerfile: ./tests/Dockerfile.rpi5-installation
qemu_platform: arm64
buildx_platform: linux/arm64
java_opt: "21"
continue-on-error: true # Experimental currently
- platform: rpi5-temurin21
dockerfile: ./tests/Dockerfile.rpi5-installation
qemu_platform: arm64
buildx_platform: linux/arm64
java_opt: "Temurin21"
continue-on-error: true # Experimental currently

steps:
Expand Down Expand Up @@ -87,9 +96,10 @@ jobs:
tags: localhost:5000/openhabian/${{ matrix.platform }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ matrix.buildx_platform }}
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 run --privileged --rm --platform ${{ matrix.buildx_platform }} --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
2 changes: 1 addition & 1 deletion functions/menu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ show_main_menu() {
"43 | Clean cache" "Clean the cache for openHAB" \
"44 | Nginx Proxy" "Setup reverse and forward web proxy" \
"45 | OpenJDK 17" "Install and activate OpenJDK 17 as Java provider (default)" \
"45 | OpenJDK 21" "Install and activate OpenJDK 21 as Java provider (upcoming default)" \
" | OpenJDK 21" "Install and activate OpenJDK 21 as Java provider (upcoming default)" \
" | Temurin 17" "Install and activate Temurin 17 as Java provider (default alternative)" \
" | Temurin 21" "Install and activate Temurin 21 as Java provider (upcoming alternative default)" \
" | OpenJDK 11" "Install and activate OpenJDK 11 as Java provider (legacy)" \
Expand Down
2 changes: 1 addition & 1 deletion functions/nodejs-apps.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ teardown_file() {
echo -e "# ${COL_GREEN}$(timestamp) [openHABian] Frontail service is running.${COL_DEF}" >&3
}

@test "installation-zigbee2mqtt_install" {
@test "disabled-zigbee2mqtt_install" {
echo -e "# ${COL_CYAN}$(timestamp) [openHABian] Zigbee2MQTT installation starting...${COL_DEF}" >&3
run zigbee2mqtt_setup "install" 3>&-
if [ "$status" -ne 0 ]; then echo "$output" >&3; fi
Expand Down
10 changes: 9 additions & 1 deletion functions/openhab.bash
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ openhab_setup() {
repo="deb [signed-by=/usr/share/keyrings/${keyName}.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main"
echo -n "$(timestamp) [openHABian] Beginning install of latest $ohPkgName release (stable repo)... "
elif [[ $1 == "milestone" || $1 == "testing" ]]; then
introText="You are about to install or change to the latest milestone $ohPkgName build. Note this is openHAB 4!\\n\\nMilestones contain the latest features and is supposed to run stable, but if you experience bugs or incompatibilities, please help with enhancing openHAB by posting them on the community forum or by raising a GitHub issue in the proper place.\\n\\nPlease be aware that downgrading from a newer build is not supported!\\n\\nPlease consult with the documentation or community forum and be sure to take a full openHAB configuration backup first!"
introText="You are about to install or change to the latest milestone $ohPkgName build. Note this is openHAB 5!\\n\\nMilestones contain the latest features and is supposed to run stable, but if you experience bugs or incompatibilities, please help with enhancing openHAB by posting them on the community forum or by raising a GitHub issue in the proper place.\\n\\nPlease be aware that downgrading from a newer build is not supported!\\n\\nPlease consult with the documentation or community forum and be sure to take a full openHAB configuration backup first!"
successText="The testing release of $ohPkgName is now installed on your system.\\n\\nPlease test the correct behavior of your setup. You might need to adapt your configuration, if available. If you made changes to the files in '/var/lib/${ohPkgName}' they were replaced, but you can restore them from backup files next to the originals.\\n\\nCheck the \"openHAB Release Notes\" and the official announcements to learn about additons, fixes and changes."
repo="deb [signed-by=/usr/share/keyrings/${keyName}.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg testing main"
echo -n "$(timestamp) [openHABian] Beginning install of latest $ohPkgName milestone build (testing repo)... "
Expand Down Expand Up @@ -98,6 +98,14 @@ openhab_setup() {
openhabVersion="${2:-$(apt-cache madison ${ohPkgName} | head -n 1 | cut -d'|' -f2 | xargs)}"
if [[ -n $openhabVersion ]]; then
installVersion="${ohPkgName}=${openhabVersion} ${ohPkgName}-addons=${openhabVersion}"
if dpkg --compare-versions "$installVersion" ge "5.0.0"; then
if [[ -n $INTERACTIVE ]]; then
if ! (whiptail --title "openHAB software change" --msgbox "openHAB 5 requires Java 21.\\n\\nPlease use menu option 45 to install Java 21." 20 80); then echo "CANCELED"; return 1; fi
else
echo "FAILED (openHAB 5 requires Java 21)"
return 1
fi
fi
else
installVersion="${ohPkgName} ${ohPkgName}-addons"
fi
Expand Down

0 comments on commit 742ec53

Please sign in to comment.