Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,61 @@ env:
IMAGE_PREFIX: ${{ github.repository }}

jobs:
test-api:
name: Test API
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: sigma
POSTGRES_PASSWORD: sigma
POSTGRES_DB: sigma_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U sigma -d sigma_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10

env:
DATABASE_URL: postgres://sigma:sigma@localhost:5432/sigma_test
REDIS_URL: redis://localhost:6379

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2
with:
workspaces: sigma-api

- name: Build sigma-api (including tests)
working-directory: sigma-api
run: cargo build --tests --locked

- name: Run sigma-api tests
working-directory: sigma-api
run: cargo test -p sigma-api -- --test-threads=1

build-api:
name: Build API
runs-on: ubuntu-latest
needs: test-api
permissions:
contents: read
packages: write
Expand Down