Skip to content

Commit ca5942e

Browse files
feat: bump to python 3.14, lint/fmt in ci (#22)
1 parent d683953 commit ca5942e

File tree

11 files changed

+95
-153
lines changed

11 files changed

+95
-153
lines changed

.github/workflows/lint-fmt-py.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint/Format with Ruff
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**/*.py"
9+
pull_request:
10+
paths:
11+
- "**/*.py"
12+
workflow_dispatch:
13+
14+
permissions: {}
15+
16+
jobs:
17+
lint-fmt-py:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
with:
23+
persist-credentials: false
24+
25+
# Runs `ruff check`
26+
- uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
27+
28+
# Check formatting
29+
- run: ruff format --check --diff
30+
31+
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
32+
with:
33+
python-version: '3.14'
34+
35+
- run: "python -m pip install types-requests mypy"
36+
37+
- run: "mypy ."

.github/workflows/lint-fmt-sh.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint/Format with Shellcheck
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**/*.sh"
9+
pull_request:
10+
paths:
11+
- "**/*.sh"
12+
workflow_dispatch:
13+
14+
permissions: {}
15+
16+
jobs:
17+
lint-fmt-sh:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
with:
23+
persist-credentials: false
24+
25+
- name: Run ShellCheck
26+
run: find . -type f -name "*.sh" -exec shellcheck {} +

COPR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To set up autobuilds:
3939

4040
- Select individual events, select branch/tag creation, and deselect push.
4141
- We don't want to fire the webhook on every commit, because some commits
42-
won't change this specific package! autocopr.py attaches the cooresponding
42+
won't change this specific package! The script attaches the cooresponding
4343
tags when needed.
4444

4545
From that point, it just works! Whenever the Github Action runs, if there's an

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ jobs:
190190
### As a Standalone Python Script
191191
192192
```shell
193-
python autocopr.py <folder-with-spec-files>
193+
python main.py <folder-with-spec-files>
194194
```
195195

196-
will run the `autocopr.py` script, searching for spec files in the provided directory.
196+
will run the `main.py` script, searching for spec files in the provided directory.
197197
If you do not provide a folder, it will search the current directory.
198198

199199
By default, running the script will

action.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ fi
2828
# https://stackoverflow.com/a/11114547
2929
ACTIONS_FOLDER=$(dirname "$(realpath --no-symlinks "${BASH_SOURCE[0]}")")
3030

31-
python "${ACTIONS_FOLDER}"/autocopr.py "${args[@]}" "${ROOT_LOC}"
31+
python "${ACTIONS_FOLDER}"/main.py "${args[@]}" "${ROOT_LOC}"

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
steps:
2828
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
2929
with:
30-
python-version: '3.13'
30+
python-version: '3.14'
3131
# FIXME: Caching outside of the directory is not supported right now.
3232
# I could work around it, but frankly I'm only installing requests, it isn't worth it
3333
# Implement when the issue is resolved

autocopr/update.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def update_version(
5252
exit(1)
5353

5454
commit_msg = f"Update {spec.name} to {latest.ver}\n\n{latest.url}"
55-
commit_result = subprocess.run(["git", "commit", "-m", commit_msg], capture_output=(not verbose))
55+
commit_result = subprocess.run(
56+
["git", "commit", "-m", commit_msg], capture_output=(not verbose)
57+
)
5658
if commit_result.returncode:
5759
logging.error(
5860
"Failed to make a commit.\nThis is a bug, please report it. Exiting..."
@@ -76,7 +78,9 @@ def update_version(
7678

7779
# The github webhooks won't fire if 3+ tags are made at once, to be
7880
# defensive we push on each spec file rather than pushing at the end
79-
push_result = subprocess.run(["git", "push", "--follow-tags"], capture_output=(not verbose))
81+
push_result = subprocess.run(
82+
["git", "push", "--follow-tags"], capture_output=(not verbose)
83+
)
8084
if push_result.returncode:
8185
if not verbose:
8286
logging.error(add_result.stderr)

dev-requirements.txt

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

githubapi/graphql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def get_latest_versions(
140140
if "data" not in resp or "nodes" not in resp["data"]:
141141
logging.error(f"GraphQL response not in expected shape: {resp}")
142142
exit(1)
143-
143+
144144
for spec, node in zip((spec for (spec, _) in spec_ids), resp["data"]["nodes"]):
145145
if node and (latest := node["latestRelease"]) and "tagName" in latest:
146146
latest_version = clean_tag(latest["tagName"])

autocopr.py renamed to main.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def main():
6363

6464
print("\n".join(update_summary))
6565

66-
had_updates = [(spec, latest) for (spec, latest) in latest_vers if spec.version != latest.ver]
66+
had_updates = [
67+
(spec, latest) for (spec, latest) in latest_vers if spec.version != latest.ver
68+
]
6769

6870
if len(had_updates) == 0:
6971
print("All spec files are up to date!")
@@ -81,10 +83,14 @@ def main():
8183
"All spec files are now up to date. If updated, the original spec file is backed up as a .bak file."
8284
)
8385
else:
84-
print("All spec files are now up to date, and the updates have been pushed.")
85-
86+
print(
87+
"All spec files are now up to date, and the updates have been pushed."
88+
)
89+
8690
case Mode.DryRun | Mode.Check:
87-
print(f"{[spec.name for (spec, _) in had_updates]} {"is" if len(had_updates) == 1 else "are"} outdated.")
91+
print(
92+
f"{[spec.name for (spec, _) in had_updates]} {'is' if len(had_updates) == 1 else 'are'} outdated."
93+
)
8894
if args.mode == Mode.Check:
8995
print("Exiting with an error because we are in check mode.")
9096
exit(1)

0 commit comments

Comments
 (0)