build and test countdown #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build and test countdown | |
run-name: build and test countdown | |
on: | |
schedule: | |
- cron: "0 0 1 * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run podman build | |
run: podman build -t countdown-test -f Containerfile . | |
- name: Run system container with `podman` | |
run: | | |
podman run -d --name countdown --systemd=always --cap-add=NET_RAW --cap-add=NET_ADMIN --device=/dev/net/tun countdown-test | |
- name: Tailscale setup (root) | |
run: | | |
until podman exec countdown tailscale up --auth-key ${TAILSCALE_AUTHKEY} | |
do | |
sleep 0.1 | |
done | |
podman exec countdown tailscale set --hostname code-${HOSTNAME} | |
podman exec countdown tailscale set --ssh | |
env: | |
TAILSCALE_AUTHKEY: ${{ secrets.TAILSCALE_AUTHKEY}} | |
- name: Hang around until countdown | |
run: | | |
podman exec -d countdown code serve-web --without-connection-token | |
sleep 15 | |
podman exec countdown tailscale serve --bg 8000 | |
podman exec countdown systemctl start countdown.timer | |
until ! podman exec countdown systemctl is-active --quiet countdown.timer | |
do | |
sleep 10 | |
done | |
sleep 60 | |
podman exec countdown systemctl poweroff | |
echo "Finished by reaching countdown" |