Skip to content

Update GitHub Actions Testing Suite #201

Update GitHub Actions Testing Suite

Update GitHub Actions Testing Suite #201

Workflow file for this run

name: Test
# Trigger the workflow on push or pull request
on:
push:
paths:
- 'zram-config'
- '**.bash'
- 'tests/**'
- '.github/workflows/test-action.yml'
pull_request:
paths:
- 'zram-config'
- '**.bash'
- 'tests/**'
- '.github/workflows/test-action.yml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
id: setup
run: |
sudo -E bash -c set
sudo add-apt-repository ppa:canonical-server/server-backports
sudo apt-get update
sudo apt-get install --yes gnupg xz-utils expect systemd-container qemu-user-static qemu-utils qemu-system-arm
echo "imagexz=$(basename "$(curl "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')")" >> $GITHUB_OUTPUT
echo "image=$(echo "$(basename "$(curl "https://downloads.raspberrypi.org/raspios_lite_armhf_latest" -s -L -I -o /dev/null -w '%{url_effective}')")" | sed -e 's/.xz//')" >> $GITHUB_OUTPUT
- name: Cache Raspberry Pi OS 32bit image
uses: actions/cache@v4
with:
path: ${{ steps.setup.outputs.image }}
key: ${{ steps.setup.outputs.image }}
- name: Build image
run: |
sudo -E ./tests/image.bash "setup" "${{ steps.setup.outputs.imagexz }}" "${{ steps.setup.outputs.image }}"
cp "${{ steps.setup.outputs.image }}" $RUNNER_TEMP/raspios.img
shell: bash
- name: Run tests
uses: pguyot/arm-runner-action@v2
with:
base_image: file://$RUNNER_TEMP/raspios.img
cpu: cortex-a7
cpu_info: cpuinfo/raspberrypi_3b
bind_mount_repository: true
import_github_env: true
commands: |
/zram-config/install.bash
/zram-config/test/test-zram-devices.bash
/zram-config/uninstall.bash
/zram-config/test/test-zram-devices.bash removal
shell: bash
- name: Copy logs
if: always()
run: sudo ./tests/image.bash "copy-logs" "$RUNNER_TEMP/raspios.img"
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs.tar
path: logs.tar