Skip to content

Commit bf0d1a2

Browse files
committed
setup CI
1 parent 1156937 commit bf0d1a2

File tree

4 files changed

+70
-2
lines changed

4 files changed

+70
-2
lines changed

.github/workflows/build_test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Async Test build & test
2+
3+
on:
4+
push:
5+
paths: "*"
6+
pull_request:
7+
paths: "*"
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
CI: true
14+
MIX_ENV: test
15+
16+
jobs:
17+
build:
18+
name: Build & test
19+
runs-on: ubuntu-22.04
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Elixir
24+
uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
25+
with:
26+
elixir-version: "1.18.4"
27+
otp-version: "28.0"
28+
- name: Restore dependencies cache
29+
uses: actions/cache@v3
30+
with:
31+
path: deps
32+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
33+
restore-keys: ${{ runner.os }}-mix-
34+
- name: Install dependencies
35+
run: mix deps.get
36+
- name: Lint
37+
run: mix lint
38+
- name: Run tests
39+
run: mix test --warnings-as-errors

mix.exs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ defmodule AsyncTest.MixProject do
88
elixir: "~> 1.17",
99
start_permanent: Mix.env() == :prod,
1010
elixirc_paths: elixirc_paths(Mix.env()),
11+
aliases: [
12+
lint: [
13+
"format --check-formatted",
14+
"deps.unlock --check-unused",
15+
"credo",
16+
"deps.compile",
17+
"compile --force --warnings-as-errors",
18+
"docs --warnings-as-errors",
19+
"dialyzer"
20+
]
21+
],
1122
deps: deps()
1223
]
1324
end
@@ -25,8 +36,9 @@ defmodule AsyncTest.MixProject do
2536
# Run "mix help deps" to learn about dependencies.
2637
defp deps do
2738
[
28-
# {:dep_from_hexpm, "~> 0.3.0"},
29-
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
39+
{:ex_doc, "~> 0.34", only: [:dev, :test], runtime: false, warn_if_outdated: true},
40+
{:dialyxir, ">= 0.0.0", only: [:dev, :test], runtime: false},
41+
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false}
3042
]
3143
end
3244
end

mix.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%{
2+
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
3+
"credo": {:hex, :credo, "1.7.12", "9e3c20463de4b5f3f23721527fcaf16722ec815e70ff6c60b86412c695d426c1", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8493d45c656c5427d9c729235b99d498bd133421f3e0a683e5c1b561471291e5"},
4+
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
5+
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
6+
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
7+
"ex_doc": {:hex, :ex_doc, "0.38.2", "504d25eef296b4dec3b8e33e810bc8b5344d565998cd83914ffe1b8503737c02", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "732f2d972e42c116a70802f9898c51b54916e542cc50968ac6980512ec90f42b"},
8+
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
9+
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
10+
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
11+
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
12+
"makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"},
13+
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
14+
}

test/support/test_case.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
defmodule TestCase do
2+
@moduledoc """
3+
Utility for creating and running test cases within tests.
4+
"""
25
defmacro test_case(name, options \\ [], do: block) do
36
module_name = Module.concat(__CALLER__.module, :"Case_#{String.replace(name, ~r"\s", "_")}")
47

0 commit comments

Comments
 (0)