Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ We encourage responsible disclosure practices for security vulnerabilities.

## Reporting a Vulnerability

If you believe you've found a security-related bug, fill out a new
vulnerability report via GitHub directly. To do so, follow these instructions:
If you believe you've found a security-related bug, fill out a new vulnerability report via GitHub directly. To do so,
follow these instructions:

1. Click on the `Security` tab in the project repository.
1. Click the green `Report a vulnerability` button at the top right corner.
Expand Down
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ updates:
- "*"
cooldown:
default-days: 7
- package-ecosystem: "pre-commit"
directory: "/"
labels:
- dependencies
- skip news
schedule:
interval: "weekly"
day: "tuesday"
cooldown:
default-days: 7
53 changes: 17 additions & 36 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: check
name: πŸ§ͺ check
on:
workflow_dispatch:
push:
branches: ["main"]
tags-ignore: ["**"]
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
types: [opened, synchronize, reopened]
schedule:
- cron: "0 8 * * *"
concurrency:
Expand All @@ -15,6 +15,7 @@ permissions:
contents: read
jobs:
test:
name: πŸ§ͺ Test
runs-on: ubuntu-26.04
strategy:
fail-fast: false
Expand All @@ -30,57 +31,37 @@ jobs:
- dev
- pkg_meta
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: πŸ“₯ Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Install the latest version of uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- name: 🐍 Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.15"
enable-cache: false
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install tox
- name: πŸ“¦ Install tox
run: uv tool install --python-preference only-managed --python 3.15 tox --with tox-uv
- name: Install Python
- name: 🐍 Install Python
if: startsWith(matrix.env, '3.') && matrix.env != '3.15'
run: uv python install --python-preference only-managed ${{ matrix.env }}
- name: Setup test suite
- name: πŸ“¦ Set up test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
- name: Run test suite
- name: πŸ§ͺ Run test suite
run: tox run --skip-pkg-install -e ${{ matrix.env }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
DIFF_AGAINST: HEAD
news:
name: News fragment
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip news')
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Require a changelog entry
run: |
found=0
while IFS= read -r path; do
if [[ "$path" =~ ^changelog\.d/[0-9]+\.(feature|bugfix|doc)\.md$ && -s "$path" ]]; then
found=1
fi
done < <(git diff --name-only "origin/$GITHUB_BASE_REF"...HEAD)
if (( found == 0 )); then
echo "::error::add a nonempty changelog.d/<PR>.<type>.md fragment or apply skip news"
exit 1
fi
gate:
name: Required checks pass
if: always()
needs: [test, news]
name: 🚦 Required checks pass
if: ${{ !cancelled() }} # codespell:ignore cancelled
needs: [test]
runs-on: ubuntu-26.04
steps:
- env:
- name: 🚦 Require all needed jobs to pass
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
jq -e 'all(to_entries[]; .value.result == "success" or (.key == "news" and .value.result == "skipped"))' <<< "$NEEDS_JSON"
run: jq -e 'all(to_entries[]; .value.result == "success")' <<<"$NEEDS_JSON"
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: πŸ›‘οΈ CodeQL
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
schedule:
- cron: "0 9 * * 2"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
analyze:
name: πŸ›‘οΈ Analyze ${{ matrix.language }}
runs-on: ubuntu-26.04
permissions:
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [actions, python]
steps:
- name: πŸ“₯ Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: πŸ›‘οΈ Initialize CodeQL
uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
with:
languages: ${{ matrix.language }}
build-mode: none
queries: security-extended
config: |
paths-ignore:
- tests
- name: πŸ›‘οΈ Analyze
uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
with:
category: "/language:${{ matrix.language }}"
31 changes: 31 additions & 0 deletions .github/workflows/news.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: πŸ“ Changelog
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changelog:
name: πŸ“ News fragment
runs-on: ubuntu-26.04
steps:
- name: πŸ“₯ Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: 🐍 Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.15"
enable-cache: false
- name: πŸ“¦ Install locked release tools
uses: tox-dev/github-workflows/install-locked-tools@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
with:
groups: release-news
venv: ${{ runner.temp }}/release-tools
- name: πŸ” Validate news fragments
uses: tox-dev/github-workflows/validate-news@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
93 changes: 15 additions & 78 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,26 @@
name: Prepare release
name: 🏷️ Prepare release
on:
workflow_dispatch:
inputs:
bump:
description: Version increment
description: Version bump strategy
required: true
type: choice
options: [patch, minor, major]
default: patch
options:
- auto
- major
- minor
- patch
default: auto
permissions: {}
concurrency:
group: prepare-release
cancel-in-progress: false
jobs:
prepare:
if: github.repository == 'pytest-dev/pytest-env' && github.ref == 'refs/heads/main'
runs-on: ubuntu-26.04
environment: release-auth
name: 🏷️ Prepare Towncrier release
uses: tox-dev/github-workflows/.github/workflows/prepare-towncrier-release.yaml@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Assemble the release notes
id: version
env:
BUMP: ${{ inputs.bump }}
run: |
set -euo pipefail
git fetch origin main
git reset --hard origin/main
current=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)
IFS=. read -r major minor patch <<< "$current"
case "$BUMP" in
major) next="$((major + 1)).0.0" ;;
minor) next="$major.$((minor + 1)).0" ;;
patch) next="$major.$minor.$((patch + 1))" ;;
esac
if [[ -n "$(git tag --list "$next")" ]]; then
echo "::error::tag $next already exists"
exit 1
fi
mapfile -d '' fragments < <(find changelog.d -maxdepth 1 -type f -name '*.md' -print0 | sort -z)
if (( ${#fragments[@]} == 0 )); then
echo "::error::no news fragments to release"
exit 1
fi
for fragment in "${fragments[@]}"; do
if [[ ! "$fragment" =~ ^changelog\.d/[0-9]+\.(feature|bugfix|doc)\.md$ || ! -s "$fragment" ]]; then
echo "::error::invalid or empty news fragment: $fragment"
exit 1
fi
done
{
printf '# Changelog\n\n## %s (%s)\n\n' "$next" "$(date -u +%F)"
for fragment in "${fragments[@]}"; do
printf '%s\n\n' "$(cat "$fragment")"
done
tail -n +3 CHANGELOG.md
} > "$RUNNER_TEMP/changelog.md"
mv "$RUNNER_TEMP/changelog.md" CHANGELOG.md
git rm -- "${fragments[@]}"
echo "next=$next" >> "$GITHUB_OUTPUT"
- id: token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
- name: Commit and tag the release
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
APP_SLUG: ${{ steps.token.outputs.app-slug }}
NEXT: ${{ steps.version.outputs.next }}
run: |
set -euo pipefail
app_user_id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)
git config user.name "${APP_SLUG}[bot]"
git config user.email "${app_user_id}+${APP_SLUG}[bot]@users.noreply.github.com"
git add CHANGELOG.md changelog.d
git commit -m "Prepare $NEXT"
git tag -a "$NEXT" -m "Release $NEXT"
gh auth setup-git --hostname github.com --force
git push --atomic origin HEAD:main "refs/tags/$NEXT"
pull-requests: read
secrets:
RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
with:
bump: ${{ inputs.bump }}
Loading