You've already forked testing-go-code-with-postgres
mirror of
https://github.com/xorcare/testing-go-code-with-postgres.git
synced 2025-06-30 23:23:40 +02:00
79 lines
1.9 KiB
YAML
79 lines
1.9 KiB
YAML
---
|
|
name: Go
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.22.0
|
|
|
|
- name: Check that all packages are compiling
|
|
run: make build
|
|
|
|
- name: Check that all integration tests are labeled
|
|
run: make test-short
|
|
|
|
- name: Setup test environment
|
|
run: make test-env-up
|
|
|
|
- name: Run all test
|
|
run: make test
|
|
|
|
- name: Teardown test environment
|
|
run: make test-env-down
|
|
|
|
- name: Upload coverage reports to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
# Check actuality of go.mod and go.sum
|
|
#
|
|
# See https://xorcare.ru/s/8dd13
|
|
check-go-modules:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.22.0
|
|
|
|
- name: Check actuality of go.mod and go.sum
|
|
run: |
|
|
go mod tidy
|
|
git diff --exit-code && exit 0 || true
|
|
echo '######################################################################'
|
|
echo
|
|
echo "ERROR: go.mod or go.sum is different from the committed version"
|
|
echo "Try using 'go mod tidy' to fix the go.mod and go.sum files"
|
|
echo "Also, don't forget to commit and push changes"
|
|
echo
|
|
echo '######################################################################'
|
|
exit 1
|
|
|
|
golangci:
|
|
name: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.22.0
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: v1.55.2
|