refactor #666
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: UI | |
defaults: | |
run: | |
shell: bash -ieo pipefail {0} | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ['self-hosted', 'prima', 'Linux', 'X64'] | |
permissions: write-all | |
env: | |
DATABASE_URL: postgresql://postgres:pw@localhost:6500/prima | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Code Lint | |
run: pnpm run lint | |
- name: Svelte Check | |
run: pnpm run check | |
- name: Install Playwright Dependencies | |
run: npx playwright install | |
- name: Integration Tests | |
run: | | |
pnpm run build | |
docker compose build prima | |
docker compose up -d pg | |
sleep 5 | |
./setup-db.sh | |
npx playwright test | |
- name: Unit Tests | |
run: pnpm run test:unit | |
- name: Upload screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: screenshots/ | |
- name: Docker setup-buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Docker Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=edge | |
- name: Docker build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
deploy: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ['self-hosted', 'prima', 'Linux', 'X64'] | |
needs: build | |
steps: | |
- name: Deploy | |
run: | | |
cd /home/prima | |
docker compose pull | |
docker compose down | |
docker compose up -d |