Files
frontend-svelte/.gitea/workflows/workflow.yml
T
Ilia Mashkov b9560336d5
Workflow / build (pull_request) Successful in 1m32s
Workflow / e2e (pull_request) Successful in 2m10s
Workflow / publish (pull_request) Has been skipped
ci/cd: remove artifact, add build to e2e step
2026-05-28 16:18:25 +03:00

98 lines
2.6 KiB
YAML

name: Workflow
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '25'
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
- name: Persistent Yarn Cache
uses: actions/cache@v4
id: yarn-cache
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Build Svelte App
run: yarn build
- name: Lint
run: yarn lint
- name: Type Check
run: yarn check
- name: Run Unit Tests
run: yarn test:unit
- name: Run Component Tests
timeout-minutes: 5
run: yarn test:component --reporter=verbose --logHeapUsage
e2e:
needs: build
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.59.0-jammy
steps:
- uses: actions/checkout@v4
- name: Enable Corepack
run: |
corepack enable
corepack prepare yarn@stable --activate
- name: Persistent Yarn Cache
uses: actions/cache@v4
with:
path: .yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Build Svelte SPA
run: yarn build
- name: E2E Tests
timeout-minutes: 15
run: yarn test:e2e
publish:
# Runs if lint, unit-, component-, e2e-tests pass
needs: [build, e2e]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # Only deploy from main branch
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea Registry
run: echo "${{ secrets.CI_DEPLOY_TOKEN }}" | docker login git.allmy.work -u ${{ gitea.repository_owner }} --password-stdin
- name: Build and Push Docker Image
run: |
docker build \
-t git.allmy.work/${{ gitea.repository }}:latest \
-t git.allmy.work/${{ gitea.repository }}:${{ gitea.sha }} \
.
docker push git.allmy.work/${{ gitea.repository }}:latest
docker push git.allmy.work/${{ gitea.repository }}:${{ gitea.sha }}