-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from ASFHyP3/develop
Release Ruff
- Loading branch information
Showing
11 changed files
with
154 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,6 @@ on: | |
- develop | ||
jobs: | ||
call-changelog-check-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
secrets: | ||
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
|
||
jobs: | ||
call-create-jira-issue-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
secrets: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ on: | |
|
||
jobs: | ||
call-labeled-pr-check-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
|
||
jobs: | ||
call-release-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
release_prefix: Actions | ||
secrets: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
check-with-ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install ruff | ||
- name: Ruff linting check | ||
run: ruff check --output-format=github . | ||
|
||
- name: Ruff format check | ||
run: ruff format --diff . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ on: push | |
|
||
jobs: | ||
call-secrets-analysis-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ on: | |
|
||
jobs: | ||
call-bump-version-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
secrets: | ||
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Update Actions Examples | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
call-git-object-name-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected] | ||
|
||
upate_actions_examples: | ||
needs: call-git-object-name-workflow | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.TOOLS_BOT_PAK }} | ||
|
||
- name: Create update branch | ||
id: update | ||
env: | ||
ACTIONS_VERSION: ${{ needs.call-git-object-name-workflow.outputs.name }} | ||
UPDATE_BRANCH: update-examples-to-${{ needs.call-git-object-name-workflow.outputs.name }} | ||
run: | | ||
git config user.name "tools-bot" | ||
git config user.email "[email protected]" | ||
echo "::set-output name=branch::${UPDATE_BRANCH}" | ||
git checkout -b ${UPDATE_BRANCH} | ||
export SEARCH_PATTERN='(ASFHyP3/actions/.github/workflows/.*.yml)@v[0-9]+\.[0-9]+\.[0-9]+' | ||
sed -i -r "s|$SEARCH_PATTERN|\1@${ACTIONS_VERSION}|g" README.md | ||
git commit -am "Bump actions example's version to ${ACTIONS_VERSION}" | ||
git push origin ${UPDATE_BRANCH} | ||
- name: open PR | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
source_branch: ${{ steps.update.outputs.branch }} | ||
destination_branch: develop | ||
pr_title: Update Actions example versions to ${{ needs.call-git-object-name-workflow.outputs.name }} | ||
pr_body: | | ||
PR created by a new `v*` tag push event | ||
pr_assignee: ASFHyP3/tools | ||
pr_label: tools-bot | ||
pr_draft: false | ||
pr_allow_empty: true | ||
github_token: ${{ secrets.TOOLS_BOT_PAK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ on: | |
|
||
jobs: | ||
call-bump-version-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
user: tools-bot # Optional; default shown | ||
email: [email protected] # Optional; default shown | ||
|
@@ -57,7 +57,7 @@ on: | |
jobs: | ||
call-changelog-check-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
secrets: | ||
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
|
@@ -77,7 +77,7 @@ on: | |
jobs: | ||
call-create-jira-issue-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
secrets: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | ||
|
@@ -130,13 +130,13 @@ on: | |
jobs: | ||
call-version-info-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
conda_env_name: hyp3-plugin | ||
call-docker-ecr-workflow: | ||
needs: call-version-info-workflow | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }} | ||
ecr_registry: 845172464411.dkr.ecr.us-west-2.amazonaws.com | ||
|
@@ -171,13 +171,13 @@ on: | |
jobs: | ||
call-version-info-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
conda_env_name: hyp3-plugin | ||
call-docker-ghcr-workflow: | ||
needs: call-version-info-workflow | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }} | ||
user: ${{ github.actor }} | ||
|
@@ -198,14 +198,63 @@ on: push | |
jobs: | ||
call-flake8-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
local_package_names: hyp3_plugin # Required; comma-seperated list of names that should be considered local to your application | ||
excludes: hyp3_plugin/ugly.py # Optional; comma-separated list of glob patterns to exclude from checks | ||
``` | ||
|
||
to ensure the Python code is styled correctly. | ||
|
||
### [`reusable-ruff.yml`](./.github/workflows/reusable-ruff.yml) | ||
|
||
Runs [Ruff](https://docs.astral.sh/ruff/) to enforce a configurable Python style guide. Use like: | ||
|
||
```yaml | ||
name: Static analysis | ||
on: push | ||
jobs: | ||
call-ruff-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected] | ||
``` | ||
|
||
to ensure the Python code is styled correctly. | ||
|
||
To conform to ASFHyP3's Python style add the following to your project's `pyproject.toml`: | ||
```toml | ||
[tool.ruff] | ||
line-length = 120 | ||
src = ["src", "tests"] | ||
[tool.ruff.format] | ||
indent-style = "space" | ||
quote-style = "single" | ||
[tool.ruff.lint] | ||
extend-select = [ | ||
"I", # isort: https://docs.astral.sh/ruff/rules/#isort-i | ||
"UP", # pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up | ||
"D", # pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d | ||
"ANN", # annotations: https://docs.astral.sh/ruff/rules/#flake8-annotations-ann | ||
"PTH", # use-pathlib-pth: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth | ||
] | ||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" | ||
[tool.ruff.lint.isort] | ||
case-sensitive = true | ||
lines-after-imports = 2 | ||
``` | ||
|
||
Ruff can automatically fix many linting errors and reformat code to match your Python style by running these commands: | ||
```shell | ||
ruff check --fix . | ||
ruff format . | ||
``` | ||
|
||
### [`reusable-git-object-name.yml`](./.github/workflows/reusable-git-object-name.yml) | ||
|
||
Outputs the human-readable git object name from [`git describe --dirty --tags --long --match "*[0-9]*"`](https://git-scm.com/docs/git-describe) | ||
|
@@ -226,7 +275,7 @@ on: | |
jobs: | ||
call-git-object-name-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
echo-git-object-name-outputs: | ||
needs: call-git-object-name-workflow | ||
|
@@ -256,7 +305,7 @@ on: | |
jobs: | ||
call-labeled-pr-check-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
``` | ||
to ensure a release label is included on any PR to `main`. | ||
|
||
|
@@ -280,7 +329,7 @@ on: | |
jobs: | ||
call-pytest-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
local_package_name: hyp3_plugin # Required; package to produce a coverage report for | ||
fail_fast: false # Optional; default shown | ||
|
@@ -309,7 +358,7 @@ on: | |
jobs: | ||
call-release-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
release_prefix: HyP3-CI | ||
release_branch: main # Optional; default shown | ||
|
@@ -338,7 +387,7 @@ on: | |
jobs: | ||
call-release-checklist-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
permissions: | ||
pull-requests: write | ||
with: | ||
|
@@ -367,7 +416,7 @@ on: push | |
jobs: | ||
call-secrets-analysis-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
``` | ||
to scan every push for secrets. | ||
|
||
|
@@ -393,7 +442,7 @@ on: | |
jobs: | ||
call-version-info-workflow: | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].2 | ||
uses: ASFHyP3/actions/.github/workflows/[email protected].3 | ||
with: | ||
python_version: '3.9' # Optional; default shown | ||
|