Files
firezone/.github/workflows/_static-analysis.yml
2023-10-23 16:16:09 -06:00

49 lines
1.4 KiB
YAML

name: Static Analysis
on:
workflow_call:
jobs:
version-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check version is up to date
run: |
make version
if [ -z "$(git status --porcelain)" ]; then
# Working directory clean
echo "Version manifests up to date"
else
# Uncommitted changes
echo '`make version` found outdated files! Showing diff'
git diff
exit 1
fi
global-linter:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: actions/cache/restore@v3
name: Restore Python Cache
with:
path: ~/.cache/pip
key: ubuntu-22.04-${{ runner.arch }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
ubuntu-22.04-${{ runner.arch }}-pip-
- name: Install Python Dependencies
run: |
pip install -r requirements.txt
- name: Run pre-commit
run: |
pre-commit install
SKIP=no-commit-to-branch pre-commit run --all-files
- uses: actions/cache/save@v3
if: ${{ github.ref == 'refs/heads/main' }}
name: Save Python Cache
with:
path: ~/.cache/pip
key: ubuntu-22.04-${{ runner.arch }}-pip-${{ hashFiles('requirements.txt') }}