Add formatting query argument to list API (#251) #466
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test_unit_dbs: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
matrix: | |
database: [ 'postgres', 'sqlite' ] | |
env: | |
DB_TYPE: ${{ matrix.database }} | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
SQLITE_FILE: gh_actions.sqlite | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.23 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Test | |
run: | | |
for run in 1 2; do # run test twice to ensure that also test state clearing runs properly | |
echo "Test run $run" | |
# count param in following commands makes Go not cache the runs. | |
go test -count=1 -p 1 ./... -coverprofile coverage.${{ matrix.database }}.out -coverpkg=./... | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report-${{ matrix.database }} | |
path: ./*.out | |
if-no-files-found: error | |
coverage_report: | |
name: Coverage report | |
needs: [test_unit_dbs] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.23 | |
id: go | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report-sqlite | |
path: ./ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report-postgres | |
path: ./ | |
- name: Combine single reports | |
run: | | |
echo "mode: set" > coverage.out | |
sed -i -e '1d' coverage.*.out # remove first line from db cov reports | |
cat coverage.*.out >> coverage.out | |
- name: Coverage report | |
run: go tool cover -func=coverage.out |