name: CI on: push: branches: [main] pull_request: jobs: go: name: Go (api) runs-on: ubuntu-latest defaults: run: working-directory: api services: postgres: image: postgres:16-alpine env: POSTGRES_USER: opengoods POSTGRES_PASSWORD: opengoods POSTGRES_DB: opengoods options: >- --health-cmd "pg_isready -U opengoods" --health-interval 5s --health-timeout 5s --health-retries 10 env: OPENGOODS_DATABASE_URL: postgres://opengoods:opengoods@postgres:5432/opengoods?sslmode=disable steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.23" cache-dependency-path: api/go.sum - name: Apply migrations working-directory: . run: | go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.1 migrate -path migrations -database "$OPENGOODS_DATABASE_URL" up - name: Verify gofmt run: test -z "$(gofmt -l .)" - run: go vet ./... - run: go build ./... - run: go test ./... python: name: Python (ingestion) runs-on: ubuntu-latest container: image: nikolaik/python-nodejs:python3.12-nodejs20 defaults: run: working-directory: ingestion steps: - uses: actions/checkout@v4 - name: Install run: pip install -e ".[dev]" - name: Ruff lint run: ruff check . - name: Ruff format check run: ruff format --check . - name: Pytest run: pytest -q migrations: name: Migrations (postgres) runs-on: ubuntu-latest services: postgres: image: postgres:16-alpine env: POSTGRES_USER: opengoods POSTGRES_PASSWORD: opengoods POSTGRES_DB: opengoods options: >- --health-cmd "pg_isready -U opengoods" --health-interval 5s --health-timeout 5s --health-retries 10 env: DBURL: postgres://opengoods:opengoods@postgres:5432/opengoods?sslmode=disable steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.23" - name: Install golang-migrate run: go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.1 - name: Migrate up run: migrate -path migrations -database "$DBURL" up - name: Migrate down (reversibility) run: migrate -path migrations -database "$DBURL" down -all