Skip to content

feat: obs

feat: obs #6

Workflow file for this run

name: CI
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-matrix.outputs.modules }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
run: |
MODULES=$(find . -type d \( -name ".*" -not -name "." -o -name "vendor" \) -prune -o -type f -name "go.mod" -exec dirname {} \; | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "modules=$MODULES" >> $GITHUB_OUTPUT
lint:
needs: prepare-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(needs.prepare-matrix.outputs.modules) }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: ${{ matrix.module }}/go.mod
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.3
working-directory: ${{ matrix.module }}
args: --timeout=5m
test:
name: Test
needs: [prepare-matrix, lint]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(needs.prepare-matrix.outputs.modules) }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
cache: true
go-version-file: ${{ matrix.module }}/go.mod
- name: Run tests
working-directory: ${{ matrix.module }}
run: go test -v -race ./...
dod:
name: DoD acceptance
needs: [prepare-matrix, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
cache: true
go-version-file: go.mod
- name: Run DoD acceptance tests
run: go test -race -run='TestDoD_|TestDropHeadStrategy_AtomicityOptOut|TestBudgetPipeline_RepairsStrategyOrphans|TestObserver_|TestArchitecture_' ./...
bench:
name: Benchmarks
needs: [prepare-matrix, test, dod]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: [ "." ]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
cache: true
go-version-file: go.mod
- name: Run benchmarks with alloc guardrails
run: go test -bench=. -benchmem -run='^TestBenchGuardrails_' ./...
integration:
name: Adapter integration
needs: [prepare-matrix, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
cache: true
go-version-file: go.mod
- name: Run postgres and redis adapter integration tests
env:
CI: "true"
run: go test -race -timeout 10m ./adapters/store/postgres/... ./adapters/store/redis/...