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
5 changes: 5 additions & 0 deletions .cookiecutter-replay.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"keywords": "cloud, microgrid",
"github_org": "frequenz-floss",
"license": "MIT",
"private_repo": "no",
"author_name": "Frequenz Energy-as-a-Service GmbH",
"author_email": "floss@frequenz.com",
"python_package": "frequenz.api.reporting",
Expand Down Expand Up @@ -35,6 +36,10 @@
"MIT",
"Proprietary"
],
"private_repo": [
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
],
"author_name": "Frequenz Energy-as-a-Service GmbH",
"author_email": "floss@frequenz.com",
"python_package": "{{cookiecutter | python_package}}",
Expand Down

This file was deleted.

9 changes: 0 additions & 9 deletions .github/containers/nox-cross-arch/entrypoint.bash

This file was deleted.

20 changes: 0 additions & 20 deletions .github/containers/test-installation/Dockerfile

This file was deleted.

27 changes: 26 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ updates:
exclude-patterns:
# pydoclint has shipped breaking changes in patch updates often
- "pydoclint"
# These need a migration script to fix Dependabot not updating the
# runtime dependencies
- "grpcio"
- "grpcio-tools"
- "protobuf"
- "isort"
minor:
update-types:
- "minor"
Expand All @@ -48,6 +54,7 @@ updates:
- "protobuf"
- "pydoclint"
- "pytest-asyncio"
- "isort"
# We group repo-config updates as it uses optional dependencies that are
# considered different dependencies otherwise, and will create one PR for
# each if we don't group them.
Expand All @@ -63,10 +70,28 @@ updates:
# We group grpcio and protobuf updates together, as they need special
# handling on the pyproject.toml file because of the protobuf/grpcio
# build/runtime cross-version guarantees
grpc:
# We group grpcio and protobuf updates together, as they need special
# handling on the pyproject.toml file because of the protobuf/grpcio
# build/runtime cross-version guarantees and wrong dependabot handling
# of build/runtime dependencies.
grpc-compatible:
update-types:
- "patch"
- "minor"
patterns:
- "grpcio"
- "grpcio-tools"
- "protobuf"
# For major updates we split it up. It was observed in the past that
# grpcio releases lag behind protobuf releases, and they are not
# compatible with a major protobuf update for a while, so we shouldn't
# block the update of one with the other.
grpcio-major:
patterns:
- "grpcio"
- "grpcio-tools"
protobuf-major:
patterns:
- "protobuf"

- package-ecosystem: "github-actions"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/auto-dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ on:
pull_request_target:

permissions:
# Read repository contents and Dependabot metadata used by the nested action.
contents: read
# The nested action also uses `github.token` internally for PR operations.
pull-requests: write

jobs:
auto-merge:
name: Auto-merge Dependabot PR
if: >
github.actor == 'dependabot[bot]' &&
!contains(github.event.pull_request.title, 'the repo-config group')
!contains(github.event.pull_request.title, 'the repo-config group') &&
!contains(github.event.pull_request.title, 'the grpc-compatible group') &&
!contains(github.event.pull_request.title, 'the grpcio-major group') &&
!contains(github.event.pull_request.title, 'the protobuf-major group') &&
!contains(github.event.pull_request.title, 'Bump black from ') &&
!contains(github.event.pull_request.title, 'Bump isort from ')
runs-on: ubuntu-slim
steps:
- name: Generate GitHub App token
Expand All @@ -29,6 +36,12 @@ jobs:
with:
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
# Merge Dependabot PRs.
permission-contents: write
# Create the auto-merged label if it does not exist.
permission-issues: write
# Approve PRs, add labels, and enable auto-merge.
permission-pull-requests: write

- name: Auto-merge Dependabot PR
uses: frequenz-floss/dependabot-auto-approve@e943399cc9d76fbb6d7faae446cd57301d110165 # v1.5.0
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/black-migration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Automatic black formatting migration for Dependabot PRs
#
# When Dependabot upgrades black, this workflow installs the new version
# and runs `black .` so the PR already contains any formatting changes
# introduced by the upgrade, while leaving the PR open for review.
#
# Black uses calendar versioning. Only the first release of a new calendar
# year may introduce formatting changes (major bump in Dependabot's terms).
# Minor and patch updates within a year keep formatting stable, so they stay
# in the regular Dependabot groups and are auto-merged normally.
#
# The companion auto-dependabot workflow skips major black PRs so they're
# handled exclusively by this migration workflow.
#
# XXX: !!! SECURITY WARNING !!!
# pull_request_target has write access to the repo, and can read secrets.
# This is required because Dependabot PRs are treated as fork PRs: the
# GITHUB_TOKEN is read-only and secrets are unavailable with a plain
# pull_request trigger. The action mitigates the risk by:
# - Never executing code from the PR (the migration script is embedded
# in this workflow file on the base branch, not taken from the PR).
# - Gating migration steps on github.actor == 'dependabot[bot]'.
# - Running checkout with persist-credentials: false and isolating
# push credentials from the migration script environment.
# For more details read:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

name: Black Migration

on:
merge_group: # To allow using this as a required check for merging
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]

permissions:
# Commit reformatted files back to the PR branch.
contents: write
# Create and normalize migration state labels.
issues: write
# Read/update pull request metadata and comments.
pull-requests: write

jobs:
black-migration:
name: Migrate Black
# Skip if it was triggered by the merge queue. We only need the workflow to
# be executed to meet the "Required check" condition for merging, but we
# don't need to actually run the job, having the job present as Skipped is
# enough.
if: |
github.event_name == 'pull_request_target' &&
github.actor == 'dependabot[bot]' &&
contains(github.event.pull_request.title, 'Bump black from ')
runs-on: ubuntu-24.04
steps:
- name: Generate token
id: create-app-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
with:
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
# Push reformatted files to the PR branch.
permission-contents: write
# Create and normalize migration state labels.
permission-issues: write
# Read/update pull request metadata and labels.
permission-pull-requests: write
- name: Migrate
uses: frequenz-floss/gh-action-dependabot-migrate@27763fb5eb56476d91abe00132e8a0614171f92f # v1.2.0
with:
migration-script: |
import os
import subprocess
import sys

version = os.environ["MIGRATION_VERSION"].lstrip("v")
subprocess.run(
[sys.executable, "-Im", "pip", "install", f"black=={version}"],
check=True,
)
subprocess.run([sys.executable, "-Im", "black", "."], check=True)
token: ${{ steps.create-app-token.outputs.token }}
auto-merge-on-changes: "false"
version-iteration: "false"
sign-commits: "true"
auto-merged-label: "tool:auto-merged"
migrated-label: "tool:black:migration:executed"
intervention-pending-label: "tool:black:migration:intervention-pending"
intervention-done-label: "tool:black:migration:intervention-done"
25 changes: 16 additions & 9 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Test PR
on:
pull_request:

permissions:
# Read repository contents for checkout and dependency resolution only.
contents: read

env:
# Please make sure this version is included in the `matrix`, as the
# `matrix` section can't use `env`, so it must be entered manually
Expand All @@ -17,10 +21,10 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

Expand All @@ -43,7 +47,7 @@ jobs:

steps:
- name: Run nox
uses: frequenz-floss/gh-action-nox@v1.1.1
uses: frequenz-floss/gh-action-nox@e1351cf45e05e85afc1c79ab883e06322892d34c # v1.1.0
with:
python-version: "3.11"
nox-session: ci_checks_max
Expand All @@ -53,15 +57,15 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.4
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand All @@ -70,11 +74,14 @@ jobs:
env:
MIKE_VERSION: gh-${{ github.job }}
run: |
mike deploy $MIKE_VERSION
mike set-default $MIKE_VERSION
# mike is installed as a console script, not a runnable module.
# Run the installed script under isolated mode to avoid importing from
# the workspace when building docs from checked-out code.
python -I "$(command -v mike)" deploy "$MIKE_VERSION"
python -I "$(command -v mike)" set-default "$MIKE_VERSION"

- name: Upload site
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: docs-site
path: site/
Expand Down
Loading
Loading