45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
---
|
|
name: CI
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
name: Run Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Setup Docker buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Start MQTT.
|
|
run: >
|
|
docker run -d --name mosquitto \
|
|
-p "1883:1883" \
|
|
-p "8883:8883" \
|
|
-p "8080:8080" \
|
|
-p "8081:8081" \
|
|
eclipse-mosquitto:latest
|
|
- name: Build the test image.
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: Dockerfile.test
|
|
platforms: |
|
|
linux/arm64
|
|
linux/amd64
|
|
push: true
|
|
tags: |
|
|
git.housh.dev/michael/${{ gitea.repository }}:${{ gitea.sha }}
|
|
- name: Run Test
|
|
run: >
|
|
docker run --rm \
|
|
-e MOSQUITTO_SERVER=127.0.0.1 \
|
|
git.housh.dev/michael/${{ gitea.repository }}:${{ gitea.sha }} \
|
|
swift test
|
|
- name: Cleanup.
|
|
if: always()
|
|
run: docker stop mosquitto && docker rm -f mosquitto
|