Files
CollabTable/.github/workflows/tests.yml
T
Gabriel20xx a988fdee44
Tests / Go backend (push) Failing after 57s
Tests / Dashboard checks (push) Failing after 55s
Lint / Lint (push) Failing after 55s
Docker / Docker Build & Push (push) Failing after 59s
Use versioned shared module and registry credentials
2026-08-06 09:44:57 +02:00

128 lines
3.6 KiB
YAML

name: Tests
on:
push:
branches:
- "**"
paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml'
pull_request:
branches:
- main
- master
paths:
- 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml'
workflow_dispatch: {}
jobs:
backend:
name: Go backend
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Checkout latest SharedCode
working-directory: ${{ github.workspace }}
run: |
for attempt in 1 2 3 4 5; do
rm -rf SharedCode
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
break
fi
if [ "$attempt" -eq 5 ]; then
exit 1
fi
delay=$((attempt * 5))
echo "SharedCode clone failed (attempt ${attempt}/5); retrying in ${delay}s..." >&2
sleep "$delay"
done
- name: Configure Gitea Go registry
working-directory: ${{ github.workspace }}
shell: bash
env:
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "$PACKAGE_REGISTRY_USERNAME" ] || [ -z "$PACKAGE_REGISTRY_TOKEN" ]; then
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
exit 1
fi
netrc_path="$RUNNER_TEMP/gitea-go.netrc"
umask 077
{
printf 'machine repos.gfranz.ch\n'
printf 'login %s\n' "$PACKAGE_REGISTRY_USERNAME"
printf 'password %s\n' "$PACKAGE_REGISTRY_TOKEN"
} > "$netrc_path"
{
printf 'NETRC=%s\n' "$netrc_path"
printf 'GOAUTH=netrc\n'
printf 'GOPROXY=https://repos.gfranz.ch/api/packages/Gabriel20xx/go,https://proxy.golang.org\n'
printf 'GONOSUMDB=repos.gfranz.ch/Gabriel20xx/shared/*\n'
} >> "$GITHUB_ENV"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache: true
- name: Test
run: go test ./...
frontend:
name: Dashboard checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
- name: Checkout latest SharedCode
working-directory: ${{ github.workspace }}
run: |
for attempt in 1 2 3 4 5; do
rm -rf SharedCode
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
break
fi
if [ "$attempt" -eq 5 ]; then
exit 1
fi
delay=$((attempt * 5))
echo "SharedCode clone failed (attempt ${attempt}/5); retrying in ${delay}s..." >&2
sleep "$delay"
done
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Check dashboard
run: npm run check