Skip to content

Reject unknown matrix badge statuses (#30) #93

Reject unknown matrix badge statuses (#30)

Reject unknown matrix badge statuses (#30) #93

# Copyright (c) 2026 Peaceful Studio OÜ
# SPDX-License-Identifier: Apache-2.0
name: build-and-test
on:
workflow_call:
inputs:
runs-on:
description: >-
Runner label(s) for the job. Pass a plain label (e.g.
'ubuntu-latest' or 'hetzner') or a JSON array string to require
multiple labels (e.g. '["self-hosted", "hetzner"]'). When empty,
the runner defaults by repository visibility: public repos use
ubuntu-latest; private and internal repos use the self-hosted
Hetzner pool (`["self-hosted","hetzner"]`).
required: false
type: string
default: ''
push:
branches: [dev, stage, prod]
pull_request:
jobs:
resolve-runner:
name: resolve runner
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
runner: ${{ steps.pick.outputs.runner }}
steps:
- name: Checkout CI helpers
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: peacefulstudio/github-actions
ref: ${{ job.workflow_sha }}
path: .github-actions-helpers
- name: Pick runner
id: pick
env:
GH_TOKEN: ${{ github.token }}
RUNS_ON: ${{ inputs.runs-on }}
run: |
set -euo pipefail
visibility=""
if [ -z "$RUNS_ON" ]; then
visibility=$(gh api "repos/${GITHUB_REPOSITORY}" --jq '.visibility')
fi
runner=$(.github-actions-helpers/scripts/resolve-runner.sh "$RUNS_ON" "$visibility")
{
echo "runner<<__RUNNER_EOF__"
echo "$runner"
echo "__RUNNER_EOF__"
} >> "$GITHUB_OUTPUT"
build-and-test:
needs: resolve-runner
runs-on: ${{ startsWith(needs.resolve-runner.outputs.runner, '[') && fromJSON(needs.resolve-runner.outputs.runner) || needs.resolve-runner.outputs.runner }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install actionlint
env:
ACTIONLINT_VERSION: "1.7.7"
run: |
set -euo pipefail
curl -sSfL \
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
| tar xz actionlint
./actionlint -version
- name: Lint workflow files
run: ./actionlint -color
- name: Run shell script tests
run: |
set -euo pipefail
bash test/push-nuget_test.sh
bash test/normalize-ci-matrix_test.sh
bash test/install-dotnet-coverage_test.sh
- name: Run python tests
run: python3 -m unittest discover -s test -p '*_test.py'