chore(deps): pin [email protected] #3
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
# SPDX-FileCopyrightText: 2023 Siemens AG | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# Author: Michael Adler <[email protected]> | |
--- | |
name: CI | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- uses: korandoru/setup-zig@v1 | |
with: | |
zig-version: 0.10.1 | |
- run: | | |
# goreleaser requires an absolute path to the compiler | |
install -m0755 .ci/zcc /usr/local/bin/zcc | |
- name: build wfx | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: build --clean --single-target --snapshot | |
env: | |
CC: /usr/local/bin/zcc | |
- name: build plugins and contrib | |
run: make -s plugins contrib | |
- name: build for Windows | |
# even though not officially supported, we want it at least to compile successfully | |
run: make -s default plugins | |
env: | |
CC: /usr/local/bin/zcc | |
GOOS: windows | |
GOARCH: amd64 | |
test: | |
runs-on: ubuntu-latest | |
name: Test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
test-postgres: | |
runs-on: ubuntu-latest | |
name: Test PostgreSQL | |
container: golang:latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
# see https://hub.docker.com/_/postgres | |
POSTGRES_HOST: postgres | |
POSTGRES_PORT: 5432 | |
POSTGRES_DB: wfx | |
POSTGRES_USER: wfx | |
POSTGRES_PASSWORD: secret | |
POSTGRES_HOST_AUTH_METHOD: trust | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 3s | |
--health-timeout 5s | |
--health-retries 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: go test -timeout 180s -race -coverprofile=coverage.out -covermode=atomic -tags testing,integration,postgres,sqlite,plugin ./... | |
env: | |
PGHOST: postgres | |
PGPORT: 5432 | |
PGDATABASE: wfx | |
PGUSER: wfx | |
PGPASSWORD: secret | |
PGSSLMODE: disable | |
- name: Upload coverage to Codecov | |
# note: v4 is buggy and fails to upload this report | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
test-mysql: | |
runs-on: ubuntu-latest | |
name: Test MySQL | |
container: golang:latest | |
services: | |
mysql: | |
image: mysql:8-debian | |
env: | |
# see https://hub.docker.com/_/mysql | |
MYSQL_DATABASE: wfx | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: wfx | |
MYSQL_PASSWORD: secret | |
MYSQL_HOST: mysql | |
# Set health checks to wait until mysql has started | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval 3s | |
--health-timeout 5s | |
--health-retries 20 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: go test -timeout 180s -race -coverprofile=coverage.out -covermode=atomic -tags testing,integration,mysql,sqlite,plugin ./... | |
env: | |
MYSQL_DATABASE: wfx | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: wfx | |
MYSQL_PASSWORD: secret | |
MYSQL_HOST: mysql | |
- name: Upload coverage to Codecov | |
# note: v4 is buggy and fails to upload this report | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
cli-tests: | |
name: CLI Tests | |
runs-on: ubuntu-latest | |
container: debian:testing-slim | |
services: | |
mysql: | |
image: mysql:8-debian | |
env: | |
# see https://hub.docker.com/_/mysql | |
MYSQL_DATABASE: wfx | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: wfx | |
MYSQL_PASSWORD: secret | |
MYSQL_HOST: mysql | |
# Set health checks to wait until mysql has started | |
options: >- | |
--health-cmd="mysqladmin ping --silent" | |
--health-interval 3s | |
--health-timeout 5s | |
--health-retries 20 | |
postgres: | |
image: postgres:15 | |
env: | |
# see https://hub.docker.com/_/postgres | |
POSTGRES_HOST: postgres | |
POSTGRES_PORT: 5432 | |
POSTGRES_DB: wfx | |
POSTGRES_USER: wfx | |
POSTGRES_PASSWORD: secret | |
POSTGRES_HOST_AUTH_METHOD: trust | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 3s | |
--health-timeout 5s | |
--health-retries 20 | |
steps: | |
- name: Install packages | |
run: apt-get update -q && apt-get install -y --no-install-recommends bats make gcc libc6-dev golang git curl openssl jq systemd ca-certificates procps | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- name: Disable git security features | |
run: git config --global safe.directory '*' | |
- name: build wfx | |
run: make | |
- name: install wfx | |
run: make install | |
- name: run tests | |
env: | |
PGHOST: postgres | |
PGPORT: 5432 | |
PGUSER: wfx | |
PGPASSWORD: secret | |
PGDATABASE: wfx | |
MYSQL_DATABASE: wfx | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_USER: wfx | |
MYSQL_PASSWORD: secret | |
MYSQL_HOST: mysql | |
working-directory: test | |
run: bats . | |
lint: | |
runs-on: ubuntu-latest | |
name: Lint | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- uses: dominikh/[email protected] | |
with: | |
install-go: false | |
build-tags: sqlite,testing,plugin | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: latest | |
args: --build-tags=sqlite,testing,plugin | |
skip-cache: true | |
generate: | |
name: Generate Code | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux | |
steps: | |
- name: Install packages | |
run: pacman -Syu --noconfirm python-yaml git just flatbuffers go-swagger gofumpt | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "<1.22.0" | |
- uses: actions/checkout@v4 | |
- name: Disable git security features | |
run: git config --global safe.directory '*' | |
- uses: brokeyourbike/go-mockery-action@v0 | |
with: | |
mockery-version: "2.40.2" | |
- run: just generate | |
- run: git diff --exit-code |