generated from aifrak/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
ex_check
and its curated tools (#80)
- Rework way to cache - Set `npm_cache` - Bump `npm` from 7.20.1 to 7.20.5
- Loading branch information
Showing
19 changed files
with
181 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
tools: [ | ||
# Curated tools from ex_check | ||
{:compiler, env: %{"MIX_ENV" => "test"}}, | ||
{:ex_doc, env: %{"MIX_ENV" => "test"}}, | ||
{:formatter, env: %{"MIX_ENV" => "test"}}, | ||
{:npm_test, false}, | ||
{ | ||
:sobelow, | ||
"mix sobelow --config", | ||
env: %{"MIX_ENV" => "test"}, detect: [{:package, :phoenix, else: :disable}] | ||
}, | ||
|
||
# Custom lints | ||
{:dockerfile_lint, "./run dockerfile:lint"}, | ||
{:elixir_eex_lint, "./run elixir:eex:lint"}, | ||
{:markdown_lint, "./run markdown:lint"}, | ||
{:prettier_lint, "./run prettier:lint"}, | ||
{:shell_lint, "./run shell:lint"} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# NodeJS | ||
node_modules/ | ||
npm_cache/ | ||
|
||
# Elixir | ||
_build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%Doctor.Config{ | ||
exception_moduledoc_required: true, | ||
failed: false, | ||
ignore_modules: [], | ||
ignore_paths: [], | ||
min_module_doc_coverage: 100, | ||
min_module_spec_coverage: 100, | ||
min_overall_doc_coverage: 100, | ||
min_overall_spec_coverage: 100, | ||
moduledoc_required: true, | ||
raise: true, | ||
reporter: Doctor.Reporters.Full, | ||
struct_type_spec_required: true, | ||
umbrella: false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter,.credo}.exs", "{config,lib,test}/**/*.{ex,exs}"], | ||
inputs: ["*.exs", "{config,lib,test}/**/*.{ex,exs}", ".sobelow-conf"], | ||
line_length: 98 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,65 +62,62 @@ jobs: | |
./run dc:up | ||
# ---------------------------------------------- # | ||
# Elixir # | ||
# Cache # | ||
# ---------------------------------------------- # | ||
|
||
- name: Add Elixir and Erlang versions as environment variables | ||
- name: Get versions | ||
run: | | ||
echo "NODE_VERSION=$(./run dc:exec npm -v)" >> $GITHUB_ENV | ||
echo "ELIXIR_VERSION=$(./run dc:exec ./run elixir:version)" >> $GITHUB_ENV | ||
echo "ERLANG_VERSION=$(./run dc:exec ./run erlang:version)" >> $GITHUB_ENV | ||
- name: Build Elixir cache | ||
id: elixir-cache | ||
- name: Cache Elixir deps | ||
id: elixir-deps-cache | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
**/deps | ||
**/_build | ||
key: "\ | ||
${{ runner.os }}-mix-\ | ||
${{ env.ELIXIR_VERSION }}-\ | ||
${{ env.ERLANG_VERSION }}-\ | ||
${{ hashFiles('**/mix.lock') }}\ | ||
" | ||
restore-keys: "\ | ||
${{ runner.os }}-mix-\ | ||
${{ env.ELIXIR_VERSION }}-\ | ||
${{ env.ERLANG_VERSION }}-\ | ||
" | ||
|
||
- name: Install Elixir dependencies | ||
if: steps.elixir-cache.outputs.cache-hit != 'true' | ||
run: | | ||
./run dc:exec mix deps.get | ||
- name: Compile Elixir application (test) | ||
if: steps.elixir-cache.outputs.cache-hit != 'true' | ||
run: | | ||
./run dc:exec bash -c "MIX_ENV=test mix compile" | ||
# ---------------------------------------------- # | ||
# NodeJS # | ||
# ---------------------------------------------- # | ||
key: | | ||
${{ runner.os }}-elixir-deps-${{ env.ELIXIR_VERSION }}-${{ env.ERLANG_VERSION }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-elixir-deps-${{ env.ELIXIR_VERSION }}-${{ env.ERLANG_VERSION }}- | ||
- name: Add NodeJS version as environment variable | ||
run: | | ||
echo "NODE_VERSION=$(./run dc:exec npm -v)" >> $GITHUB_ENV | ||
- name: Cache Elixir build | ||
id: elixir-build-cache | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
**/_build | ||
**/priv/plts/*.plt | ||
**/priv/plts/*.plt.hash | ||
**/.sobelow | ||
key: | | ||
${{ runner.os }}-elixir-build-${{ env.ELIXIR_VERSION }}-${{ env.ERLANG_VERSION }}-${{ hashFiles('**/mix.lock') }}-${{ hashFiles( '**/lib/**/*.{ex,eex}', '**/config/*.exs', '**/mix.exs' ) }} | ||
restore-keys: | | ||
${{ runner.os }}-elixir-build-${{ env.ELIXIR_VERSION }}-${{ env.ERLANG_VERSION }}-${{ hashFiles('**/mix.lock') }}- | ||
${{ runner.os }}-elixir-build-${{ env.ELIXIR_VERSION }}-${{ env.ERLANG_VERSION }}- | ||
- name: Build node modules cache | ||
- name: Cache node modules | ||
uses: actions/[email protected] | ||
id: node-modules-cache | ||
with: | ||
path: | | ||
**/node_modules | ||
key: "\ | ||
${{ runner.os }}-node-\ | ||
${{ env.NODE_VERSION }}-\ | ||
${{ hashFiles('**/package-lock.json') }}\ | ||
" | ||
**/npm_cache | ||
key: | | ||
${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ env.NODE_VERSION }}- | ||
# ---------------------------------------------- # | ||
# Dependencies # | ||
# ---------------------------------------------- # | ||
|
||
- name: Fetch and compile Elixir dependencies | ||
if: steps.elixir-deps-cache.outputs.cache-hit != 'true' | ||
run: | | ||
./run dc:exec bash -c "mix deps.get && mix deps.compile" | ||
- name: Install node modules | ||
if: steps.node-modules-cache.outputs.cache-hit != 'true' | ||
run: | | ||
|
@@ -130,10 +127,11 @@ jobs: | |
# Application # | ||
# ---------------------------------------------- # | ||
|
||
- name: Test | ||
- name: Compile Elixir application | ||
if: steps.elixir-build-cache.outputs.cache-hit != 'true' | ||
run: | | ||
./run dc:exec ./run test | ||
./run dc:exec bash -c "MIX_ENV=test mix compile" | ||
- name: Lint | ||
- name: Run all checks | ||
run: | | ||
./run dc:exec ./run lint | ||
./run dc:exec mix check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# NodeJS | ||
node_modules/ | ||
npm_cache/ | ||
|
||
# Elixir | ||
_build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
cache=npm_cache | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ vendor/ | |
|
||
# NodeJS | ||
node_modules/ | ||
npm_cache/ | ||
|
||
# Elixir | ||
_build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ vendor/ | |
|
||
# Node | ||
node_modules/ | ||
npm_cache/ | ||
|
||
# Elixir | ||
_build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
verbose: false, | ||
private: false, | ||
skip: true, | ||
router: "", | ||
exit: "low", | ||
format: "txt", | ||
out: "", | ||
threshold: "low", | ||
ignore: [""], | ||
ignore_files: [""] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ RUN set -e \ | |
&& mix local.rebar --force | ||
|
||
FROM node:16.6.1-buster as node | ||
RUN npm install -g [email protected].1 --quiet | ||
RUN npm install -g [email protected].5 --quiet | ||
|
||
FROM koalaman/shellcheck:v0.7.2 as shellcheck | ||
FROM mvdan/shfmt:v3.3.1 as shfmt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.