workflows for validation

This commit is contained in:
duncathan 2024-12-18 10:15:09 -06:00
parent ab1db92c40
commit b919a44e14
3 changed files with 106 additions and 1 deletions

View file

@ -1,6 +1,8 @@
name: Python Package name: Python Package
on: on:
workflow_dispatch:
pull_request:
push: push:
branches: branches:
- '*' - '*'
@ -8,6 +10,74 @@ on:
- '*' - '*'
jobs: jobs:
mypy-required:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Workaround for worktree config
run: git config --unset-all extensions.worktreeConfig || true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install Python packages
run: |
python -m pip install -e .
python -m pip install mypy
- name: Mypy on required files
uses: tsuyoshicho/action-mypy@v5
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-check
setup_method: nothing
target: --config-file=pyproject.toml
fail_on_error: true
install_types: false
mypy-modified:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Workaround for worktree config
run: git config --unset-all extensions.worktreeConfig || true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install Python packages
run: |
python -m pip install -e .
python -m pip install mypy
- name: Mypy on modified files
uses: tsuyoshicho/action-mypy@v5
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-check
setup_method: nothing
level: warning
fail_on_error: false
install_types: false
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Wheel name: Wheel
@ -42,7 +112,9 @@ jobs:
pypi: pypi:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: needs:
- mypy-required
- build - build
if: ${{ github.event_name != 'pull_request' }}
steps: steps:
- name: Download all the dists - name: Download all the dists

33
.github/workflows/workflow-validate.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Check Workflow Files
on:
push:
branches:
- main
merge_group:
pull_request:
defaults:
run:
shell: bash
jobs:
actions:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install action-validator with asdf
uses: asdf-vm/actions/install@v3
with:
tool_versions: |
action-validator 0.5.1
- name: Lint Actions
run: |
find .github/workflows -type f \( -iname \*.yaml -o -iname \*.yml \) \
| xargs -I {} action-validator --verbose {}

View file

@ -4,7 +4,7 @@
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version. # Ruff version.
rev: v0.2.2 rev: v0.8.3
hooks: hooks:
- id: ruff - id: ruff
args: [ --fix, --exit-non-zero-on-fix ] args: [ --fix, --exit-non-zero-on-fix ]