Skip to content

Commit 79ab5d0

Browse files
andibeugeAndreas Beuge
andauthored
chore: add generic pipeline checks (#106)
* chore: add generic pipeline checks * chore: rename pipeline * chore: fix missing workflow * chore: rename pipeline * chore: rename * chore: add outputs * chore: remove sonsense force flag * chore: correct predicate * chore: exchange path-filters with git changes --------- Co-authored-by: Andreas Beuge <andreasbeuge@abs-bmbp.fritz.box>
1 parent b0dab8c commit 79ab5d0

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI Requirement Checks
2+
on:
3+
push:
4+
branches:
5+
- "**"
6+
workflow_call:
7+
inputs:
8+
runner:
9+
required: false
10+
description: Runner type
11+
default: ubuntu-latest
12+
type: string
13+
outputs:
14+
full_run_required:
15+
description: Whether a full pipeline run is required
16+
value: ${{ jobs.requirements.outputs.full_run_required }}
17+
test_run_required:
18+
description: Whether a test run is required
19+
value: ${{ jobs.requirements.outputs.test_run_required }}
20+
jobs:
21+
requirements:
22+
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
23+
outputs:
24+
full_run_required: ${{ steps.check_full_run_required.outputs.full_run_required }}
25+
test_run_required: ${{ steps.check_test_run_required.outputs.test_run_required }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Check full pipeline run required
32+
id: check_full_run_required
33+
run: |
34+
base="${{ github.event.before }}"
35+
if [ -z "$base" ] || [ "$base" = "0000000000000000000000000000000000000000" ]; then
36+
base="HEAD^"
37+
fi
38+
if git diff --name-only "$base" HEAD | grep -qvE '^(\.chart|\.github)/'; then
39+
echo "full_run_required=true" >> "$GITHUB_OUTPUT"
40+
else
41+
echo "full_run_required=false" >> "$GITHUB_OUTPUT"
42+
fi
43+
44+
- name: Check tests run required
45+
id: check_test_run_required
46+
uses: dorny/paths-filter@v4
47+
with:
48+
predicate-quantifier: "some"
49+
filters: |
50+
test_run_required:
51+
# Python / Django
52+
- "**.py"
53+
- "requirements*.txt"
54+
- "pyproject.toml"
55+
- "setup.cfg"
56+
- "Pipfile"
57+
- "Pipfile.lock"
58+
- "poetry.lock"
59+
- "uv.lock"
60+
- "tox.ini"
61+
- "pytest.ini"
62+
- "**.html"
63+
- "templates/**"
64+
# JavaScript / TypeScript
65+
- "**.js"
66+
- "**.jsx"
67+
- "**.ts"
68+
- "**.tsx"
69+
- "**.mjs"
70+
- "**.cjs"
71+
- "**.vue"
72+
- "**.svelte"
73+
- "package.json"
74+
- "package-lock.json"
75+
- "yarn.lock"
76+
- "pnpm-lock.yaml"
77+
- "tsconfig*.json"
78+
- "jest.config.*"
79+
- "vitest.config.*"
80+
- "babel.config.*"
81+
- "vite.config.*"
82+
- "webpack.config.*"

0 commit comments

Comments
 (0)