mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 10:09:05 +02:00
mixin: lint dashboards and migrate CI tasks to mise (#2608)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -25,7 +25,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
rules:
|
||||
name: Validate Prometheus rules
|
||||
name: Validate mixin rules and dashboard
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
@@ -42,20 +42,13 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Cache mixin tools
|
||||
id: tools-cache
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
- name: Install and cache pinned mixin tools
|
||||
uses: jdx/mise-action@2d8d4cafcbd33be2ea37d2b6f5ad595363d1f1ca # v5.1.1
|
||||
with:
|
||||
path: ~/go/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-mixin-tools-${{ hashFiles('contrib/mixin/Makefile', 'go.mod') }}
|
||||
|
||||
- name: Install pinned tools
|
||||
if: steps.tools-cache.outputs.cache-hit != 'true'
|
||||
run: make tools
|
||||
working_directory: contrib/mixin
|
||||
|
||||
- name: Build dashboard and check generated changes
|
||||
run: make check-dashboards
|
||||
run: mise run check-dashboards
|
||||
|
||||
- name: Lint and test rules
|
||||
run: |
|
||||
make test PROMTOOL="docker run --rm --entrypoint promtool -v \"$PWD:/mixin:ro\" -w /mixin prom/prometheus:v3.15.0"
|
||||
- name: Lint dashboard and test rules
|
||||
run: mise run test
|
||||
|
||||
@@ -44,13 +44,26 @@ jobs:
|
||||
|
||||
- name: check
|
||||
run: |
|
||||
PR_TITLE_PREFIX=$(echo "$PR_TITLE" | cut -d':' -f1)
|
||||
if [[ -d "internal/collector/$PR_TITLE_PREFIX" ]] || [[ -d "internal/$PR_TITLE_PREFIX" ]] || [[ -d "pkg/$PR_TITLE_PREFIX" ]] || [[ -d "$PR_TITLE_PREFIX" ]] || [[ "$PR_TITLE_PREFIX" == "docs" ]] || [[ "$PR_TITLE_PREFIX" == "ci" ]] || [[ "$PR_TITLE_PREFIX" == "revert" ]] || [[ "$PR_TITLE_PREFIX" == "fix" ]] || [[ "$PR_TITLE_PREFIX" == "fix(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "feat" ]] || [[ "$PR_TITLE_PREFIX" == "chore" ]] || [[ "$PR_TITLE_PREFIX" == "chore(docs)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(github-actions)" ]] || [[ "$PR_TITLE_PREFIX" == "chore(deps)" ]] || [[ "$PR_TITLE_PREFIX" == "*" ]] || [[ "$PR_TITLE_PREFIX" == "Release"* ]] || [[ "$PR_TITLE_PREFIX" == "Synchronize common files from prometheus/prometheus" ]] || [[ "$PR_TITLE_PREFIX" == "[0."* ]] || [[ "$PR_TITLE_PREFIX" == "[1."* ]]; then
|
||||
exit 0
|
||||
PR_TITLE_PREFIX="${PR_TITLE%%:*}"
|
||||
SCOPED_PREFIX_PATTERN='^([^():]+)\(.*\)(:|$)'
|
||||
if [[ "$PR_TITLE" =~ $SCOPED_PREFIX_PATTERN ]]; then
|
||||
PR_TITLE_PREFIX="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
|
||||
echo "PR title must start with an name of an collector package"
|
||||
echo "Example: 'logical_disk: description'"
|
||||
for directory in internal/collector internal pkg .; do
|
||||
if [[ -d "$directory/$PR_TITLE_PREFIX" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
case "$PR_TITLE_PREFIX" in
|
||||
docs|ci|revert|fix|feat|chore|mixin|main|'*'|Release*|'Synchronize common files from prometheus/prometheus'|'[0.'*|'[1.'*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "PR title must start with a package name or an allowed prefix, optionally followed by a scope"
|
||||
echo "Examples: 'logical_disk: description', 'mixin(dashboard): description', 'chore(github-action): description'"
|
||||
exit 1
|
||||
env:
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
|
||||
@@ -60,21 +60,13 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Cache Jsonnet tools
|
||||
id: jsonnet-cache
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
- name: Install and cache pinned mixin tools
|
||||
uses: jdx/mise-action@2d8d4cafcbd33be2ea37d2b6f5ad595363d1f1ca # v5.1.1
|
||||
with:
|
||||
path: |
|
||||
~/go/bin/jsonnet
|
||||
~/go/bin/jsonnetfmt
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-runbooks-jsonnet-${{ hashFiles('contrib/mixin/Makefile', 'go.mod') }}
|
||||
|
||||
- name: Install Jsonnet tools
|
||||
if: steps.jsonnet-cache.outputs.cache-hit != 'true'
|
||||
run: make -C contrib/mixin jsonnet-tools
|
||||
working_directory: contrib/mixin
|
||||
|
||||
- name: Check alert runbook coverage
|
||||
run: make -C contrib/mixin check-runbooks
|
||||
run: mise -C contrib/mixin run check-runbooks
|
||||
|
||||
- name: Set up Pages
|
||||
id: pages
|
||||
|
||||
Reference in New Issue
Block a user