Skip to content

Commit ce38d26

Browse files
committed
ci: add CI workflows, release config, AGENTS, RELEASES, and pre-commit
1 parent 1acb33e commit ce38d26

9 files changed

Lines changed: 423 additions & 14 deletions

File tree

.github/actionlint.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
self-hosted-runner:
2+
labels: []
3+
config-variables: null

.github/release.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
changelog:
2+
categories:
3+
- title: "Breaking Changes"
4+
labels:
5+
- breaking-change
6+
- title: "New Features"
7+
labels:
8+
- enhancement
9+
- title: "Bug Fixes"
10+
labels:
11+
- bug
12+
- title: "Documentation"
13+
labels:
14+
- documentation
15+
- title: "Maintenance"
16+
labels:
17+
- dependencies
18+
- github_actions
19+
exclude:
20+
labels:
21+
- skip-changelog

.github/workflows/actionlint.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
security-events: write
14+
15+
jobs:
16+
setup:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
ref: ${{ steps.setup.outputs.ref }}
20+
repo: ${{ steps.setup.outputs.repo }}
21+
base_sha: ${{ steps.setup.outputs.base_sha }}
22+
checkout_path: ${{ steps.setup.outputs.checkout_path }}
23+
has_changes_yaml: ${{ steps.setup.outputs.has_changes }}
24+
has_changes_md: ${{ steps.detect_md.outputs.has_changes }}
25+
steps:
26+
- name: Workflow setup (YAML relevance)
27+
id: setup
28+
uses: Framework-R-D/action-workflow-setup@f73307dd8c13cb66c2565c9ace32571517b1cea8
29+
with:
30+
file-type: yaml
31+
32+
- name: Detect Markdown changes
33+
id: detect_md
34+
# Only meaningful for pull_request events, where base_sha is populated and
35+
# a diff base exists. For push / workflow_dispatch the markdown-check job
36+
# runs unconditionally (its github.event_name != 'pull_request' arm), so
37+
# this detection step is skipped and its empty output is harmless.
38+
if: github.event_name == 'pull_request' && steps.setup.outputs.is_act != 'true'
39+
uses: Framework-R-D/action-run-change-detection@c70418d77a03191b165dd7dfebadbe00c77a03191b
40+
with:
41+
checkout-path: ${{ steps.setup.outputs.checkout_path }}
42+
ref: ${{ steps.setup.outputs.ref }}
43+
repo: ${{ steps.setup.outputs.repo }}
44+
base-ref: ${{ steps.setup.outputs.base_sha }}
45+
file-type: md
46+
47+
actionlint:
48+
needs: setup
49+
if: >
50+
always() && needs.setup.result == 'success' && (
51+
github.event_name != 'pull_request' ||
52+
needs.setup.outputs.has_changes_yaml == 'true'
53+
)
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
57+
with:
58+
ref: ${{ needs.setup.outputs.ref }}
59+
path: ${{ needs.setup.outputs.checkout_path }}
60+
repository: ${{ needs.setup.outputs.repo }}
61+
persist-credentials: false
62+
- uses: raven-actions/actionlint@205b530c5d9fa8f44ae9ed59f341a0db994aa6f8
63+
with:
64+
working-directory: ${{ needs.setup.outputs.checkout_path }}
65+
66+
yaml-check:
67+
needs: setup
68+
if: >
69+
always() && needs.setup.result == 'success' && (
70+
github.event_name != 'pull_request' ||
71+
needs.setup.outputs.has_changes_yaml == 'true'
72+
)
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
76+
with:
77+
ref: ${{ needs.setup.outputs.ref }}
78+
path: ${{ needs.setup.outputs.checkout_path }}
79+
repository: ${{ needs.setup.outputs.repo }}
80+
persist-credentials: false
81+
- name: Install uv
82+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e
83+
- name: Install yamllint
84+
run: uv tool install yamllint
85+
- name: Run yamllint
86+
working-directory: ${{ needs.setup.outputs.checkout_path }}
87+
run: yamllint .
88+
89+
markdown-check:
90+
needs: setup
91+
if: >
92+
always() && needs.setup.result == 'success' && (
93+
github.event_name != 'pull_request' ||
94+
needs.setup.outputs.has_changes_md == 'true'
95+
)
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
99+
with:
100+
ref: ${{ needs.setup.outputs.ref }}
101+
path: ${{ needs.setup.outputs.checkout_path }}
102+
repository: ${{ needs.setup.outputs.repo }}
103+
persist-credentials: false
104+
- uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e
105+
with:
106+
globs: |
107+
${{ needs.setup.outputs.checkout_path }}/**/*.md
108+
!${{ needs.setup.outputs.checkout_path }}/**/CHANGELOG.md
109+
110+
codeql:
111+
needs: setup
112+
if: >
113+
always() && needs.setup.result == 'success' && (
114+
github.event_name != 'pull_request' ||
115+
needs.setup.outputs.has_changes_yaml == 'true'
116+
)
117+
runs-on: ubuntu-latest
118+
steps:
119+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
120+
with:
121+
ref: ${{ needs.setup.outputs.ref }}
122+
path: ${{ needs.setup.outputs.checkout_path }}
123+
repository: ${{ needs.setup.outputs.repo }}
124+
persist-credentials: false
125+
- uses: github/codeql-action/init@dd903d2e4f5405488e5ef1422510ee31c8b32357
126+
with:
127+
languages: actions
128+
build-mode: none
129+
queries: security-extended
130+
source-root: ${{ needs.setup.outputs.checkout_path }}
131+
- uses: github/codeql-action/analyze@dd903d2e4f5405488e5ef1422510ee31c8b32357
132+
with:
133+
checkout_path: ${{ needs.setup.outputs.checkout_path }}

.markdownlint.jsonc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"default": true,
3+
"MD012": true,
4+
"MD013": false,
5+
"MD022": true,
6+
"MD024": {
7+
"siblings_only": true
8+
},
9+
"MD031": true,
10+
"MD032": true,
11+
"MD034": true,
12+
"MD036": {
13+
"punctuation": ",;:!?"
14+
},
15+
"MD040": true
16+
}

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: check-merge-conflict
10+
- id: check-executables-have-shebangs
11+
- id: mixed-line-ending
12+
- repo: https://github.com/rbubley/mirrors-prettier
13+
rev: v3.8.3
14+
hooks:
15+
- id: prettier
16+
types_or: [yaml]
17+
- repo: https://github.com/DavidAnson/markdownlint-cli2
18+
rev: v0.22.1
19+
hooks:
20+
- id: markdownlint-cli2
21+
args: [--fix]

.yamllint.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---extends: default
2+
3+
rules:
4+
line-length:
5+
max: 120
6+
level: warning
7+
indentation:
8+
spaces: 2
9+
comments:
10+
min-spaces-from-content: 1
11+
document-start: disable
12+
truthy:
13+
allowed-values: [true, false]
14+
trailing-spaces: enable

AGENTS.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Agent Instructions — action-detect-act-env
2+
3+
## Repository Purpose
4+
5+
"Detects if the workflow is running in the act environment"
6+
7+
This repository contains a single composite GitHub Action previously bundled
8+
within [Framework-R-D/phlex](https://github.com/Framework-R-D/phlex) and
9+
extracted for standalone reuse.
10+
11+
## Action Interface
12+
13+
**Inputs:** (table: Name | Description | Required | Default)
14+
15+
**Outputs:** (table: Name | Description)
16+
is_act:
17+
## Repository Structure
18+
19+
| Path | Purpose |
20+
| ---- | ------- |
21+
| `action.yaml` | The composite action definition |
22+
| `CHANGELOG.md` | Per-version changelog (dependabot reads this) |
23+
| `RELEASES.md` | Release procedure and checklist |
24+
| `README.md` | Usage documentation |
25+
| `LICENSE` | Apache 2.0 |
26+
| `.github/release.yaml` | Autogenerated release notes config |
27+
| `.github/workflows/ci.yaml` | CI: actionlint, YAML, Markdown, CodeQL |
28+
| `.github/dependabot.yml` | Weekly dependency updates |
29+
30+
## Development Workflow
31+
32+
- All changes via pull request to `main`.
33+
- CI runs on every PR: actionlint, YAML lint, Markdown lint, CodeQL (actions language). For generate-build-matrix: additionally ruff, mypy, and pytest.
34+
- Use prek run (or pre-commit run) before pushing to catch formatting issues locally.
35+
- Dependabot opens weekly PRs for action pin updates. They are **not** auto-merged (no auto-merge workflow is configured); review and merge them manually, or configure branch protection + an auto-merge workflow as a follow-on.
36+
37+
## Coding Standards
38+
39+
- `action.yaml`: all `uses:` references must be SHA-pinned with a `# vN` comment. Version-tag pins (e.g. `@v4`) are not acceptable.
40+
- YAML: formatted with prettier (120-char soft limit, 2-space indent).
41+
- Markdown: must pass markdownlint with the rules in `.markdownlint.jsonc`.
42+
- Python (generate-build-matrix only): ruff + mypy clean; Google-style docstrings; type hints required; tests in `tests/` with pytest.
43+
44+
## Release Procedure
45+
46+
See `RELEASES.md` for the complete step-by-step checklist.
47+
48+
## Phlex Ecosystem Context
49+
50+
This action is part of the `Framework-R-D` action ecosystem supporting the
51+
[Phlex framework](https://github.com/Framework-R-D/phlex). When releasing a new version, check whether dependent actions (those that `uses:` this action in their own `action.yaml`) also need updating. The dependency graph is:
52+
53+
Level 0 (no internal deps): detect-act-env, detect-relevant-changes, get-pr-info, setup-build-env, configure-cmake, build-cmake, collect-format-results, complete-pr-comment, generate-build-matrix, post-clang-tidy-results, handle-fix-commit
54+
Level 1 (depend on Level 0): prepare-check-outputs, prepare-fix-outputs, run-change-detection
55+
Level 2 (depends on Level 1): workflow-setup

0 commit comments

Comments
 (0)