Skip to content

Commit 1bf92e1

Browse files
project skeleton setup
1 parent ef7437c commit 1bf92e1

50 files changed

Lines changed: 1577 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.credo.exs

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
%{
2+
configs: [
3+
%{
4+
name: "default",
5+
files: %{
6+
included: [
7+
"lib/",
8+
"src/",
9+
"test/",
10+
"web/",
11+
"apps/*/lib/",
12+
"apps/*/src/",
13+
"apps/*/test/",
14+
"apps/*/web/"
15+
],
16+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
17+
},
18+
plugins: [],
19+
requires: [],
20+
strict: true,
21+
parse_timeout: 5000,
22+
color: true,
23+
checks: %{
24+
enabled: [
25+
{Credo.Check.Consistency.ExceptionNames, []},
26+
{Credo.Check.Consistency.LineEndings, []},
27+
{Credo.Check.Consistency.ParameterPatternMatching, []},
28+
{Credo.Check.Consistency.SpaceAroundOperators, []},
29+
{Credo.Check.Consistency.SpaceInParentheses, []},
30+
{Credo.Check.Consistency.TabsOrSpaces, []},
31+
{Credo.Check.Design.AliasUsage,
32+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
33+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
34+
{Credo.Check.Design.TagFIXME, []},
35+
{Credo.Check.Readability.AliasOrder, []},
36+
{Credo.Check.Readability.FunctionNames, []},
37+
{Credo.Check.Readability.LargeNumbers, []},
38+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
39+
{Credo.Check.Readability.ModuleAttributeNames, []},
40+
{Credo.Check.Readability.ModuleDoc, []},
41+
{Credo.Check.Readability.ModuleNames, []},
42+
{Credo.Check.Readability.ParenthesesInCondition, []},
43+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
44+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
45+
{Credo.Check.Readability.PredicateFunctionNames, []},
46+
{Credo.Check.Readability.PreferImplicitTry, []},
47+
{Credo.Check.Readability.RedundantBlankLines, []},
48+
{Credo.Check.Readability.Semicolons, []},
49+
{Credo.Check.Readability.SpaceAfterCommas, []},
50+
{Credo.Check.Readability.StringSigils, []},
51+
{Credo.Check.Readability.TrailingBlankLine, []},
52+
{Credo.Check.Readability.TrailingWhiteSpace, []},
53+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
54+
{Credo.Check.Readability.VariableNames, []},
55+
{Credo.Check.Readability.WithSingleClause, []},
56+
{Credo.Check.Refactor.Apply, []},
57+
{Credo.Check.Refactor.CondStatements, []},
58+
{Credo.Check.Refactor.CyclomaticComplexity, []},
59+
{Credo.Check.Refactor.FunctionArity, []},
60+
{Credo.Check.Refactor.LongQuoteBlocks, []},
61+
{Credo.Check.Refactor.MatchInCondition, []},
62+
{Credo.Check.Refactor.MapJoin, []},
63+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
64+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
65+
{Credo.Check.Refactor.Nesting, [max_nesting: 3]},
66+
{Credo.Check.Refactor.UnlessWithElse, []},
67+
{Credo.Check.Refactor.WithClauses, []},
68+
{Credo.Check.Refactor.FilterFilter, []},
69+
{Credo.Check.Refactor.RejectReject, []},
70+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
71+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
72+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
73+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
74+
{Credo.Check.Warning.IExPry, []},
75+
{Credo.Check.Warning.IoInspect, []},
76+
{Credo.Check.Warning.OperationOnSameValues, []},
77+
{Credo.Check.Warning.OperationWithConstantResult, []},
78+
{Credo.Check.Warning.RaiseInsideRescue, []},
79+
{Credo.Check.Warning.SpecWithStruct, []},
80+
{Credo.Check.Warning.WrongTestFileExtension, []},
81+
{Credo.Check.Warning.UnusedEnumOperation, []},
82+
{Credo.Check.Warning.UnusedFileOperation, []},
83+
{Credo.Check.Warning.UnusedKeywordOperation, []},
84+
{Credo.Check.Warning.UnusedListOperation, []},
85+
{Credo.Check.Warning.UnusedPathOperation, []},
86+
{Credo.Check.Warning.UnusedRegexOperation, []},
87+
{Credo.Check.Warning.UnusedStringOperation, []},
88+
{Credo.Check.Warning.UnusedTupleOperation, []},
89+
{Credo.Check.Warning.UnsafeExec, []}
90+
],
91+
disabled: [
92+
{Credo.Check.Refactor.ModuleDependencies, []},
93+
{Credo.Check.Refactor.VariableRebinding, []},
94+
{Credo.Check.Warning.MapGetUnsafePass, []},
95+
{Credo.Check.Warning.UnsafeToAtom, []},
96+
{Credo.Check.Warning.LazyLogging, []}
97+
]
98+
}
99+
}
100+
]
101+
}

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
_build/
2+
deps/
3+
.git/
4+
.gitignore
5+
.github/
6+
.elixir_ls/
7+
*.md
8+
.env
9+
.env.*
10+
test/
11+
priv/static/
12+
node_modules/
13+
.DS_Store
14+
*.swp
15+
*.swo
16+
data/
17+
offsets/
18+
docker-compose*.yml
19+
Dockerfile*
20+
.dockerignore

.formatter.exs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
import_deps: [:phoenix],
3+
subdirectories: ["apps/*"],
4+
plugins: [Phoenix.LiveView.HTMLFormatter],
5+
inputs: [
6+
"*.{heex,ex,exs}",
7+
"{config,lib,test}/**/*.{heex,ex,exs}",
8+
"apps/*/lib/**/*.{heex,ex,exs}"
9+
]
10+
]

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
MIX_ENV: test
11+
ELIXIR_VERSION: '1.18.4'
12+
OTP_VERSION: '28.0'
13+
14+
jobs:
15+
test:
16+
name: Test
17+
runs-on: ubuntu-latest
18+
19+
services:
20+
postgres:
21+
image: postgres:16
22+
env:
23+
POSTGRES_PASSWORD: postgres
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
- 5432:5432
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Setup Elixir
36+
uses: erlef/setup-beam@v1
37+
with:
38+
elixir-version: ${{ env.ELIXIR_VERSION }}
39+
otp-version: ${{ env.OTP_VERSION }}
40+
41+
- name: Restore dependencies cache
42+
uses: actions/cache@v4
43+
with:
44+
path: |
45+
deps
46+
_build
47+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
48+
restore-keys: ${{ runner.os }}-mix-
49+
50+
- name: Install dependencies
51+
run: |
52+
mix local.hex --force
53+
mix local.rebar --force
54+
mix deps.get
55+
56+
- name: Check formatting
57+
run: mix format --check-formatted
58+
59+
- name: Run credo
60+
run: mix credo --strict
61+
62+
- name: Check compilation warnings
63+
run: mix compile --warnings-as-errors
64+
65+
- name: Run tests
66+
run: mix test
67+
68+
- name: Check for unused dependencies
69+
run: mix deps.unlock --check-unused
70+
71+
docker:
72+
name: Build Docker Image
73+
runs-on: ubuntu-latest
74+
needs: test
75+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
76+
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- name: Set up Docker Buildx
81+
uses: docker/setup-buildx-action@v3
82+
83+
- name: Log in to GitHub Container Registry
84+
uses: docker/login-action@v3
85+
with:
86+
registry: ghcr.io
87+
username: ${{ github.actor }}
88+
password: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Extract metadata
91+
id: meta
92+
uses: docker/metadata-action@v5
93+
with:
94+
images: ghcr.io/invalidpathexception/kafkaesque-app
95+
tags: |
96+
type=ref,event=branch
97+
type=ref,event=pr
98+
type=sha,prefix={{branch}}-
99+
type=raw,value=latest,enable={{is_default_branch}}
100+
101+
- name: Build and push Docker image
102+
uses: docker/build-push-action@v6
103+
with:
104+
context: .
105+
push: true
106+
tags: ${{ steps.meta.outputs.tags }}
107+
labels: ${{ steps.meta.outputs.labels }}
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max
110+
platforms: linux/amd64,linux/arm64
111+
build-args: |
112+
--pull

.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
kafkaesque-*.tar
24+
25+
# Ignore assets that are produced by build tools.
26+
/priv/static/
27+
28+
# Ignore digested assets cache.
29+
/priv/static/cache_manifest.json
30+
31+
# In case you use Node.js/npm, you want to ignore these.
32+
npm-debug.log
33+
/assets/node_modules/
34+
35+
# Database files
36+
*.db
37+
*.db-*
38+
39+
# OS files
40+
.DS_Store
41+
Thumbs.db
42+
43+
# Editor directories and files
44+
.idea/
45+
.vscode/
46+
*.swp
47+
*.swo
48+
*~
49+
50+
# Elixir Language Server
51+
/.elixir_ls/
52+
53+
# Data directories (for local development)
54+
/data/
55+
/offsets/
56+
57+
# Environment files
58+
.env
59+
.env.*
60+
61+
# Release artifacts
62+
/rel/artifacts/
63+
64+
# Temporary files
65+
*.tmp
66+
/tmp/

0 commit comments

Comments
 (0)