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.
Rework by importing changes from template-repo (#6)
- Add `credo` - Add `dependabot` - Add VSCode devcontainer - Add `husky` - Add `prettier` - Add `prettier-plugin-eex` - Add `markdownlint-cli` - Put `test` and `lint` in same workflow - Add `run` file to test, lint and format - Add `Dockerfile` containing project environement - Be able to use `git` correctly with docker `dev` target - Add documentations - Bump `elixir` - Bump `npm`
- Loading branch information
Showing
50 changed files
with
1,825 additions
and
579 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,44 @@ | ||
%{ | ||
configs: [ | ||
%{ | ||
name: "default", | ||
files: %{ | ||
included: ["lib/", "test/", "mix.exs", ".credo.exs", ".formatter.exs"], | ||
excluded: [] | ||
}, | ||
strict: true, | ||
checks: [ | ||
{Credo.Check.Design.AliasUsage, []}, | ||
# Avoid vscode-elixir-credo showing warnings wherease credo excludes ".exs" files. | ||
# see: https://github.com/rrrene/credo/blob/master/lib/credo/check/readability/module_doc.ex | ||
{Credo.Check.Readability.MaxLineLength, [max_length: 98]}, | ||
{Credo.Check.Readability.ModuleDoc, [files: %{excluded: ["**/*.exs"]}]}, | ||
{Credo.Check.Warning.MixEnv, [files: %{excluded: ["mix.exs"]}]}, | ||
|
||
# Controversial and experimental checks | ||
{Credo.Check.Consistency.MultiAliasImportRequireUse, []}, | ||
{Credo.Check.Consistency.UnusedVariableNames, []}, | ||
{Credo.Check.Design.DuplicatedCode, []}, | ||
{Credo.Check.Readability.AliasAs, []}, | ||
{Credo.Check.Readability.BlockPipe, []}, | ||
{Credo.Check.Readability.ImplTrue, []}, | ||
{Credo.Check.Readability.MultiAlias, []}, | ||
{Credo.Check.Readability.SeparateAliasRequire, []}, | ||
{Credo.Check.Readability.SinglePipe, []}, | ||
{Credo.Check.Readability.Specs, [files: %{excluded: ["mix.exs"]}]}, | ||
{Credo.Check.Readability.StrictModuleLayout, []}, | ||
{Credo.Check.Readability.WithCustomTaggedTuple, []}, | ||
{Credo.Check.Refactor.ABCSize, []}, | ||
{Credo.Check.Refactor.AppendSingleItem, []}, | ||
{Credo.Check.Refactor.DoubleBooleanNegation, []}, | ||
{Credo.Check.Refactor.ModuleDependencies, []}, | ||
{Credo.Check.Refactor.NegatedIsNil, []}, | ||
{Credo.Check.Refactor.PipeChainStart, []}, | ||
{Credo.Check.Refactor.VariableRebinding, []}, | ||
{Credo.Check.Warning.LeakyEnvironment, []}, | ||
{Credo.Check.Warning.MapGetUnsafePass, []}, | ||
{Credo.Check.Warning.UnsafeToAtom, []} | ||
] | ||
} | ||
] | ||
} |
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,25 +1,53 @@ | ||
{ | ||
"name": "Existing Docker Compose (Extend)", | ||
"dockerComposeFile": ["../docker-compose.yml", "../docker-compose.dev.yml"], | ||
"name": "template-elixir", | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"../docker-compose.dev.yml", | ||
"docker-compose.yml" | ||
], | ||
"service": "app", | ||
"workspaceFolder": "/app", | ||
"settings": { | ||
"shellformat.path": "/usr/local/bin/shfmt" | ||
}, | ||
"extensions": [ | ||
// Settings | ||
// Elixir | ||
"jakebecker.elixir-ls", | ||
"pantajoe.vscode-elixir-credo", | ||
|
||
// EditorConfig | ||
"editorconfig.editorconfig", | ||
|
||
// Github Actions | ||
"cschleiden.vscode-github-actions", | ||
|
||
// Docker | ||
"ms-azuretools.vscode-docker", | ||
|
||
// Dockerfile | ||
"exiasr.hadolint", | ||
|
||
// Shell | ||
"foxundermoon.shell-format", | ||
"timonwong.shellcheck", | ||
|
||
// Markdown | ||
"davidanson.vscode-markdownlint", | ||
"yzhang.markdown-all-in-one", | ||
|
||
// Format | ||
"esbenp.prettier-vscode", | ||
// YAML | ||
"redhat.vscode-yaml", | ||
|
||
// Spelling | ||
"streetsidesoftware.code-spell-checker", | ||
// Gitignore | ||
"codezombiech.gitignore", | ||
|
||
// Elixir | ||
"jakebecker.elixir-ls", | ||
// Formatters | ||
"esbenp.prettier-vscode", | ||
|
||
// Dockerfile | ||
"exiasr.hadolint" | ||
// Comments | ||
"stackbreak.comment-divider", | ||
|
||
// Spelling | ||
"streetsidesoftware.code-spell-checker" | ||
] | ||
} |
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,13 @@ | ||
version: "3.9" | ||
|
||
services: | ||
app: | ||
build: | ||
target: vscode | ||
volumes: | ||
- vscode:/home/app-user/.vscode-server/extensions | ||
- vscode-insiders:/home/app-user/.vscode-server-insiders/extensions | ||
|
||
volumes: | ||
vscode: | ||
vscode-insiders: |
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,17 @@ | ||
# VSCode | ||
.history/ | ||
|
||
# NodeJS | ||
node_modules/ | ||
|
||
# Elixir | ||
_build/ | ||
cover/ | ||
deps/ | ||
doc/ | ||
.fetch/ | ||
erl_crash.dump | ||
*.ez | ||
*.beam | ||
/config/*.secret.exs | ||
.elixir_ls/ |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter,.credo}.exs", "{config,lib,test}/**/*.{ex,exs}"], | ||
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: 2 | ||
|
||
# By default, Dependabot checks for new versions on Monday at 05:00 UTC. | ||
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#scheduleday | ||
|
||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
ignore: | ||
- dependency-name: "node" | ||
update-types: ["version-update:semver-major"] | ||
|
||
- package-ecosystem: "mix" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,19 @@ | ||
name: Dependabot auto merge | ||
|
||
# Check Dependabot every Monday at 05:30 UTC (30 min after Dependabot) | ||
on: | ||
schedule: | ||
- cron: "30 5 * * MON" | ||
|
||
jobs: | ||
auto-merge: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Dependabot auto merge | ||
uses: PabioHQ/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
auto-label: true | ||
approve: true | ||
merge-minor: true | ||
merge-patch: 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Create release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag-version: | ||
description: "Version (format: x.y.z)" | ||
required: true | ||
|
||
jobs: | ||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
|
||
- name: Built tag | ||
id: build-tag | ||
run: | | ||
TAG_VERSION="${{ github.event.inputs.tag-version }}" | ||
BUILT_TAG="v${TAG_VERSION}" | ||
echo "::set-output name=tag::${BUILT_TAG}" | ||
- name: Create tag | ||
uses: tvdias/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.build-tag.outputs.tag }} | ||
|
||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.build-tag.outputs.tag }} | ||
draft: true | ||
prerelease: false |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,52 @@ | ||
name: Tests | ||
|
||
on: [pull_request, push] | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-20.04 | ||
|
||
env: | ||
IMAGE_TARGET: base | ||
IMAGE_TAG: aifrak/template-elixir:latest | ||
CACHE_OLD: /tmp/.buildx-cache | ||
CACHE_NEW: /tmp/.buildx-cache-new | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
- name: Cache Docker layers | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build image and cache | ||
uses: docker/[email protected] | ||
with: | ||
load: true | ||
target: ${{ env.IMAGE_TARGET }} | ||
tags: ${{ env.IMAGE_TAG }} | ||
cache-from: type=local,src=${{ env.CACHE_OLD }} | ||
cache-to: type=local,dest=${{ env.CACHE_NEW }} | ||
|
||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf ${{ env.CACHE_OLD }} | ||
mv ${{ env.CACHE_NEW }} ${{ env.CACHE_OLD }} | ||
- name: Test | ||
run: ./run dc:run test | ||
|
||
- name: Lint | ||
run: ./run dc:run lint |
Oops, something went wrong.