mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Noticed that we all have different styles of writing scripts :-). This PR adds linting to our shell scripts to standardize on formatting, catch common issues and/or possible security bugs. For editor setup: - Ensure [`shellcheck`](https://github.com/koalaman/shellcheck) and [`shfmt`](https://github.com/mvdan/sh) are in your `PATH` - Configure `shfmt` with indentation of `4`, otherwise it uses tabs by default. [Here](https://github.com/jamilbk/nvim/blob/master/init.vim#L159) is how you can do that with Vim and [here](https://marketplace.visualstudio.com/items?itemName=mkhl.shfmt) is how for VScode. --------- Signed-off-by: Jamil <jamilbk@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com> Co-authored-by: Thomas Eizinger <thomas@eizinger.io> Co-authored-by: Brian Manifold <bmanifold@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Dryga <andrew@dryga.com> Co-authored-by: Gabi <gabrielalejandro7@gmail.com>
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: Static Analysis
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
version-check:
|
|
runs-on: macos-14
|
|
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@v5
|
|
with:
|
|
python-version: "3.11"
|
|
- uses: actions/cache/restore@v4
|
|
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: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y shfmt
|
|
- name: Run pre-commit
|
|
run: |
|
|
pre-commit install
|
|
SKIP=no-commit-to-branch pre-commit run --all-files
|
|
- uses: actions/cache/save@v4
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
name: Save Python Cache
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ubuntu-22.04-${{ runner.arch }}-pip-${{ hashFiles('requirements.txt') }}
|