Skip to content

Commit 36d1ef9

Browse files
chore: initi repo (#1)
init repository with credo, formatter options and ci Signed-off-by: Gabriele Ghio <gabriele.ghio@secomind.com>
1 parent 045d782 commit 36d1ef9

File tree

15 files changed

+662
-2
lines changed

15 files changed

+662
-2
lines changed

.credo.exs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# This file is part of Astarte.
3+
#
4+
# Copyright 2025 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
%{
20+
configs: [
21+
%{
22+
name: "default",
23+
strict: true,
24+
files: %{
25+
included: ["lib/", "test/", "config/"],
26+
excluded: [~r"/_build/", ~r"/deps/"]
27+
},
28+
checks: [
29+
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 100},
30+
{Credo.Check.Readability.Specs},
31+
{Credo.Check.Design.TagTODO, false},
32+
{Credo.Check.Design.AliasUsage, priority: :low},
33+
{Credo.Check.Refactor.CyclomaticComplexity, max_complexity: 10},
34+
{Credo.Check.Refactor.FunctionArity, max_arity: 4},
35+
{Credo.Check.Refactor.Nesting, max_nesting: 3}
36+
]
37+
}
38+
]
39+
}

.formatter.exs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# This file is part of Astarte.
3+
#
4+
# Copyright 2025 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
locals_without_parens = [
20+
# stream_data
21+
all: :*,
22+
check: 1,
23+
check: 2,
24+
property: 1,
25+
property: 2,
26+
27+
# astarte_generators
28+
gen: :*
29+
]
30+
31+
[
32+
inputs: [
33+
"lib/**/*.{ex,exs}",
34+
"test/**/*.{ex,exs}",
35+
"mix.exs",
36+
"config/**/*.{ex,exs}",
37+
".credo.exs"
38+
],
39+
locals_without_parens: locals_without_parens,
40+
export: [locals_without_parens: locals_without_parens]
41+
]

.github/dco.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# This file is part of Astarte.
3+
#
4+
# Copyright 2025 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
19+
require:
20+
members: false

.github/workflows/elixir.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# This file is part of Astarte.
2+
#
3+
# Copyright 2025 SECO Mind Srl
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: Elixir CI
19+
20+
on:
21+
push:
22+
branches:
23+
- main
24+
- "release-*"
25+
pull_request:
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
setup:
32+
name: Setup
33+
runs-on: ubuntu-22.04
34+
env:
35+
MIX_ENV: ci
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Set up Elixir
39+
uses: erlef/setup-beam@v1.18.0
40+
id: setup-elixir
41+
with:
42+
version-file: .tool-versions
43+
version-type: strict
44+
- uses: actions/cache@v4
45+
id: cache-deps
46+
with:
47+
path: deps
48+
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }}
49+
- name: Install Dependencies and Compile
50+
run: mix deps.get && mix deps.compile
51+
- name: Upload build artifacts
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: build
55+
path: _build
56+
57+
dializer:
58+
name: Run Dialyzer
59+
runs-on: ubuntu-22.04
60+
needs: setup
61+
env:
62+
MIX_ENV: ci
63+
steps:
64+
- uses: actions/checkout@v4
65+
- name: Set up Elixir
66+
uses: erlef/setup-beam@v1.18.0
67+
id: setup-elixir
68+
with:
69+
version-file: .tool-versions
70+
version-type: strict
71+
- uses: actions/cache@v4
72+
id: cache-deps
73+
with:
74+
path: deps
75+
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }}
76+
- name: Download build artifacts
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: build
80+
- name: Run Dialyzer
81+
run: mix dialyzer
82+
- name: Run credo
83+
run: mix credo
84+
85+
test:
86+
name: Run Tests
87+
runs-on: ubuntu-22.04
88+
needs: setup
89+
env:
90+
MIX_ENV: ci
91+
steps:
92+
- uses: actions/checkout@v4
93+
- name: Set up Elixir
94+
uses: erlef/setup-beam@v1.18.0
95+
id: setup-elixir
96+
with:
97+
version-file: .tool-versions
98+
version-type: strict
99+
- uses: actions/cache@v4
100+
with:
101+
path: deps
102+
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }}
103+
restore-keys: |
104+
${{ runner.os }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ steps.setup-elixir.outputs.otp-version }}-mix-
105+
- name: Download build artifacts
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: build
109+
- name: Run Unit Tests & Coverage
110+
run: mix test --cover

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 third-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+
astarte_data_access_generators-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
elixir 1.15.7-otp-26
2+
erlang 26.1

0 commit comments

Comments
 (0)