asxpio/.forgejo/workflows/test.yaml
Sergei Poljanski 9485b6b72a
All checks were successful
Build and Deploy to Production / build (push) Successful in 1m2s
Tests / test (push) Successful in 1m1s
Build and Deploy to Production / deploy (push) Successful in 26s
ci: drop git install — image ships git-minimal, full git conflicts
2026-07-02 18:09:39 +04:00

46 lines
1.4 KiB
YAML

name: Tests
on:
push:
branches:
- '**'
jobs:
test:
runs-on: nix-latest
services:
# CI stand-in for bin/test's ephemeral Postgres: the nix container runs
# as root and initdb refuses to run as root, so the DB lives in a
# service container instead and the suite connects via TEST_DATABASE_URL.
# Job and service share the per-workflow bridge network (the runner's
# container.network must stay "" — with "host" the service network is
# never created and services fail to start).
postgres:
image: postgres:17-alpine
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: asxpio_test
steps:
- name: Prepare container for actions
run: |
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
# node for JS actions (checkout); git-minimal is already in the image
nix-env -iA nixpkgs.nodejs_22
- name: Checkout
uses: actions/checkout@v4
- name: Wait for Postgres
run: |
for i in $(seq 1 30); do
nix develop -c pg_isready -h postgres -U postgres && exit 0
sleep 2
done
echo "Postgres service never became ready" >&2
exit 1
- name: Run test suite
env:
TEST_DATABASE_URL: postgres://postgres@postgres:5432/asxpio_test
run: nix develop -c bundle exec rake test