Skip to content

fix: hardcoded "Fire" tribe #99

fix: hardcoded "Fire" tribe

fix: hardcoded "Fire" tribe #99

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
inputs:
is_release:
description: "Build release artifacts"
required: false
type: boolean
default: false
version:
description: "Version to set (for release)"
required: false
type: string
permissions:
contents: read
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for GHA cache and sccache
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Patch version
if: ${{ inputs.version }}
run: |
sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' src/backend/Cargo.toml
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
if (process.env.ACTIONS_CACHE_URL) {
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL);
}
if (process.env.ACTIONS_RUNTIME_TOKEN) {
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN);
}
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src/backend -> target
cache-targets: "false"
- name: Check formatting
run: cargo fmt --all -- --check
working-directory: src/backend
- name: Clippy
run: cargo clippy -- -D warnings
working-directory: src/backend
- name: Build
run: cargo build
working-directory: src/backend
- name: Run tests
run: cargo test
working-directory: src/backend
- name: Build stub_api
run: cargo build --release --bin stub_api
working-directory: src/backend
- name: Build release binary
run: cargo build --release --bin void-eid-backend
working-directory: src/backend
- name: Upload backend binary
uses: actions/upload-artifact@v4
with:
name: backend-bin
path: src/backend/target/release/void-eid-backend
retention-days: 1
- name: Upload stub_api artifact
uses: actions/upload-artifact@v4
with:
name: stub_api
path: src/backend/target/release/stub_api
retention-days: 1
- name: Show sccache stats
run: sccache --show-stats
frontend:
name: Frontend
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # Required for GHA cache
env:
VITE_API_URL: http://localhost:5039
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Patch version
if: ${{ inputs.version }}
run: |
sed -i 's/"version": ".*"/"version": "${{ inputs.version }}"/' src/frontend/package.json
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
working-directory: src/frontend
- name: Lint
run: bun run lint
working-directory: src/frontend
- name: Build
run: bun run build
working-directory: src/frontend
- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: frontend-dist
path: src/frontend/dist
retention-days: 1
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: src/frontend
file: src/frontend/Dockerfile
build-args: |
VITE_API_URL=${{ env.VITE_API_URL }}
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
murmur:
name: Murmur
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: src/murmur
file: src/murmur/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
e2e:
name: E2E Tests (${{ matrix.project }})
needs: [backend, frontend]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
project: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v6
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
working-directory: src/frontend
- name: Download stub_api artifact
uses: actions/download-artifact@v4
with:
name: stub_api
path: src/backend/target/release
- name: Download frontend-dist artifact
uses: actions/download-artifact@v4
with:
name: frontend-dist
path: src/frontend/dist
- name: Make stub_api executable
run: chmod +x src/backend/target/release/stub_api
- name: Install Playwright browser
run: bun x playwright install --with-deps ${{ matrix.project }}
working-directory: src/frontend
- name: Run Playwright tests
run: bun x playwright test --project=${{ matrix.project }}
working-directory: src/frontend
env:
CI: true
BASE_URL: http://localhost:4173
STUB_API_CMD: ../backend/target/release/stub_api
STUB_API_PORT: "5039"
VITE_API_URL: http://localhost:5039
DATABASE_URL: "sqlite::memory:"
JWT_SECRET: ci-test-secret
FRONTEND_URL: http://localhost:4173
- name: Upload blob report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: blob-report-${{ matrix.project }}
path: src/frontend/blob-report
retention-days: 1
merge-reports:
name: Merge E2E Reports
needs: [e2e]
if: ${{ !cancelled() && needs.e2e.result != 'skipped' }}
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v6
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
working-directory: src/frontend
- name: Download all blob reports
uses: actions/download-artifact@v4
with:
path: src/frontend/all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge reports
run: bun x playwright merge-reports --reporter html ./all-blob-reports
working-directory: src/frontend
- name: Upload merged HTML report
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: src/frontend/playwright-report
retention-days: 14
push-images:
name: Push Docker Images
needs: [backend, frontend, murmur, e2e]
if: success() && (github.ref == 'refs/heads/main' || inputs.is_release)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: write # Required for GHA cache
strategy:
matrix:
service: [frontend, murmur]
include:
- service: frontend
context: src/frontend
dockerfile: src/frontend/Dockerfile
- service: murmur
context: src/murmur
dockerfile: src/murmur/Dockerfile
env:
VITE_API_URL: ""
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/void-eid-${{ matrix.service }}
tags: |
type=ref,event=branch
type=sha
type=semver,pattern={{version}},value=${{ inputs.version }},enable=${{ inputs.is_release || 'false' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VITE_API_URL=${{ env.VITE_API_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
push-backend-image:
name: Push Backend Docker Image
needs: [backend, e2e]
if: success() && (github.ref == 'refs/heads/main' || inputs.is_release)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Download backend binary
uses: actions/download-artifact@v4
with:
name: backend-bin
path: src/backend
- name: Make binary executable
run: chmod +x src/backend/void-eid-backend
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/void-eid-backend
tags: |
type=ref,event=branch
type=sha
type=semver,pattern={{version}},value=${{ inputs.version }},enable=${{ inputs.is_release || 'false' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: src/backend
file: src/backend/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}