Skip to content

Commit 24ac8ed

Browse files
committed
chore: add Dependabot configuration and enhance CI workflows
- Introduced a new Dependabot configuration file to automate dependency updates for GitHub Actions, Python packages, Docker images, and Docusaurus site dependencies. - Updated CI workflows to include additional timeout settings for various jobs, ensuring better resource management during execution. - Enhanced the Docker publish workflow with image scanning and SBOM generation steps for improved security and compliance. - Refined the CI workflow to utilize matrix strategies for Python testing across multiple versions, enhancing compatibility checks.
1 parent ef53386 commit 24ac8ed

9 files changed

Lines changed: 310 additions & 145 deletions

File tree

.github/dependabot.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
version: 2
2+
3+
updates:
4+
# GitHub Actions used by workflows in .github/workflows.
5+
# Dependabot will update the SHA pin and the trailing `# vX.Y.Z` comment together.
6+
- package-ecosystem: github-actions
7+
directory: "/"
8+
schedule:
9+
interval: weekly
10+
day: monday
11+
time: "06:00"
12+
timezone: Europe/Zurich
13+
open-pull-requests-limit: 10
14+
groups:
15+
actions-minor-patch:
16+
update-types:
17+
- minor
18+
- patch
19+
commit-message:
20+
prefix: ci
21+
include: scope
22+
labels:
23+
- dependencies
24+
- github-actions
25+
26+
# Python dependencies declared in pyproject.toml (project + dependency-groups).
27+
- package-ecosystem: pip
28+
directory: "/"
29+
schedule:
30+
interval: weekly
31+
day: monday
32+
time: "06:00"
33+
timezone: Europe/Zurich
34+
open-pull-requests-limit: 10
35+
groups:
36+
python-minor-patch:
37+
update-types:
38+
- minor
39+
- patch
40+
commit-message:
41+
prefix: deps
42+
include: scope
43+
labels:
44+
- dependencies
45+
- python
46+
47+
# Docker base images used by built artefacts and the devcontainer.
48+
# Compose service images (infra/services/**) use docker-compose, handled below.
49+
- package-ecosystem: docker
50+
directories:
51+
- "/tools/images"
52+
- "/.devcontainer"
53+
schedule:
54+
interval: weekly
55+
day: monday
56+
time: "06:00"
57+
timezone: Europe/Zurich
58+
open-pull-requests-limit: 5
59+
commit-message:
60+
prefix: deps(docker)
61+
include: scope
62+
labels:
63+
- dependencies
64+
- docker
65+
66+
# Compose-managed images for the local services stack.
67+
- package-ecosystem: docker-compose
68+
directories:
69+
- "/infra/compose"
70+
- "/infra/services/oxigraph"
71+
- "/infra/services/grimoirelab"
72+
- "/infra/services/sparql-proxy"
73+
- "/infra/services/neo4j"
74+
- "/infra/services/portainer"
75+
schedule:
76+
interval: weekly
77+
day: monday
78+
time: "06:00"
79+
timezone: Europe/Zurich
80+
open-pull-requests-limit: 5
81+
commit-message:
82+
prefix: deps(compose)
83+
include: scope
84+
labels:
85+
- dependencies
86+
- docker
87+
88+
# Docusaurus site dependencies.
89+
- package-ecosystem: npm
90+
directory: "/docs-site"
91+
schedule:
92+
interval: weekly
93+
day: monday
94+
time: "06:00"
95+
timezone: Europe/Zurich
96+
open-pull-requests-limit: 5
97+
groups:
98+
npm-minor-patch:
99+
update-types:
100+
- minor
101+
- patch
102+
commit-message:
103+
prefix: deps(docs)
104+
include: scope
105+
labels:
106+
- dependencies
107+
- docs

.github/workflows/ci.yml

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
- "**/*.yml"
1414
- "**/*.yaml"
1515
- "**/*.sh"
16+
- ".pre-commit-config.yaml"
17+
- ".yamllint"
18+
- ".markdownlint.jsonc"
1619
push:
1720
branches:
1821
- main
@@ -28,26 +31,34 @@ on:
2831
- "**/*.yml"
2932
- "**/*.yaml"
3033
- "**/*.sh"
34+
- ".pre-commit-config.yaml"
35+
- ".yamllint"
36+
- ".markdownlint.jsonc"
3137

3238
permissions:
3339
contents: read
3440
pull-requests: read
3541

3642
concurrency:
37-
group: ci-baseline-${{ github.workflow }}-${{ github.ref }}
43+
group: ci-baseline-${{ github.ref }}
3844
cancel-in-progress: true
3945

4046
env:
4147
# Force JS actions onto Node 24 ahead of the June 2026 GHA default flip.
48+
# Several third-party actions still target Node 20; remove this once the
49+
# ecosystem fully catches up.
4250
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
51+
# Pin pre-commit so CI matches what devs run locally. Bump alongside
52+
# repo conventions.
53+
PRE_COMMIT_VERSION: "4.5.1"
4354

4455
jobs:
4556
changes:
4657
name: Detect changed scopes
4758
runs-on: ubuntu-latest
59+
timeout-minutes: 5
4860
outputs:
4961
src: ${{ steps.filter.outputs.src }}
50-
yaml: ${{ steps.filter.outputs.yaml }}
5162
markdown: ${{ steps.filter.outputs.markdown }}
5263
markdown_files: ${{ steps.filter.outputs.markdown_files }}
5364
shell: ${{ steps.filter.outputs.shell }}
@@ -59,7 +70,7 @@ jobs:
5970

6071
- name: Evaluate changed paths
6172
id: filter
62-
uses: dorny/paths-filter@v3
73+
uses: dorny/paths-filter@6852f92c20ea7fd3b0c25de3b5112db3a98da050 # v3
6374
with:
6475
token: ""
6576
list-files: csv
@@ -70,10 +81,6 @@ jobs:
7081
- "pyproject.toml"
7182
- "uv.lock"
7283
- ".github/workflows/ci.yml"
73-
yaml:
74-
- "**/*.yml"
75-
- "**/*.yaml"
76-
- ".github/workflows/ci.yml"
7784
markdown:
7885
- "**/*.md"
7986
shell:
@@ -83,6 +90,7 @@ jobs:
8390
pre-commit-quality-gates:
8491
name: Pre-commit quality gates
8592
runs-on: ubuntu-latest
93+
timeout-minutes: 10
8694
steps:
8795
- name: Checkout repository
8896
uses: actions/checkout@v5
@@ -91,57 +99,77 @@ jobs:
9199
uses: actions/setup-python@v6
92100
with:
93101
python-version: "3.11"
102+
cache: pip
103+
104+
- name: Cache pre-commit environments
105+
uses: actions/cache@v4
106+
with:
107+
path: ~/.cache/pre-commit
108+
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
109+
restore-keys: |
110+
pre-commit-${{ runner.os }}-
94111
95112
- name: Install pre-commit
96-
run: python -m pip install pre-commit
113+
run: python -m pip install "pre-commit==${{ env.PRE_COMMIT_VERSION }}"
97114

98115
- name: Run pre-commit hooks
99-
run: pre-commit run --all-files
116+
run: pre-commit run --all-files --show-diff-on-failure
100117

101-
python-lint-and-test:
102-
name: Python lint and tests (src)
118+
python-tests:
119+
name: Python tests (${{ matrix.python-version }})
103120
runs-on: ubuntu-latest
121+
timeout-minutes: 15
104122
needs: changes
105123
if: needs.changes.outputs.src == 'true'
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
python-version: ["3.11", "3.12", "3.13"]
106128
steps:
107129
- name: Checkout repository
108130
uses: actions/checkout@v5
109131

110132
- name: Set up Python
111133
uses: actions/setup-python@v6
112134
with:
113-
python-version: "3.11"
135+
python-version: ${{ matrix.python-version }}
114136

115137
- name: Set up uv
116-
uses: astral-sh/setup-uv@v5
138+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
139+
with:
140+
enable-cache: true
141+
cache-dependency-glob: "**/uv.lock"
117142

118143
- name: Install dependencies
119-
run: uv sync --group dev --group test
144+
run: |
145+
uv sync --group dev --group test
146+
uv pip install pytest-cov
120147
121-
- name: Run Ruff
122-
run: uv run ruff check src/
148+
- name: Run pytest with coverage
149+
run: |
150+
uv run pytest -q \
151+
--cov=src --cov-report=term-missing --cov-report=xml
123152
124-
- name: Run pytest
125-
run: uv run pytest -q
153+
- name: Upload coverage XML
154+
if: always()
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: coverage-${{ matrix.python-version }}
158+
path: coverage.xml
159+
if-no-files-found: warn
126160

127-
yaml-and-markdown-validation:
128-
name: YAML and Markdown validation
161+
markdown-validation:
162+
name: Markdown validation
129163
runs-on: ubuntu-latest
164+
timeout-minutes: 5
130165
needs: changes
131-
if: needs.changes.outputs.yaml == 'true' || needs.changes.outputs.markdown == 'true'
166+
if: needs.changes.outputs.markdown == 'true'
132167
steps:
133168
- name: Checkout repository
134169
uses: actions/checkout@v5
135170

136-
- name: Lint YAML
137-
if: needs.changes.outputs.yaml == 'true'
138-
uses: ibiqlik/action-yamllint@v3
139-
with:
140-
config_file: .yamllint
141-
142171
- name: Lint Markdown
143-
if: needs.changes.outputs.markdown == 'true'
144-
uses: DavidAnson/markdownlint-cli2-action@v20
172+
uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20
145173
with:
146174
config: .markdownlint.jsonc
147175
globs: ${{ needs.changes.outputs.markdown_files }}
@@ -150,6 +178,7 @@ jobs:
150178
shell-script-sanity:
151179
name: Shell script sanity
152180
runs-on: ubuntu-latest
181+
timeout-minutes: 5
153182
needs: changes
154183
if: needs.changes.outputs.shell == 'true'
155184
steps:

.github/workflows/codeql.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
schedule:
13+
# Weekly scan to catch newly published rules even when the branch is quiet.
14+
- cron: "0 6 * * 1"
15+
16+
permissions:
17+
contents: read
18+
security-events: write
19+
actions: read
20+
21+
concurrency:
22+
group: codeql-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
env:
26+
# Force JS actions onto Node 24 ahead of the June 2026 GHA default flip.
27+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
28+
29+
jobs:
30+
analyze:
31+
name: Analyze (${{ matrix.language }})
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 30
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
language:
38+
- python
39+
- javascript-typescript
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v5
43+
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v3
46+
with:
47+
languages: ${{ matrix.language }}
48+
queries: security-extended
49+
50+
- name: Autobuild
51+
uses: github/codeql-action/autobuild@v3
52+
53+
- name: Perform CodeQL analysis
54+
uses: github/codeql-action/analyze@v3
55+
with:
56+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)