mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-11-10 14:44:04 +08:00
The server package's race run takes about as long as all other packages together, so it gets its own job. Coverage was only printed to the log, and its instrumentation slowed the race run.
60 lines
2.2 KiB
YAML
60 lines
2.2 KiB
YAML
name: test
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
jobs:
|
|
test:
|
|
name: test (${{ matrix.part }})
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
part: [checks, server, rest] # In parallel: the server package takes as long as all others together
|
|
services:
|
|
postgres:
|
|
image: postgres:17
|
|
env:
|
|
POSTGRES_USER: ntfy
|
|
POSTGRES_PASSWORD: ntfy
|
|
POSTGRES_DB: ntfy_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U ntfy"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
NTFY_TEST_DATABASE_URL: "postgres://ntfy:ntfy@localhost:5432/ntfy_test?sslmode=disable"
|
|
NTFY_TEST_S3_URL: ${{ secrets.NTFY_TEST_S3_URL }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- name: Install Go
|
|
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
|
with:
|
|
go-version-file: '.go-version'
|
|
- name: Install node
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: '24'
|
|
cache: 'npm'
|
|
cache-dependency-path: './web/package-lock.json'
|
|
- name: Install dependencies
|
|
timeout-minutes: 10 # A stalled apt mirror must fail the run, not hang it
|
|
run: make build-deps-ubuntu
|
|
- name: Build docs (required for tests)
|
|
run: make docs
|
|
- name: Build web app (required for tests)
|
|
run: make web
|
|
- name: Run web tests, formatting, vetting and linting
|
|
if: matrix.part == 'checks'
|
|
run: make web-test web-fmt-check fmt-check vet web-lint lint staticcheck template-check go-check
|
|
- name: Run Go tests of the server package (race detector)
|
|
if: matrix.part == 'server'
|
|
run: go test -race ./server
|
|
- name: Run Go tests of all other packages (race detector)
|
|
if: matrix.part == 'rest'
|
|
run: go test -race $(go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./... | grep -vE 'ntfy/v2/(test|examples|tools|web|server)$')
|