Skip to content

Commit

Permalink
chore: sync files with stordco/common-config-elixir
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 2, 2024
1 parent 23ad7fc commit 79b6d01
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 47 deletions.
19 changes: 15 additions & 4 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# You can give explicit globs or simply directories.
# In the latter case `**/*.{ex,exs}` will be used.
#
included: ["lib/", "priv/", "test/"],
included: ["config/", "lib/", "priv/", "test/"],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
Expand Down Expand Up @@ -81,7 +81,7 @@
# You can customize the priority of any check
# Priority values are: `low, normal, high, higher`
#
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 2]},
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 4, if_called_more_often_than: 2]},
{Credo.Check.Design.DuplicatedCode, false},
# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
Expand Down Expand Up @@ -119,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 @@ -177,7 +178,17 @@
{Credo.Check.Warning.UnusedPathOperation, []},
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []}
{Credo.Check.Warning.UnusedTupleOperation, []},

#
## Custom
#
{Credo.Check.Warning.ForbiddenModule,
[
modules: [
{Oban.Worker, "use Oban.Pro.Worker instead"}
]
]}
]
}
]
Expand Down
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Related Ticket(s)

<!--
Enter the Jira issue below in the following format: PROJECT-##
-->

## Checklist

<!--
For each bullet, ensure your pr meets the criteria and write a note explaining how this PR relates. Mark them as complete as they are done. All top-level checkboxes should be checked regardless of their relevance to the pr with a note explaining whether they are relevant or not.
-->

- [ ] Code conforms to the [Elixir Styleguide](https://github.com/christopheradams/elixir_style_guide)

## Problem

<!--
What is the problem you're solving or feature you're implementing? Link to any Jira tickets or previous discussions of the issue.
-->

## Details

<!--
Include a brief overview of the technical process you took (or are going to take!) to get from the problem to the solution.
-->
28 changes: 28 additions & 0 deletions .github/release-please-config-hotfix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$comment": "This file is synced with stordco/common-config-elixir. Any changes will be overwritten.",
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"changelog-sections": [
{
"type": "hotfix",
"section": "Hotfixes",
"hidden": false
}
],
"draft": false,
"draft-pull-request": false,
"packages": {
".": {
"extra-files": ["README.md"],
"release-type": "elixir"
}
},
"plugins": [
{
"type": "sentence-case"
}
],
"prerelease": false,
"pull-request-header": "An automated hotfix release has been created for you.",
"pull-request-title-pattern": "chore(main): release hotfix ${version}",
"separate-pull-requests": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"section": "Features",
"hidden": false
},
{
"type": "hotfix",
"section": "Hotfixes",
"hidden": true
},
{
"type": "fix",
"section": "Bug Fixes",
Expand All @@ -22,9 +27,7 @@
"draft-pull-request": false,
"packages": {
".": {
"extra-files": [
"README.md"
],
"extra-files": ["README.md"],
"release-type": "elixir"
}
},
Expand Down
File renamed without changes.
153 changes: 141 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,120 +1,249 @@
# 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
merge_group:
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:
Changed:
name: Changed Files
runs-on: ubuntu-latest

outputs:
database: ${{ steps.changed.outputs.database_any_changed }}
docker: ${{ steps.changed.outputs.docker_any_changed }}
elixir: ${{ steps.changed.outputs.elixir_any_changed }}
helm: ${{ steps.changed.outputs.helm_any_changed }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- id: changed
name: Get Changed Files
uses: tj-actions/changed-files@v44
with:
files_yaml: |
database:
- '.github/workflows/ci.yaml'
- 'priv/*repo/**'
docker:
- '.github/workflows/ci.yaml'
- 'Dockerfile'
documentation:
- 'docs/**'
- 'priv/documentation/**'
- '**.ex'
- '**.md'
elixir:
- '.github/workflows/ci.yaml'
- '.tool-versions'
- 'priv/**'
- '**.ex'
- '**.exs'
- '**.heex'
helm:
- '.github/workflows/ci.yaml'
- '.github/workflows/staging.yaml'
- '.github/workflows/production.yaml'
- 'helm/**'
Credo:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
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
run: mix credo --strict

Deps:
Dependencies:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

env:
MIX_ENV: test

steps:
- name: Checkout
uses: actions/checkout@v3
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') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
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

Docs:
Documentation:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.documentation == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
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') && needs.Changed.outputs.elixir == 'true' }}
needs: [Changed]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
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:
name: Test (Elixir ${{ matrix.versions.elixir }} OTP ${{ matrix.versions.otp }})

runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MIX_ENV: test


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

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
elixir-version: ${{ matrix.versions.elixir }}
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 }}
otp-version: ${{ matrix.versions.otp }}

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

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

strategy:
fail-fast: false
matrix:
versions:
- elixir: 1.13
otp: 25
- elixir: 1.14
otp: 25
- elixir: 1.15
otp: 26

Trivy_Filesystem:
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
name: Trivy Filesystem Scan
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write
pull-requests: write

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: Trivy Scan
uses: stordco/[email protected]
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
scan-type: fs
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}

Loading

0 comments on commit 79b6d01

Please sign in to comment.