mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
79 lines
2.7 KiB
YAML
79 lines
2.7 KiB
YAML
name: Static Analysis
|
|
on:
|
|
# TODO: Enable this for PRs against `cloud` when chaos settles
|
|
# pull_request:
|
|
push:
|
|
branches:
|
|
- cloud
|
|
|
|
jobs:
|
|
static-analysis:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
MIX_ENV: dev
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "16"
|
|
cache: "yarn"
|
|
cache-dependency-path: |
|
|
elixir/apps/web/assets/yarn.lock
|
|
www/yarn.lock
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.9"
|
|
- id: setup-beam
|
|
uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: "25"
|
|
elixir-version: "1.14"
|
|
- uses: actions/cache@v3
|
|
name: Elixir Deps Cache
|
|
env:
|
|
cache-name: cache-elixir-deps
|
|
with:
|
|
# XXX: We've purposefully omitted caching the _build directory here because we
|
|
# force-recompile in the pre-commit run below in order to catch any compilation warnings.
|
|
path: deps
|
|
key: ${{ github.workflow }}-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ github.workflow }}-${{ runner.os }}-${{ env.cache-name }}-
|
|
- uses: actions/cache@v3
|
|
name: Setup Python cache
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
- name: Install Elixir Dependencies
|
|
run: mix deps.get --only $MIX_ENV
|
|
- name: Install Python Dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
|
|
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
|
|
- name: Restore PLT cache
|
|
uses: actions/cache@v3
|
|
id: plt_cache
|
|
with:
|
|
key: |
|
|
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-plt
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ steps.setup-beam.outputs.otp-version }}-plt
|
|
path: |
|
|
priv/plts
|
|
# Create PLTs if no cache was found
|
|
- name: Create PLTs
|
|
if: steps.plt_cache.outputs.cache-hit != 'true'
|
|
run: mix dialyzer --plt
|
|
- name: Install node modules
|
|
run: |
|
|
cd www/
|
|
yarn install --frozen-lockfile
|
|
- name: Run pre-commit
|
|
run: |
|
|
pre-commit install
|
|
SKIP=no-commit-to-branch pre-commit run --all-files
|