Files
firezone/.github/workflows/_static-analysis.yml

72 lines
2.1 KiB
YAML

name: Static Analysis
on:
workflow_call:
jobs:
pr-lint:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
version-check:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Check version is up to date
run: |
make -f scripts/Makefile 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
link-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: lycheeverse/lychee-action@v1.9.3
with:
fail: true
args: --offline --verbose --no-progress **/*.md
global-linter:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/cache/restore@v4
name: Restore Python Cache
id: cache
with:
path: ~/.cache/pip
key: ubuntu-22.04-${{ runner.arch }}-pip-${{ hashFiles('.github/requirements.txt') }}
- name: Install Python Dependencies
run: |
pip install -r .github/requirements.txt
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y shfmt
- name: Run pre-commit
run: |
pre-commit install --config .github/pre-commit-config.yaml
SKIP=no-commit-to-branch pre-commit run --all-files --config .github/pre-commit-config.yaml
- uses: actions/cache/save@v4
if: ${{ steps.cache.outputs.cache-hit != 'true'}}
name: Save Python Cache
with:
path: ~/.cache/pip
key: ${{ steps.cache.outputs.cache-primary-key }}