Skip to content

Commit 00ba242

Browse files
chore: sync files with stordco/common-config-elixir
1 parent 1807c0e commit 00ba242

12 files changed

+365
-47
lines changed

.credo.exs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# You can give explicit globs or simply directories.
2424
# In the latter case `**/*.{ex,exs}` will be used.
2525
#
26-
included: ["lib/", "priv/", "test/"],
26+
included: ["config/", "lib/", "priv/", "test/"],
2727
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
2828
},
2929
#
@@ -81,7 +81,7 @@
8181
# You can customize the priority of any check
8282
# Priority values are: `low, normal, high, higher`
8383
#
84-
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 2]},
84+
{Credo.Check.Design.AliasUsage, [priority: :low, if_nested_deeper_than: 4, if_called_more_often_than: 2]},
8585
{Credo.Check.Design.DuplicatedCode, false},
8686
# You can also customize the exit_status of each check.
8787
# If you don't want TODO comments to cause `mix credo` to fail, just
@@ -119,7 +119,8 @@
119119
[
120120
order:
121121
~w(moduledoc behaviour use import require alias module_attribute defstruct callback macrocallback optional_callback)a,
122-
ignore: [:type]
122+
ignore: [:type],
123+
ignore_module_attributes: [:contract, :decorate, :operation, :trace]
123124
]},
124125
{Credo.Check.Readability.StringSigils, []},
125126
{Credo.Check.Readability.TrailingBlankLine, []},
@@ -177,7 +178,17 @@
177178
{Credo.Check.Warning.UnusedPathOperation, []},
178179
{Credo.Check.Warning.UnusedRegexOperation, []},
179180
{Credo.Check.Warning.UnusedStringOperation, []},
180-
{Credo.Check.Warning.UnusedTupleOperation, []}
181+
{Credo.Check.Warning.UnusedTupleOperation, []},
182+
183+
#
184+
## Custom
185+
#
186+
{Credo.Check.Warning.ForbiddenModule,
187+
[
188+
modules: [
189+
{Oban.Worker, "use Oban.Pro.Worker instead"}
190+
]
191+
]}
181192
]
182193
}
183194
]

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Related Ticket(s)
2+
3+
<!--
4+
Enter the Jira issue below in the following format: PROJECT-##
5+
-->
6+
7+
## Checklist
8+
9+
<!--
10+
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.
11+
-->
12+
13+
- [ ] Code conforms to the [Elixir Styleguide](https://github.com/christopheradams/elixir_style_guide)
14+
15+
## Problem
16+
17+
<!--
18+
What is the problem you're solving or feature you're implementing? Link to any Jira tickets or previous discussions of the issue.
19+
-->
20+
21+
## Details
22+
23+
<!--
24+
Include a brief overview of the technical process you took (or are going to take!) to get from the problem to the solution.
25+
-->

.release-please-config.json renamed to .github/release-please-config-stable.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"section": "Features",
88
"hidden": false
99
},
10+
{
11+
"type": "hotfix",
12+
"section": "Hotfixes",
13+
"hidden": true
14+
},
1015
{
1116
"type": "fix",
1217
"section": "Bug Fixes",
@@ -22,9 +27,7 @@
2227
"draft-pull-request": false,
2328
"packages": {
2429
".": {
25-
"extra-files": [
26-
"README.md"
27-
],
30+
"extra-files": ["README.md"],
2831
"release-type": "elixir"
2932
}
3033
},
File renamed without changes.

.github/workflows/ci.yaml

Lines changed: 153 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,261 @@
1+
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten.
2+
13
name: CI
24

35
on:
6+
merge_group:
47
pull_request:
58
types:
69
- opened
710
- reopened
811
- synchronize
9-
merge_group:
12+
push:
13+
branches:
14+
- main
15+
- code-freeze/**
1016
workflow_call:
1117
secrets:
18+
CI_SERVICE_KEY:
19+
required: true
1220
GH_PERSONAL_ACCESS_TOKEN:
1321
required: true
1422
HEX_API_KEY:
1523
required: true
1624
workflow_dispatch:
1725

26+
concurrency:
27+
group: ${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
1830
jobs:
31+
Changed:
32+
name: Changed Files
33+
runs-on: ubuntu-latest
34+
35+
outputs:
36+
database: ${{ steps.changed.outputs.database }}
37+
docker: ${{ steps.changed.outputs.docker }}
38+
# Note: temporarily disabling documentation/OpenAPI validation in CI until a long term solution is found
39+
# documentation: ${{ steps.changed.outputs.documentation }}
40+
elixir: ${{ steps.changed.outputs.elixir }}
41+
helm: ${{ steps.changed.outputs.helm }}
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 2
48+
49+
- id: changed
50+
name: Get Changed Files
51+
run: |
52+
# Using fetch-depth 2 above, we should always be able to get the full list of changes files:
53+
# - In a pull-request, GHA merges the PR branch into main
54+
# - When pushed to main, we always squash merge, so there is only one new commit
55+
56+
CHANGED_FILES=$(git diff --name-only HEAD^1 HEAD)
57+
58+
declare -A patterns
59+
patterns["database"]=".github/workflows/ci.yaml priv/.*repo/.*"
60+
patterns["docker"]=".github/workflows/ci.yaml Dockerfile"
61+
patterns["documentation"]="docs/.* priv/documentation/.* .*.ex .*.md"
62+
patterns["elixir"]=".github/workflows/ci.yaml .tool-versions priv/.* .*.ex .*.exs .*.heex"
63+
patterns["helm"]=".github/workflows/ci.yaml .github/workflows/staging.yaml .github/workflows/production.yaml helm/.*"
64+
65+
for filetype in ${!patterns[@]}; do
66+
found="false"
67+
echo "==> Checking: $filetype"
68+
for pattern in ${patterns[$filetype]}; do
69+
for changed_file in $CHANGED_FILES; do
70+
if [[ "$changed_file" =~ $pattern ]]; then
71+
echo "====> Found change: $changed_file"
72+
found="true"
73+
break
74+
fi
75+
done
76+
if [[ "$found" == "true" ]]; then
77+
break
78+
fi
79+
done
80+
echo "$filetype=$found" >> $GITHUB_OUTPUT
81+
done
82+
1983
Credo:
84+
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
85+
needs: [Changed]
2086
runs-on: ubuntu-latest
2187

2288
steps:
2389
- name: Checkout
24-
uses: actions/checkout@v3
90+
uses: actions/checkout@v4
2591

2692
- name: Setup Elixir
2793
uses: stordco/actions-elixir/setup@v1
2894
with:
2995
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
3096
hex-token: ${{ secrets.HEX_API_KEY }}
97+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
98+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
3199

32100
- name: Credo
33-
run: mix credo
101+
run: mix credo --strict
34102

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

108+
env:
109+
MIX_ENV: test
110+
38111
steps:
39112
- name: Checkout
40-
uses: actions/checkout@v3
113+
uses: actions/checkout@v4
41114

42115
- name: Setup Elixir
43116
uses: stordco/actions-elixir/setup@v1
44117
with:
45118
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
46119
hex-token: ${{ secrets.HEX_API_KEY }}
120+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
121+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
47122

48123
- name: Unused
49124
run: mix deps.unlock --check-unused
50125

51126
Dialyzer:
127+
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
128+
needs: [Changed]
52129
runs-on: ubuntu-latest
53130

54131
steps:
55132
- name: Checkout
56-
uses: actions/checkout@v3
133+
uses: actions/checkout@v4
57134

58135
- name: Setup Elixir
59136
uses: stordco/actions-elixir/setup@v1
60137
with:
61138
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
62139
hex-token: ${{ secrets.HEX_API_KEY }}
140+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
141+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
63142

64143
- name: Dialyzer
65144
run: mix dialyzer --format github
66145

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

151+
env:
152+
MIX_ENV: test
153+
70154
steps:
71155
- name: Checkout
72-
uses: actions/checkout@v3
156+
uses: actions/checkout@v4
73157

74158
- name: Setup Elixir
75159
uses: stordco/actions-elixir/setup@v1
76160
with:
77161
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
78162
hex-token: ${{ secrets.HEX_API_KEY }}
163+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
164+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
79165

80166
- name: Docs
81167
run: mix docs
82168

83169
Format:
170+
if: ${{ !startsWith(github.head_ref, 'release-please--branches') && needs.Changed.outputs.elixir == 'true' }}
171+
needs: [Changed]
84172
runs-on: ubuntu-latest
85173

86174
steps:
87175
- name: Checkout
88-
uses: actions/checkout@v3
176+
uses: actions/checkout@v4
89177

90178
- name: Setup Elixir
91179
uses: stordco/actions-elixir/setup@v1
92180
with:
93181
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
94182
hex-token: ${{ secrets.HEX_API_KEY }}
183+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
184+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
95185

96186
- name: Format
97187
run: mix format --check-formatted
98188

99189
Test:
190+
name: Test (Elixir ${{ matrix.versions.elixir }} OTP ${{ matrix.versions.otp }})
191+
100192
runs-on: ubuntu-latest
101193

102194
env:
103-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104195
MIX_ENV: test
105196

197+
106198
steps:
107199
- name: Checkout
108-
uses: actions/checkout@v3
200+
uses: actions/checkout@v4
109201

110202
- name: Setup Elixir
111203
uses: stordco/actions-elixir/setup@v1
112204
with:
205+
elixir-version: ${{ matrix.versions.elixir }}
113206
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
114207
hex-token: ${{ secrets.HEX_API_KEY }}
208+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
209+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
210+
otp-version: ${{ matrix.versions.otp }}
115211

116212
- name: Compile
117213
run: mix compile --warnings-as-errors
118214

119215
- name: Test
120-
run: mix test
216+
run: mix coveralls.github --warnings-as-errors
217+
env:
218+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
219+
220+
strategy:
221+
fail-fast: false
222+
matrix:
223+
versions:
224+
- elixir: 1.13
225+
otp: 25
226+
- elixir: 1.14
227+
otp: 25
228+
- elixir: 1.15
229+
otp: 26
230+
231+
Trivy_Filesystem:
232+
if: ${{ !startsWith(github.head_ref, 'release-please--branches') }}
233+
name: Trivy Filesystem Scan
234+
runs-on: ubuntu-latest
235+
236+
permissions:
237+
contents: read
238+
id-token: write
239+
pull-requests: write
240+
241+
steps:
242+
- name: Checkout
243+
uses: actions/checkout@v4
244+
245+
- name: Setup Elixir
246+
uses: stordco/actions-elixir/setup@v1
247+
with:
248+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
249+
hex-token: ${{ secrets.HEX_API_KEY }}
250+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
251+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
252+
253+
- name: Trivy Scan
254+
uses: stordco/actions-trivy@v1
255+
with:
256+
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
257+
scan-type: fs
258+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
259+
slack-channel-id: ${{ secrets.SLACK_SECURITY_ALERTS }}
260+
update-db: false
261+

.github/workflows/common-config-elixir.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,24 @@ jobs:
2121

2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
with:
2626
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
2727
persist-credentials: true
2828

2929
- name: Setup Node
30-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
3131
with:
32-
node-version: 16
32+
node-version: 18
3333

3434
- name: Setup Elixir
3535
uses: stordco/actions-elixir/setup@v1
3636
with:
37+
elixir-version: "1.15"
3738
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
3839
hex-token: ${{ secrets.HEX_API_KEY }}
39-
elixir-version: "1.15"
40+
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }}
41+
oban-token: ${{ secrets.OBAN_LICENSE_KEY }}
4042
otp-version: "26.0"
4143

4244
- name: Sync

0 commit comments

Comments
 (0)