Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .github/workflows/actions.yml

This file was deleted.

44 changes: 13 additions & 31 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
name: CHANGELOG related checks per pull requests
name: CHANGELOG related checks per pull request

on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
merge_group:
types: [checks_requested]
branches: [main, master]

jobs:
check-changelog:
name: Check changelog action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: tarides/changelog-check-action@v4
with:
changelog: CHANGELOG.md
permissions:
contents: read

check-changelog-commit:
name: Check changelog is in dedicated commit
jobs:
changelog-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Verify CHANGELOG.md changes are in own commit
run: >
.github/scripts/check-changelog-commit.sh
"${{ github.event.pull_request.base.sha }}"
persist-credentials: false

shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install shellcheck
run: sudo apt-get install -y shellcheck
- name: Run shellcheck
run: make lint-shell
- name: Check changelog commits
env:
BASE_REF: ${{ github.base_ref }}
run: .github/scripts/check-changelog-commit.sh "origin/${BASE_REF}"
62 changes: 41 additions & 21 deletions .github/workflows/ci-per-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI per commit

on:
push:
branches:
Expand All @@ -8,24 +9,35 @@ on:
branches:
- main

permissions:
contents: read

jobs:
check-label:
name: Check for ci:per-commit label
name: Check ci:per-commit label
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
has_label: ${{ steps.check.outputs.has_label }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check for label
id: check
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}
LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: |
.github/scripts/check-ci-per-commit-label.sh \
"${{ github.event_name }}" \
"${{ github.repository }}" \
"${{ github.sha }}" \
'${{ toJSON(github.event.pull_request.labels.*.name) }}' \
"$EVENT_NAME" \
"$REPOSITORY" \
"$SHA" \
"$LABELS" \
>> "$GITHUB_OUTPUT"

ci-per-commit:
Expand All @@ -34,32 +46,40 @@ jobs:
if: needs.check-label.outputs.has_label == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@v7
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.13"
- name: Install GNU sed (macOS)
if: runner.os == 'macOS'
run: brew install gnu-sed

- name: Determine commit range
id: range
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PUSH_BEFORE: ${{ github.event.before }}
PUSH_SHA: ${{ github.sha }}
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
if [ "$EVENT_NAME" = "pull_request" ]; then
BASE="$PR_BASE_SHA"
HEAD="$PR_HEAD_SHA"
else
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
BASE="$PUSH_BEFORE"
HEAD="$PUSH_SHA"
fi
echo "base=${BASE}" >> "$GITHUB_OUTPUT"
echo "head=${HEAD}" >> "$GITHUB_OUTPUT"

- name: Run CI on each commit
run: |
.github/scripts/run-ci-per-commit.sh \
"${{ steps.range.outputs.base }}" \
"${{ steps.range.outputs.head }}"
env:
BASE: ${{ steps.range.outputs.base }}
HEAD: ${{ steps.range.outputs.head }}
run: .github/scripts/run-ci-per-commit.sh "$BASE" "$HEAD"
146 changes: 146 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.13"

- name: Install dependencies
run: make setup

- name: Check formatting
run: make check-format

- name: Lint
run: make lint

- name: Check trailing whitespace
run: make check-trailing-whitespace

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.13"

- name: Install dependencies
run: make setup

- name: Type check
run: make typecheck

test:
runs-on: ubuntu-latest
needs: [lint, typecheck]
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: make setup

- name: Run tests
run: make test

coverage:
runs-on: ubuntu-latest
needs: [lint, typecheck]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.13"

- name: Install dependencies
run: make setup

- name: Run tests with coverage
run: make coverage

- name: Upload coverage report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage
path: coverage.xml

audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: "3.13"

- name: Install dependencies
run: make setup

- name: Audit dependencies for known vulnerabilities
run: make audit

secret-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Scan for secrets (TruffleHog)
uses: trufflesecurity/trufflehog@6f3c981e7b77f235fd2702dd74af25fc4b72bf11 # v3.96.0
with:
extra_args: --only-verified
Loading
Loading