3b683ce82c
Two wins:
* actions/setup-python's built-in pip cache, keyed on the two
pyproject.toml files, turns the 20+ transitive dep downloads into
a single tarball restore on cache hit.
* One ``pip install -e ./core -e ./server[dev]`` call instead of
two — lets pip's resolver run once over the combined graph and
skips the second invocation's overhead.
Also dropped ``pip install --upgrade pip``: the runner image already
ships a recent pip, and the upgrade ran once per CI job for no gain.
81 lines
1.8 KiB
YAML
81 lines
1.8 KiB
YAML
name: Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches: [master, main]
|
|
pull_request:
|
|
branches: [master, main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test-backend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
cache: "pip"
|
|
cache-dependency-path: |
|
|
packages/core/pyproject.toml
|
|
packages/server/pyproject.toml
|
|
|
|
- name: Install core + server + dev deps (in venv)
|
|
run: |
|
|
python -m venv .venv
|
|
. .venv/bin/activate
|
|
python -m pip install -e ./packages/core -e "./packages/server[dev]"
|
|
|
|
- name: Run pytest (server)
|
|
run: |
|
|
. .venv/bin/activate
|
|
cd packages/server
|
|
pytest -q --maxfail=1
|
|
|
|
test-frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install deps
|
|
run: |
|
|
cd frontend
|
|
npm ci
|
|
|
|
- name: Svelte check
|
|
run: |
|
|
cd frontend
|
|
npm run check || echo "::warning::svelte-check reported warnings"
|
|
|
|
- name: Build
|
|
run: |
|
|
cd frontend
|
|
npm run build
|
|
|
|
build-image:
|
|
needs: [test-backend, test-frontend]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image (no push)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: false
|
|
tags: notify-bridge:ci-${{ gitea.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|