Skip to content

Merge pull request #68 from fraenky8/add-mysql9 #193

Merge pull request #68 from fraenky8/add-mysql9

Merge pull request #68 from fraenky8/add-mysql9 #193

Workflow file for this run

name: Lint-Build-Test
on:
push:
# Run on all branches but not on tags.
# https://github.com/orgs/community/discussions/25615
branches:
- "**"
tags:
- "!**"
workflow_dispatch:
permissions:
contents: read
# We limit the concurrent runs of this workflow on per branch (ref) level.
# https://docs.github.com/en/enterprise-cloud@latest/actions/using-jobs/using-concurrency#example-using-concurrency-and-the-default-behavior
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# This is the golangci-lint version we use.
#
# Take a look at the official docs to check if there is a newer version
# available:
#
# https://github.com/golangci/golangci-lint/releases
#
GOLANGCI_LINT_VERSION: "v2.11.4"
jobs:
checks-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Check gofmt
run: |
files=$(go fmt -mod=vendor ./...)
[ -z "$files" ] && exit 0
echo "Files not formatted:"
echo
for f in $files; do
echo " $f"
done
exit 1
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
# Directly taken from https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: Check Github workflow files
shell: bash
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color -shellcheck=""
build-test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build tables-to-go
run: |
go build -v -mod=vendor .
- name: Run unit tests
shell: bash
run: |
go test -v -mod=vendor -race ./...
# Run integration tests and coverage only on ubuntu-latest.
#
# Because there is no docker installed on MacOS, see here
# https://github.community/t5/GitHub-Actions/Why-is-Docker-not-installed-on-macOS/td-p/39364
#
# And on Windows we get this error:
#
# vendor\github.com\ory\dockertest\docker\pkg\system\filesys_windows.go:113:24:
# cannot use uintptr(unsafe.Pointer(&sd[0])) (type uintptr) as type *"golang.org/x/sys/windows".SECURITY_DESCRIPTOR in assignment
#
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run integration tests
run: |
go test -v -mod=vendor -race -tags=integration ./internal/integration_tests/...
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run all tests with coverage
run: |
go test -v -mod=vendor -tags=integration -covermode=atomic -coverpkg=./... -coverprofile=coverage.txt ./...
- name: Upload Coverage
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}