flake reorg, nix integration testing

This commit is contained in:
Robin Appelman 2024-12-24 15:52:24 +01:00
commit 5cfd70d583
14 changed files with 3221 additions and 145 deletions

32
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: "CI"
on:
pull_request:
push:
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- id: set-matrix
run: echo "matrix={\"check\":$(nix eval --json '.#checks.x86_64-linux' --apply 'builtins.attrNames')}" | tee -a $GITHUB_OUTPUT
checks:
runs-on: ubuntu-latest
needs: [matrix]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
name: ${{ matrix.check }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v26
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build .#checks.x86_64-linux.${{ matrix.check }}

View file

@ -1,72 +0,0 @@
on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
with:
command: check
test:
runs-on: ubuntu-latest
name: Tests
services:
api-test-db:
image: demostf/db
env:
POSTGRES_PASSWORD: test
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports:
- 5432:5432
api:
image: demostf/api
env:
DEMO_ROOT: /demos
DEMO_HOST: localhost
DB_TYPE: pgsql
DB_HOST: api-test-db
DB_PORT: 5432
DB_DATABASE: postgres
DB_USERNAME: postgres
DB_PASSWORD: test
APP_ROOT: https://api.localhost
EDIT_SECRET: edit
volumes:
- /tmp:/demos
api-test:
image: demostf/api-nginx-test
env:
POSTGRES_PASSWORD: test
ports:
- 80:80
volumes:
- /tmp:/demos
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/cargo@v1
env:
DB_URL: postgres://postgres:test@localhost/postgres
API_ROOT: http://localhost/
with:
command: test
args: -- --test-threads 1
- name: logs
uses: jwalton/gh-docker-logs@v1
if: failure()