Visitenbuch/.forgejo/workflows/ci.yaml
ThetaDev 1de0cf7d59
All checks were successful
Visitenbuch CI / test (push) Successful in 6s
Visitenbuch CI / release (push) Has been skipped
ci: fixed oidc-mock image
2024-05-14 03:56:04 +02:00

98 lines
3.2 KiB
YAML

name: Visitenbuch CI
on:
push:
pull_request:
jobs:
test:
runs-on: cimaster-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: "test"
POSTGRES_PASSWORD: "1234"
oidc:
image: thetadev256/oidc-mock-server
env:
CLIENT_ID: visitenbuch
CLIENT_SECRET: supersecret
CLIENT_REDIRECT_URIS: http://localhost:4173/auth/callback/keycloak
CLIENT_LOGOUT_REDIRECT_URIS: http://localhost:4173/login?noAuto=1
ISSUER_HOST: oidc:3000
env:
DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public"
TEST_DATABASE_URL: "postgresql://postgres:1234@postgres:5432/test?schema=public"
KEYCLOAK_ISSUER: http://oidc:3000
KEYCLOAK_LOGOUT: http://oidc:3000/session/end
steps:
- name: 👁️ Checkout repository
uses: actions/checkout@v4
- name: Test
run: |
curl http://oidc:3000/.well-known/openid-configuration || sleep 1000
# - name: 📦 pnpm install
# run: |
# pnpm install
# cp .env.test .env
# - name: 🧐 lint
# run: |
# npm run check
# npm run lint
# - name: 🧪 Unit test
# run: npm run test:unit
# - name: 🧪 Integration test
# run: |
# npx prisma migrate reset --force
# npm run test:integration
# - name: 👨‍🔬 E2E test
# run: |
# npx playwright install --with-deps
# npm run build
# npm run test:e2e
release:
runs-on: cimaster-latest
needs: test
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
# if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: 👁️ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 pnpm install
run: pnpm install
- name: ⚒️ Build web application
run: npm run build
- name: 🐋 Build docker image
uses: https://code.thetadev.de/ThetaDev/action-kaniko@v1
with:
image: thetadev256/visitenbuch
username: thetadev256
password: ${{ secrets.DOCKER_TOKEN }}
tag: ${{ github.ref_name }}
tag_with_latest: ${{ startsWith(github.ref, 'refs/tags/v') }}
platforms: "linux/amd64,linux/arm64"
- name: Get changelog
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
{
echo 'CHANGELOG<<END_OF_FILE'
git show -s --format=%N "${{ github.ref }}" | tail -n +4 | awk 'BEGIN{RS="-----BEGIN PGP SIGNATURE-----"} NR==1{printf $0}'
echo END_OF_FILE
} >> "$GITHUB_ENV"
- name: 🎉 Publish release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: https://gitea.com/actions/release-action@main
with:
title: "Visitenbuch ${{ github.ref_name }}"
body: "${{ env.CHANGELOG }}"
- name: 🚀 Deploy to server
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
curl -s -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update