Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync files with stordco/common-config-elixir #1

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions .credo.exs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.