Skip to content

go modernize (#21)

go modernize (#21) #90

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [oldstable, stable]
services:
postgres:
image: postgres:17.4
ports:
- 5444:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: go-mod-v4-${{ hashFiles('**/go.sum') }}
- name: Install Dependencies
run: go mod download
- name: Run tests
run: |
mkdir -p /tmp/test-reports
# gotestsum hash is version version v1.12.3
go run gotest.tools/gotestsum@ddd0b05a6878e2e8257a2abe6e7df66cebc53d0e --junitfile /tmp/test-reports/unit-tests.xml
make test-examples
- uses: actions/upload-artifact@v4
name: Upload test results
with:
name: test-reports-${{ matrix.go-version }}
path: /tmp/test-reports
- name: Update coverage report
uses: ncruces/go-coverage-report@v0.3.0
with:
report: true
chart: true
amend: true
if: |
matrix.go-version == 'stable'
continue-on-error: true
test-race:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [oldstable, stable]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: go-mod-v4-${{ hashFiles('**/go.sum') }}
- name: Install Dependencies
run: go mod download
- name: Run tests with race detector
run: make test-race
lint:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [oldstable, stable]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: go-mod-v4-${{ hashFiles('**/go.sum') }}
- name: Install Dependencies
run: go mod download
- name: Install tooling
run: make tooling
- name: Linting
run: make lint
- name: Running vulncheck
run: make vuln-check
fmt:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [oldstable, stable]
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: go-mod-v4-${{ hashFiles('**/go.sum') }}
- name: Install Dependencies
run: go mod download
- name: Install tooling
run: make tooling
- name: Running formatting
run: |
make fmt
make has-changes