Add Gitea Actions workflows
CI for both apps and the Rust crates, image publishing to GHCR, and the arm64 kiosk package build.
This commit is contained in:
@@ -0,0 +1,119 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
server:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
server/target
|
||||||
|
key: cargo-server-${{ hashFiles('server/Cargo.toml') }}
|
||||||
|
restore-keys: cargo-server-
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
working-directory: server
|
||||||
|
run: cargo fmt --check
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
working-directory: server
|
||||||
|
run: cargo clippy --all-targets
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: server
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: server
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.bun/install/cache
|
||||||
|
key: bun-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: bun-
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: bun install
|
||||||
|
|
||||||
|
- name: Type check
|
||||||
|
run: bun run check
|
||||||
|
|
||||||
|
- name: Build web client
|
||||||
|
run: bun run build:web
|
||||||
|
|
||||||
|
kiosk:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: Install Tauri system dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
libwebkit2gtk-4.1-dev \
|
||||||
|
libgtk-3-dev \
|
||||||
|
librsvg2-dev \
|
||||||
|
libayatana-appindicator3-dev \
|
||||||
|
libssl-dev \
|
||||||
|
patchelf \
|
||||||
|
build-essential \
|
||||||
|
file \
|
||||||
|
wget
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
apps/kiosk-client/src-tauri/target
|
||||||
|
key: cargo-kiosk-${{ hashFiles('apps/kiosk-client/src-tauri/Cargo.toml') }}
|
||||||
|
restore-keys: cargo-kiosk-
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: bun install
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
working-directory: apps/kiosk-client/src-tauri
|
||||||
|
run: cargo fmt --check
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
working-directory: apps/kiosk-client/src-tauri
|
||||||
|
run: cargo clippy --all-targets
|
||||||
|
|
||||||
|
- name: Build kiosk bundle
|
||||||
|
run: bun run build:kiosk
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
name: Build and Publish Docker Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
platforms:
|
||||||
|
description: "Target platforms, comma-separated. Adding an arm target needs a privileged runner."
|
||||||
|
required: false
|
||||||
|
default: "linux/amd64"
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_OWNER: sirblobby
|
||||||
|
DEFAULT_PLATFORMS: "linux/amd64"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: pistation-server
|
||||||
|
dockerfile: server/Dockerfile
|
||||||
|
- name: pistation-web
|
||||||
|
dockerfile: apps/web-client/Dockerfile
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Resolve target platforms
|
||||||
|
id: platforms
|
||||||
|
run: echo "value=${{ github.event.inputs.platforms || env.DEFAULT_PLATFORMS }}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
if: contains(steps.platforms.outputs.value, 'arm')
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to the container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels)
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=sha
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./${{ matrix.dockerfile }}
|
||||||
|
platforms: ${{ steps.platforms.outputs.value }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ matrix.name }}:buildcache,mode=max
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
# Container images are published separately by publish-images.yml. This builds the kiosk
|
||||||
|
# package for the Pi, which needs an arm64 toolchain rather than a Docker build.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
kiosk-deb:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: arm64
|
||||||
|
|
||||||
|
- name: Build the kiosk bundle for arm64
|
||||||
|
run: |
|
||||||
|
docker run --rm --platform linux/arm64 \
|
||||||
|
-v "$PWD:/work" -w /work \
|
||||||
|
arm64v8/debian:bookworm \
|
||||||
|
bash -eux -c '
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
curl ca-certificates unzip build-essential file wget \
|
||||||
|
libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev \
|
||||||
|
libayatana-appindicator3-dev libssl-dev patchelf pkg-config
|
||||||
|
|
||||||
|
curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||||
|
. "$HOME/.cargo/env"
|
||||||
|
|
||||||
|
curl -fsSL https://bun.sh/install | bash
|
||||||
|
export PATH="$HOME/.bun/bin:$PATH"
|
||||||
|
|
||||||
|
bun install
|
||||||
|
export PATH="/work/node_modules/.bin:$PATH"
|
||||||
|
bun run build:kiosk
|
||||||
|
'
|
||||||
|
|
||||||
|
- name: Collect artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
find apps/kiosk-client/src-tauri/target/release/bundle -name '*.deb' -exec cp {} dist/ \;
|
||||||
|
find apps/kiosk-client/src-tauri/target/release/bundle -name '*.AppImage' -exec cp {} dist/ \;
|
||||||
|
ls -lh dist
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: pistation-kiosk-arm64
|
||||||
|
path: dist/*
|
||||||
|
if-no-files-found: error
|
||||||
Reference in New Issue
Block a user