Skip to content

Commit

Permalink
chore: sync files with stordco/common-config-elixir (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 3e40b70 commit 13cd484
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 177 deletions.
20 changes: 18 additions & 2 deletions .credo.exs
Expand Up @@ -24,7 +24,7 @@
# In the latter case `**/*.{ex,exs}` will be used.
#
included: ["config/", "lib/", "priv/", "test/"],
excluded: [~r"/_build/", ~r"/deps/"]
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
# Load and configure plugins here:
Expand Down Expand Up @@ -58,6 +58,11 @@
# {Credo.Check.Design.DuplicatedCode, false}
#
checks: [
#
## Database Migration Checks
#
{ExcellentMigrations.CredoCheck.MigrationsSafety, []},

#
## Consistency Checks
#
Expand Down Expand Up @@ -114,7 +119,8 @@
[
order:
~w(moduledoc behaviour use import require alias module_attribute defstruct callback macrocallback optional_callback)a,
ignore: [:type]
ignore: [:type],
ignore_module_attributes: [:contract, :decorate, :operation, :trace]
]},
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
Expand Down Expand Up @@ -173,6 +179,16 @@
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []},

#
## Custom
#
{Credo.Check.Warning.ForbiddenModule,
[
modules: [
{Oban.Worker, "use Oban.Pro.Worker instead"}
]
]}
]
}
]
Expand Down
8 changes: 6 additions & 2 deletions .formatter.exs
@@ -1,4 +1,8 @@
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten.

[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
line_length: 120
import_deps: [],
inputs: ["*.{heex,ex,exs}", "{config,lib,priv,test}/**/*.{heex,ex,exs}"],
line_length: 120,
plugins: []
]
153 changes: 153 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,153 @@
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten.

name: CI

on:
merge_group:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
- code-freeze/**
workflow_call:
secrets:
CI_SERVICE_KEY:
required: true
GH_PERSONAL_ACCESS_TOKEN:
required: true
HEX_API_KEY:
required: true
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Credo:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Credo
run: mix credo --strict

Dependencies:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Unused
run: mix deps.unlock --check-unused

Dialyzer:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Dialyzer
run: mix dialyzer --format github

Documentation:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Docs
run: mix docs

Format:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Format
run: mix format --check-formatted

Test:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
runs-on: ubuntu-latest

env:
MIX_ENV: test


steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}

- name: Compile
run: mix compile --warnings-as-errors

- name: Test
run: mix coveralls.github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

127 changes: 0 additions & 127 deletions .github/workflows/ci.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/common-config-elixir.yaml
Expand Up @@ -34,9 +34,11 @@ jobs:
- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
elixir-version: "1.15"
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
hex-token: ${{ secrets.HEX_API_KEY }}
elixir-version: "1.15"
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
otp-version: "26.0"

- name: Sync
Expand All @@ -50,3 +52,4 @@ jobs:
sync-auth: stord-engineering-account:${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
sync-branch: latest
sync-repository: github.com/stordco/common-config-elixir.git

34 changes: 34 additions & 0 deletions .github/workflows/pr.yaml
@@ -0,0 +1,34 @@
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten.

name: PR

on:
merge_group:
pull_request:
types:
- edited
- opened
- reopened
- synchronize

jobs:
Title:
if: ${{ github.event_name == 'pull_request' }}

runs-on: ubuntu-latest

steps:
- name: Check
uses: stordco/actions-pr-title@v1.0.0
with:
regex: '^(feat!|fix!|fix|feat|chore|(fix|feat|chore)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*'
hint: |
Your PR title does not match the Stord common convention. Please rename your PR to match one of the following formats:
chore: a small insignificant change
fix: [JIRA-1234] fix an existing feature
feat: [JIRA-1234] a new feature to release
feat!: a breaking change
Note: Adding ! (i.e. `feat!:`) represents a breaking change and will result in a SemVer major release.

0 comments on commit 13cd484

Please sign in to comment.