Skip to content

Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.6 #2028

Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.6

Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.6 #2028

Workflow file for this run

---
name: "Test"
on: # yamllint disable-line rule:truthy
push:
branches: [main]
tags: ["*"]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '43 16 * * 5'
env:
# How long to run the executable automated tests
TEST_DURATION_SECONDS: 60
# https://github.com/upx/upx/releases
UPX_VERSION: "4.2.4"
jobs:
precommit:
name: Pre-commit
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
- name: Enable cache for pre-commit hooks
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit|${{ env.pythonLocation }}
pre-commit|
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install pre-commit
shell: cmd
run: python -m pip install pre-commit
- name: Install pre-commit hooks
shell: cmd
run: pre-commit install-hooks
- name: Run pre-commit checks
shell: cmd
run: pre-commit run -a
- name: Run pre-commit gc
shell: cmd
run: pre-commit gc
docs:
name: Documentation
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Build docs
shell: cmd
run: uv run --locked --only-group docs mkdocs build --verbose --strict
test:
name: Test
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Run tests
shell: cmd
run: uv run --locked --group dev pytest
sbom:
name: Software Bill of Materials
permissions:
actions: read
contents: write
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Generate requirements.txt
shell: cmd
run: uv export --locked --format requirements-txt > requirements.txt
- name: Generate & upload SBOM
# https://github.com/anchore/sbom-action
uses: anchore/sbom-action@df80a981bc6edbc4e220a492d3cbe9f5547a6e75 # v0.17.9
with:
artifact-name: sbom-spdx.json
dependency-snapshot: true
file: requirements.txt
format: spdx-json
# This action is currently disabled because it breaks PRs that aren't
# introducing new vulnerabilities
# - name: Check for security vulnerabilities
# # https://github.com/pypa/gh-action-pip-audit/
# uses: pypa/gh-action-pip-audit@1220774d901786e6f652ae159f7b6bc8fea6d266 # v1.1.0
# with:
# inputs: requirements.txt
# require-hashes: true
# summary: true
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install uv
# https://github.com/astral-sh/setup-uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0
- name: Set up Python
# https://github.com/actions/setup-python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that pipenv (and associated
# utilities) can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install UPX
shell: cmd
run: choco install -y upx --version ${{ env.UPX_VERSION }}
- name: Build executable
shell: cmd
env:
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: uv run --locked --no-dev python build.py
- name: Save executable as artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: wahoo-results.exe
path: wahoo-results.exe
if-no-files-found: error
autotest:
name: Autotest
needs: [build]
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Load executable artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wahoo-results.exe
- name: Ensure config file does not exist
shell: bash
run: |
[[ ! -e wahoo-results.ini ]]
- name: Run autotest (no config file)
timeout-minutes: 3
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
- name: Ensure config file exists
shell: bash
run: |
[[ -e wahoo-results.ini ]]
- name: Run autotest (with config file)
timeout-minutes: 3
shell: cmd
run: wahoo-results.exe --loglevel=debug --test scripted:${{ env.TEST_DURATION_SECONDS }}
success:
name: Successful CI
needs: [autotest, docs, precommit, sbom, test]
runs-on: windows-latest
steps:
- name: Success
shell: cmd
run: echo "CI was successful"
release:
name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
needs: [success]
runs-on: windows-latest
permissions:
contents: write
discussions: write
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ".python-version"
# Add Scripts directory to the path so that utilities can be used once installed
- name: Add python Scripts directory to path
shell: cmd
# Code-page switch is needed to write the env file as utf-8
run: |
chcp 65001
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH%
chcp 1252
- name: Install sentry-cli
shell: cmd
run: python -m pip install --user sentry-cli
- name: Download executable as artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wahoo-results.exe
- name: Create sentry release
shell: cmd
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: wahoo-results
SENTRY_PROJECT: wahoo-results
run: |
sentry-cli releases new --finalize wahoo-results@${{ github.ref_name }}
sentry-cli releases set-commits wahoo-results@${{ github.ref_name }} --commit JohnStrunk/wahoo-results@${{ github.ref_name }}
- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
with:
name: Release ${{ github.ref_name }}
draft: true
files: |
wahoo-results.exe