Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Feb 28, 2022
1 parent b22b12d commit 413d0d9
Show file tree
Hide file tree
Showing 42 changed files with 1,314 additions and 368 deletions.
47 changes: 47 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
%{
configs: [
%{
name: "default",
strict: true,
files: %{
included: [
"{mix,.formatter,.credo}.exs",
"config/*.exs",
"lib/",
"src/",
"test/",
"priv/repo/"
],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
checks: [
# Remove Rule because two rejects improve readability and performance is not an issue
{Credo.Check.Refactor.RejectReject, false},
{Credo.Check.Design.TagTODO, exit_status: 0},
{Credo.Check.Design.TagFIXME, exit_status: 0},
{Credo.Check.Readability.StrictModuleLayout, []},
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
{Credo.Check.Consistency.UnusedVariableNames, []},
# TODO: Enable
# {Credo.Check.Design.DuplicatedCode, []},
{Credo.Check.Readability.AliasAs, false},
{Credo.Check.Readability.MultiAlias, []},
# TODO: Enable
# {Credo.Check.Readability.Specs, []},
{Credo.Check.Readability.SinglePipe, []},
{Credo.Check.Readability.WithCustomTaggedTuple, []},
{Credo.Check.Refactor.ABCSize, max_size: 100},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.DoubleBooleanNegation, []},
{Credo.Check.Refactor.ModuleDependencies, false},
{Credo.Check.Refactor.NegatedIsNil, []},
{Credo.Check.Refactor.PipeChainStart, excluded_functions: ["from"]},
{Credo.Check.Refactor.VariableRebinding, false},
{Credo.Check.Warning.LeakyEnvironment, []},
{Credo.Check.Warning.MapGetUnsafePass, []},
{Credo.Check.Warning.UnsafeToAtom, []},
{Credo.Check.Refactor.Nesting, max_nesting: 3}
]
}
]
}
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.dockerignore
# there are valid reasons to keep the .git, namely so that you can get the
# current commit hash
#.git
.log
tmp

# Mix artifacts
_build
deps
*.ez
releases

# Generate on crash by the VM
erl_crash.dump

# Static artifacts
node_modules
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: mix
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: "assets/"
schedule:
interval: daily
open-pull-requests-limit: 10
41 changes: 41 additions & 0 deletions .github/workflows/branch_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
push:
branches:
- "main"

name: "Main Branch"

# Secrets:
# * CACHE_VERSION - Set to `date +%s`, set new when the cache should be busted

jobs:
detectToolVersions:
name: "Detect Tool Versions"

uses: maennchen/athena/.github/workflows/part_tool_versioning.yml@main

test:
name: "Test"

needs: ['detectToolVersions']

uses: maennchen/athena/.github/workflows/part_test.yml@main
with:
elixirVersion: "${{ needs.detectToolVersions.outputs.elixirVersion }}"
otpVersion: "${{ needs.detectToolVersions.outputs.otpVersion }}"
secrets:
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"

build:
name: "Build"

needs: ['detectToolVersions']

uses: maennchen/athena/.github/workflows/part_build.yml@main
with:
elixirVersion: "${{ needs.detectToolVersions.outputs.elixirVersion }}"
otpVersion: "${{ needs.detectToolVersions.outputs.otpVersion }}"
nodeVersion: "${{ needs.detectToolVersions.outputs.nodeVersion }}"
dockerTag: "${{ github.ref_name }}"
secrets:
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"
33 changes: 33 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
schedule:
# Every Day Midnight
- cron: '0 0 * * *'
workflow_dispatch: {}

name: "Daily"

jobs:
checkAsdfUpdatesElixir:
name: "ASDF Update Elixir"

uses: maennchen/athena/.github/workflows/part_asdf_update.yml@main
with:
plugin: "elixir"
constraint: "1"

checkAsdfUpdatesErlang:
name: "ASDF Update Erlang"

uses: maennchen/athena/.github/workflows/part_asdf_update.yml@main
with:
plugin: "erlang"
constraint: "24"

checkAsdfUpdatesNodeJs:
name: "ASDF Update Node.js"

uses: maennchen/athena/.github/workflows/part_asdf_update.yml@main
with:
plugin: "nodejs"
constraint: "16"

174 changes: 0 additions & 174 deletions .github/workflows/elixir.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/part_asdf_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
on:
workflow_call:
inputs:
plugin:
type: string
required: true
constraint:
type: string
default: ""
required: false

name: "ASDF Update"

jobs:
compile_assets:
name: "${{ inputs.plugin }}"

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v2
- name: ASDF Install
uses: asdf-vm/actions/install@v1
- name: "Get Newest Version"
id: newestVersion
run: |
LATEST_VERSION=$(asdf latest "${{ inputs.plugin }}" "${{ inputs.constraint }}")
echo "Latest (${{ inputs.constraint }}): $LATEST_VERSION"
echo ::set-output name=LATEST_VERSION::${LATEST_VERSION}
- name: "Try Installing new version"
run: |
asdf install "${{ inputs.plugin }}" "${{ steps.newestVersion.outputs.LATEST_VERSION }}"
- name: "Apply latest version to .tool-versions"
run: |
asdf local "${{ inputs.plugin }}" "${{ steps.newestVersion.outputs.LATEST_VERSION }}"
- uses: peter-evans/create-pull-request@v3
with:
add-paths: '.tool-versions'
commit-message: 'Update ${{ inputs.plugin }} to ${{ steps.newestVersion.outputs.LATEST_VERSION }}'
title: 'Update ${{ inputs.plugin }} to ${{ steps.newestVersion.outputs.LATEST_VERSION }}'
branch: 'asdf/${{ inputs.plugin }}/${{ steps.newestVersion.outputs.LATEST_VERSION }}'
delete-branch: true
labels: 'asdf,enhancement'
Loading

0 comments on commit 413d0d9

Please sign in to comment.