Skip to content

chore: log action filter parameters for job events #1507

chore: log action filter parameters for job events

chore: log action filter parameters for job events #1507

Workflow file for this run

# SPDX-FileCopyrightText: 2023 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
#
# Author: Michael Adler <[email protected]>
---
name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
strategy:
matrix:
# even though Windows is not officially supported, we want it to at least compile successfully
goos: [linux, windows]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Golang caches
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: Disable git security features
run: git config --global safe.directory '*'
- run: .ci/setup-build.sh
- name: build for ${{ matrix.goos }}
run: just build
env:
GOOS: ${{ matrix.goos }}
test:
name: Test
runs-on: ubuntu-latest
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Golang caches
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: go test -race -coverprofile=coverage.out -covermode=atomic -timeout 30s --tags=testing ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
test-postgres:
runs-on: ubuntu-latest
name: Test PostgreSQL
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
services:
postgres:
image: postgres:18@sha256:1ffc019dae94eca6b09a49ca67d37398951346de3c3d0cfe23d8d4ca33da83fb
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Golang caches
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: go test -tags testing,integration,no_mysql -coverprofile=coverage.out -covermode=atomic ./...
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@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
test-mysql:
runs-on: ubuntu-latest
name: Test MySQL
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
services:
mysql:
image: mysql:8-debian@sha256:49f4fcb0087318aa1c222c7e8ceacbb541cdc457c6307d45e6ee4313f4902e33
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup Golang caches
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: go test -tags testing,integration,no_postgres -coverprofile=coverage.out -covermode=atomic ./...
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@5a1091511ad55cbe89839c7260b706298ca349f7 # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
cli-tests:
name: CLI Tests
runs-on: ubuntu-latest
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
services:
mysql:
image: mysql:8-debian@sha256:49f4fcb0087318aa1c222c7e8ceacbb541cdc457c6307d45e6ee4313f4902e33
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:18@sha256:1ffc019dae94eca6b09a49ca67d37398951346de3c3d0cfe23d8d4ca33da83fb
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
submodules: "true"
- name: Setup Golang caches
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: .ci/setup-cli-tests.sh
- name: Disable git security features
run: git config --global safe.directory '*'
- name: install wfx
run: go install .
- name: install wfxctl
run: go install ./cmd/wfxctl
- name: build plugins
run: go build -C example/plugin
- 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: export PATH=$(go env GOPATH)/bin:$PATH; bats .
lint:
runs-on: ubuntu-latest
name: Lint
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Disable git security features
run: git config --global safe.directory '*'
- run: .ci/setup-lint.sh
- run: just lint
format:
runs-on: ubuntu-latest
name: Format
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- run: .ci/setup-format.sh
- run: just format
- name: Disable git security features
run: git config --global safe.directory '*'
- run: git diff --exit-code
reuse:
runs-on: ubuntu-latest
name: Reuse
container: fsfe/reuse:6.2.0@sha256:85462a75c0f8efda09ddd190b92816b70e7662577c8427429e11e1b9f25a992e
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- run: reuse lint || true # just a warning
generate:
name: Generate Code
runs-on: ubuntu-latest
container: golang:1.25.3@sha256:6bac879c5b77e0fc9c556a5ed8920e89dab1709bd510a854903509c828f67f96
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Install packages
run: .ci/setup-generate.sh
- name: Disable git security features
run: git config --global safe.directory '*'
- run: just generate
- run: git diff --exit-code
openapi-check-breaking:
name: API check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Check for breaking changes in API
id: breaking_changes
uses: oasdiff/oasdiff-action/breaking@1c611ffb1253a72924624aa4fb662e302b3565d3 # v0.0.21
with:
base: https://raw.githubusercontent.com/siemens/wfx/refs/heads/main/spec/wfx.openapi.yml
revision: spec/wfx.openapi.yml
fail-on: ERR
release:
name: Release
if: startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write
needs:
- build
- test
- test-postgres
- test-mysql
- cli-tests
- lint
- reuse
- generate
- openapi-check-breaking
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
fetch-depth: 0
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Export Golang version as env variable
run: |
GO_VERSION=$(sed -n 's/.*container: golang:\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' .github/workflows/ci.yml | head -n1)
# You can make an environment variable available to any subsequent
# steps in a workflow job by defining or updating the environment
# variable and writing this to the GITHUB_ENV environment file.
echo "GO_VERSION=$GO_VERSION" | tee -a "$GITHUB_ENV"
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
with:
go-version: "${{ env.GO_VERSION }}"
- name: Setup build
run: sudo .ci/setup-build.sh
- name: Run GoReleaser
run: export CC="$(pwd)/.ci/zcc"; goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}