Cache deps for static analysis tools (#654)

This commit is contained in:
Jamil
2022-05-27 19:07:59 -07:00
committed by GitHub
parent 871ad985d3
commit 4da7fd5a88
7 changed files with 70 additions and 5 deletions

View File

@@ -36,11 +36,14 @@ jobs:
with:
ruby-version: '2.7'
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: erlef/setup-beam@v1
with:
otp-version: '25.0'
elixir-version: '1.13.4'
- uses: actions/cache@v2
name: Setup Elixir cache
with:
path: |
deps
@@ -48,8 +51,29 @@ jobs:
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- name: Install Dependencies
- uses: actions/cache@v2
name: Setup ruby cache
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: actions/cache@v2
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 dev
- name: Install Ruby Dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- 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 usefull when running in matrix)
- name: Restore PLT cache
@@ -66,9 +90,8 @@ jobs:
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- run: |
gem install rubocop
pip install pre-commit
- name: Run pre-commit
run: |
pre-commit install
SKIP=no-commit-to-branch pre-commit run --all-files

View File

@@ -27,7 +27,7 @@ repos:
files: \.ex$
- id: rubocop
name: 'ruby: rubocop'
entry: rubocop
entry: bundle exec rubocop
language: system
pass_filenames: false
files: \.rb$

View File

@@ -1,5 +1,6 @@
AllCops:
TargetRubyVersion: 2.7
Exclude:
- "vendor/**/*"
- "apps/fz_http/assets/node_modules/**/*"
- "omnibus/cookbooks/firezone/attributes/default.rb"

View File

@@ -3,4 +3,7 @@
nodejs 14.19.3
elixir 1.13.4-otp-25
erlang 25.0
# Used for static analysis
ruby 2.7.5
python 3.9.13

5
Gemfile Normal file
View File

@@ -0,0 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'rubocop'

32
Gemfile.lock Normal file
View File

@@ -0,0 +1,32 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
rainbow (3.1.1)
regexp_parser (2.4.0)
rexml (3.2.5)
rubocop (1.30.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
unicode-display_width (2.1.0)
PLATFORMS
ruby
DEPENDENCIES
rubocop
BUNDLED WITH
2.1.4

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
pre-commit