103 lines
2.5 KiB
YAML
103 lines
2.5 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/SharedCode 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 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/SharedCode 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
|