Skip to content

Commit 82a7235

Browse files
committed
Update golden tests
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent 77eeb8e commit 82a7235

40 files changed

Lines changed: 950 additions & 190 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"cookiecutter": {
3+
"Introduction": "",
4+
"type": "actor",
5+
"name": "test",
6+
"description": "Test description",
7+
"title": "Frequenz Test Actor",
8+
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
9+
"github_org": "frequenz-floss",
10+
"license": "Proprietary",
11+
"private_repo": "yes",
12+
"author_name": "Frequenz Energy-as-a-Service GmbH",
13+
"author_email": "floss@frequenz.com",
14+
"python_package": "frequenz.actor.test",
15+
"pypi_package_name": "frequenz-actor-test",
16+
"github_repo_name": "frequenz-actor-test",
17+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
18+
},
19+
"_cookiecutter": {
20+
"Introduction": "{{cookiecutter | introduction}}",
21+
"type": [
22+
"actor",
23+
"api",
24+
"app",
25+
"lib",
26+
"model"
27+
],
28+
"name": "test",
29+
"description": "Test description",
30+
"title": "{{cookiecutter | proj_title}}",
31+
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
32+
"github_org": "frequenz-floss",
33+
"license": [
34+
"Proprietary",
35+
"MIT"
36+
],
37+
"private_repo": [
38+
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
39+
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
40+
],
41+
"author_name": "Frequenz Energy-as-a-Service GmbH",
42+
"author_email": "floss@frequenz.com",
43+
"python_package": "{{cookiecutter | python_package}}",
44+
"pypi_package_name": "{{cookiecutter | pypi_package_name}}",
45+
"github_repo_name": "{{cookiecutter | github_repo_name}}",
46+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
47+
}
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Auto-merge Dependabot PR
2+
3+
on:
4+
# XXX: !!! SECURITY WARNING !!!
5+
# pull_request_target has write access to the repo, and can read secrets. We
6+
# need to audit any external actions executed in this workflow and make sure no
7+
# checked out code is run (not even installing dependencies, as installing
8+
# dependencies usually can execute pre/post-install scripts). We should also
9+
# only use hashes to pick the action to execute (instead of tags or branches).
10+
# For more details read:
11+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
12+
pull_request_target:
13+
14+
permissions:
15+
# Read repository contents and Dependabot metadata used by the nested action.
16+
contents: read
17+
# The nested action also uses `github.token` internally for PR operations.
18+
pull-requests: write
19+
20+
jobs:
21+
auto-merge:
22+
name: Auto-merge Dependabot PR
23+
if: |
24+
github.actor == 'dependabot[bot]' &&
25+
!contains(github.event.pull_request.title, 'the repo-config group') &&
26+
!contains(github.event.pull_request.title, 'Bump black from ')
27+
runs-on: ubuntu-slim
28+
steps:
29+
- name: Generate GitHub App token
30+
id: app-token
31+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
32+
with:
33+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
34+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
35+
# Merge Dependabot PRs.
36+
permission-contents: write
37+
# Create the auto-merged label if it does not exist.
38+
permission-issues: write
39+
# Approve PRs, add labels, and enable auto-merge.
40+
permission-pull-requests: write
41+
42+
- name: Auto-merge Dependabot PR
43+
uses: frequenz-floss/dependabot-auto-approve@e943399cc9d76fbb6d7faae446cd57301d110165 # v1.5.0
44+
with:
45+
github-token: ${{ steps.app-token.outputs.token }}
46+
dependency-type: 'all'
47+
auto-merge: 'true'
48+
merge-method: 'merge'
49+
add-label: 'tool:auto-merged'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Automatic black formatting migration for Dependabot PRs
2+
#
3+
# When Dependabot upgrades black, this workflow installs the new version
4+
# and runs `black .` so the PR already contains any formatting changes
5+
# introduced by the upgrade, while leaving the PR open for review.
6+
#
7+
# Black uses calendar versioning. Only the first release of a new calendar
8+
# year may introduce formatting changes (major bump in Dependabot's terms).
9+
# Minor and patch updates within a year keep formatting stable, so they stay
10+
# in the regular Dependabot groups and are auto-merged normally.
11+
#
12+
# The companion auto-dependabot workflow skips major black PRs so they're
13+
# handled exclusively by this migration workflow.
14+
#
15+
# XXX: !!! SECURITY WARNING !!!
16+
# pull_request_target has write access to the repo, and can read secrets.
17+
# This is required because Dependabot PRs are treated as fork PRs: the
18+
# GITHUB_TOKEN is read-only and secrets are unavailable with a plain
19+
# pull_request trigger. The action mitigates the risk by:
20+
# - Never executing code from the PR (the migration script is embedded
21+
# in this workflow file on the base branch, not taken from the PR).
22+
# - Gating migration steps on github.actor == 'dependabot[bot]'.
23+
# - Running checkout with persist-credentials: false and isolating
24+
# push credentials from the migration script environment.
25+
# For more details read:
26+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
27+
28+
name: Black Migration
29+
30+
on:
31+
merge_group: # To allow using this as a required check for merging
32+
pull_request_target:
33+
types: [opened, synchronize, reopened, labeled, unlabeled]
34+
35+
permissions:
36+
# Commit reformatted files back to the PR branch.
37+
contents: write
38+
# Create and normalize migration state labels.
39+
issues: write
40+
# Read/update pull request metadata and comments.
41+
pull-requests: write
42+
43+
jobs:
44+
black-migration:
45+
name: Migrate Black
46+
# Skip if it was triggered by the merge queue. We only need the workflow to
47+
# be executed to meet the "Required check" condition for merging, but we
48+
# don't need to actually run the job, having the job present as Skipped is
49+
# enough.
50+
if: |
51+
github.event_name == 'pull_request_target' &&
52+
github.actor == 'dependabot[bot]' &&
53+
contains(github.event.pull_request.title, 'Bump black from ')
54+
runs-on: ubuntu-24.04
55+
steps:
56+
- name: Generate token
57+
id: create-app-token
58+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
59+
with:
60+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
61+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
62+
# Push reformatted files to the PR branch.
63+
permission-contents: write
64+
# Create and normalize migration state labels.
65+
permission-issues: write
66+
# Read/update pull request metadata and labels.
67+
permission-pull-requests: write
68+
- name: Migrate
69+
uses: frequenz-floss/gh-action-dependabot-migrate@b389f72f9282346920150a67495efbae450ac07b # v1.1.0
70+
with:
71+
migration-script: |
72+
import os
73+
import subprocess
74+
import sys
75+
76+
version = os.environ["MIGRATION_VERSION"].lstrip("v")
77+
subprocess.run(
78+
[sys.executable, "-Im", "pip", "install", f"black=={version}"],
79+
check=True,
80+
)
81+
subprocess.run([sys.executable, "-Im", "black", "."], check=True)
82+
token: ${{ steps.create-app-token.outputs.token }}
83+
auto-merge-on-changes: "false"
84+
sign-commits: "true"
85+
auto-merged-label: "tool:auto-merged"
86+
migrated-label: "tool:black:migration:executed"
87+
intervention-pending-label: "tool:black:migration:intervention-pending"
88+
intervention-done-label: "tool:black:migration:intervention-done"

tests_golden/integration/test_cookiecutter_generation/actor/cookiecutter-stdout.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
./.github/ISSUE_TEMPLATE/config.yml: # TODO(cookiecutter): Make sure the GitHub repository has a discussion category "Support"
33
./.github/keylabeler.yml: # TODO(cookiecutter): Add other parts
44
./.github/labeler.yml:# TODO(cookiecutter): Add different parts of the source
5-
./.github/workflows/ci-pr.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
6-
./.github/workflows/ci-pr.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
7-
./.github/workflows/ci.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
8-
./.github/workflows/ci.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
9-
./.github/workflows/ci.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
10-
./.github/workflows/ci.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
11-
./.github/workflows/ci.yaml: # TODO(cookiecutter): Uncomment this for projects with private dependencies
12-
./.github/workflows/release-notes-check.yml: # TODO(cookiecutter): Uncomment the following line for private repositories, otherwise remove it
135
./CODEOWNERS:# TODO(cookiecutter): Add more specific code-owners, check if the default is correct
146
./CODEOWNERS:* TODO(cookiecutter): Add codeowners (like @{github_org}/some-team)# Temporary, should probably change
157
./README.md:TODO(cookiecutter): Improve the README file

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.cookiecutter-replay.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
99
"github_org": "frequenz-floss",
1010
"license": "MIT",
11+
"private_repo": "no",
1112
"author_name": "Frequenz Energy-as-a-Service GmbH",
1213
"author_email": "floss@frequenz.com",
1314
"python_package": "frequenz.actor.test",
@@ -33,6 +34,10 @@
3334
"MIT",
3435
"Proprietary"
3536
],
37+
"private_repo": [
38+
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
39+
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
40+
],
3641
"author_name": "Frequenz Energy-as-a-Service GmbH",
3742
"author_email": "floss@frequenz.com",
3843
"python_package": "{{cookiecutter | python_package}}",

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.github/workflows/ci-pr.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,13 @@ jobs:
2525
with:
2626
python-version: "3.11"
2727
nox-session: ci_checks_max
28-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
29-
# git-username: ${{ secrets.GIT_USER }}
30-
# git-password: ${{ secrets.GIT_PASS }}
3128

3229
test-docs:
3330
name: Test documentation website generation
3431
runs-on: ubuntu-24.04
3532
steps:
3633
- name: Setup Git
3734
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
38-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
39-
# with:
40-
# username: ${{ secrets.GIT_USER }}
41-
# password: ${{ secrets.GIT_PASS }}
4235

4336
- name: Fetch sources
4437
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.github/workflows/ci.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ jobs:
5151
with:
5252
python-version: ${{ matrix.python }}
5353
nox-session: ${{ matrix.nox-session }}
54-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
55-
# git-username: ${{ secrets.GIT_USER }}
56-
# git-password: ${{ secrets.GIT_PASS }}
5754

5855
# This job runs if all the `nox` matrix jobs ran and succeeded.
5956
# It is only used to have a single job that we can require in branch
@@ -84,10 +81,6 @@ jobs:
8481
steps:
8582
- name: Setup Git
8683
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
87-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
88-
# with:
89-
# username: ${{ secrets.GIT_USER }}
90-
# password: ${{ secrets.GIT_PASS }}
9184

9285
- name: Fetch sources
9386
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -127,10 +120,6 @@ jobs:
127120
steps:
128121
- name: Setup Git
129122
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
130-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
131-
# with:
132-
# username: ${{ secrets.GIT_USER }}
133-
# password: ${{ secrets.GIT_PASS }}
134123

135124
- name: Print environment (debug)
136125
run: env
@@ -190,10 +179,6 @@ jobs:
190179
steps:
191180
- name: Setup Git
192181
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
193-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
194-
# with:
195-
# username: ${{ secrets.GIT_USER }}
196-
# password: ${{ secrets.GIT_PASS }}
197182

198183
- name: Fetch sources
199184
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -234,10 +219,6 @@ jobs:
234219
steps:
235220
- name: Setup Git
236221
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
237-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
238-
# with:
239-
# username: ${{ secrets.GIT_USER }}
240-
# password: ${{ secrets.GIT_PASS }}
241222

242223
- name: Fetch sources
243224
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/.github/workflows/release-notes-check.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
if: github.event_name == 'pull_request'
2626
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1.2.1
2727
with:
28-
# TODO(cookiecutter): Uncomment the following line for private repositories, otherwise remove it
29-
# token: ${{ secrets.github_token }}
3028
file-pattern: "RELEASE_NOTES.md"
3129
prereq-pattern: "src/**"
3230
skip-label: "cmd:skip-release-notes"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"cookiecutter": {
3+
"Introduction": "",
4+
"type": "api",
5+
"name": "test",
6+
"description": "Test description",
7+
"title": "Frequenz Test API",
8+
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
9+
"github_org": "frequenz-floss",
10+
"license": "Proprietary",
11+
"private_repo": "yes",
12+
"author_name": "Frequenz Energy-as-a-Service GmbH",
13+
"author_email": "floss@frequenz.com",
14+
"python_package": "frequenz.api.test",
15+
"pypi_package_name": "frequenz-api-test",
16+
"github_repo_name": "frequenz-api-test",
17+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
18+
},
19+
"_cookiecutter": {
20+
"Introduction": "{{cookiecutter | introduction}}",
21+
"type": [
22+
"api",
23+
"actor",
24+
"app",
25+
"lib",
26+
"model"
27+
],
28+
"name": "test",
29+
"description": "Test description",
30+
"title": "{{cookiecutter | proj_title}}",
31+
"keywords": "(comma separated: 'frequenz', <type> and <name> are included automatically)",
32+
"github_org": "frequenz-floss",
33+
"license": [
34+
"Proprietary",
35+
"MIT"
36+
],
37+
"private_repo": [
38+
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
39+
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
40+
],
41+
"author_name": "Frequenz Energy-as-a-Service GmbH",
42+
"author_email": "floss@frequenz.com",
43+
"python_package": "{{cookiecutter | python_package}}",
44+
"pypi_package_name": "{{cookiecutter | pypi_package_name}}",
45+
"github_repo_name": "{{cookiecutter | github_repo_name}}",
46+
"default_codeowners": "(like @some-org/some-team; defaults to a team based on the repo type)"
47+
}
48+
}

0 commit comments

Comments
 (0)