Skip to content

Commit

Permalink
Generate Optimum infra
Browse files Browse the repository at this point in the history
  • Loading branch information
almirsarajcic committed Jun 29, 2024
1 parent 1b205dc commit dbdf1f9
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 39 deletions.
4 changes: 3 additions & 1 deletion .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@
#
{Credo.Check.Design.AliasUsage,
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},

# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
# set this value to 0 (zero).
#
{Credo.Check.Design.TagTODO, [exit_status: 0]},
{Credo.Check.Design.TagFIXME, [exit_status: 0]},
{Credo.Check.Design.TagTODO, [exit_status: 0]},

#
## Readability Checks
Expand Down Expand Up @@ -139,6 +140,7 @@
{Credo.Check.Refactor.RedundantWithClauseResult, []},
{Credo.Check.Refactor.RejectReject, []},
{Credo.Check.Refactor.UnlessWithElse, []},
{Credo.Check.Refactor.UtcNowTruncate, []},
{Credo.Check.Refactor.WithClauses, []},

#
Expand Down
4 changes: 1 addition & 3 deletions .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[
{"lib/mix/tasks/github_workflows.generate.ex", :no_return, 156}
]
[]
6 changes: 3 additions & 3 deletions .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ defmodule GithubWorkflows do
uses: "actions/cache@v3",
id: "npm-cache",
with: [
path: "~/.npm",
key: "npm-ubuntu-latest"
path: "node_modules",
key: "${{ runner.os }}-prettier"
]
],
[
name: "Install Prettier",
if: "steps.npm-cache.outputs.cache-hit != 'true'",
run: "npm i -g prettier"
run: "npm i -D prettier prettier-plugin-toml"
],
[
name: "Run Prettier",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ jobs:
uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: npm-ubuntu-latest
path: node_modules
key: ${{ runner.os }}-prettier
- name: Install Prettier
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm i -g prettier
run: npm i -D prettier prettier-plugin-toml
- name: Run Prettier
run: npx prettier -c .
test:
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ github_workflows_generator-*.tar
# Temporary files, for example, from tests.
/tmp/

# Dialyzer PLT files
/priv/plts/*.plt
/priv/plts/*.plt.hash
# Optimum development/test artifacts
/node_modules/
/priv/plts/
.DS_Store
package.json
package-lock.json
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/_build/
/.elixir_ls/
/.git/
/config/
/cover/
/deps/
/doc/
/lib/
/priv/
/test/
.credo.exs
.dialyzer_ignore.exs
.formatter.exs
.gitattributes
.gitignore
.iex.exs
.erl_crash.dump
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
plugins: ['prettier-plugin-toml'],
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
elixir 1.17.1-otp-27
erlang 27.0
nodejs 20.14.0
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- Dropped support for Elixir 1.11 and 1.12 (Credo requires version 1.13 at least).
- Removed `fast_yaml` and `libyaml` from `README.md`.
- Upgraded Elixir version to 1.17.1.
- Fixed YAML syntax error (`Nested mappings are not allowed in compact mappings`)
- Fixed YAML syntax error (`Nested mappings are not allowed in compact mappings`).
- Generated Optimum infra.

## 0.1.2 (2024-06-21)

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ci:
mix ci
3 changes: 2 additions & 1 deletion coveralls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"coverage_options": {
"minimum_coverage": 100.0
}
},
"skip_files": []
}
54 changes: 30 additions & 24 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ defmodule GithubWorkflowsGenerator.MixProject do
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
deps: optimum_deps() ++ app_deps(),

# Code checks
# Hex package
description: "Generate GitHub Actions workflows",
package: package(),

# CI
dialyzer: [
plt_add_apps: [:ex_unit, :mix],
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
],
preferred_cli_env: [
ci: :test,
coveralls: :test,
Expand All @@ -23,19 +31,15 @@ defmodule GithubWorkflowsGenerator.MixProject do
dialyzer: :test
],
test_coverage: [tool: ExCoveralls],
dialyzer: [
plt_add_apps: [:ex_unit, :mix],
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
],

# Docs
name: "GithubWorkflowsGenerator",
source_url: @repo,
docs: docs(),

# Hex package
description: "Generate GitHub Actions workflows",
package: package()
docs: [
extras: ["README.md"],
main: "readme",
source_ref: "v#{@version}"
]
]
end

Expand All @@ -46,13 +50,6 @@ defmodule GithubWorkflowsGenerator.MixProject do
]
end

defp docs do
[
main: "Mix.Tasks.GithubWorkflows.Generate",
source_ref: "v#{@version}"
]
end

defp package do
[
licenses: ["MIT"],
Expand All @@ -62,18 +59,27 @@ defmodule GithubWorkflowsGenerator.MixProject do
end

# Run "mix help deps" to learn about dependencies.
defp deps do
defp optimum_deps do
[
{:credo, "~> 1.7", only: [:test], runtime: false},
{:dialyxir, "~> 1.4", only: [:test], runtime: false},
{:ex_doc, "~> 0.34", only: [:dev], runtime: false},
{:excoveralls, "~> 0.18", only: [:test], runtime: false},
{:mix_audit, "~> 2.1", only: [:test], runtime: false}
{:credo, "~> 1.7", only: :test, runtime: false},
{:dialyxir, "~> 1.4", only: :test, runtime: false},
{:doctest_formatter, "~> 0.3", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
{:excoveralls, "~> 0.18", only: :test},
{:mix_audit, "~> 2.1", only: :test, runtime: false}
]
end

defp app_deps do
[]
end

defp aliases do
[
setup: [
"deps.get",
"cmd npm i -D prettier prettier-plugin-toml"
],
ci: [
"deps.unlock --check-unused",
"deps.audit",
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.7", "771445037228f763f9b2afd612b6aa2fd8e28432a95dbbc60d8e03ce71ba4446", [: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", "8bc87496c9aaacdc3f90f01b7b0582467b69b4bd2441fe8aae3109d843cc2f2e"},
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
"doctest_formatter": {:hex, :doctest_formatter, "0.3.0", "19da9fd0d9d1e895f86d7508f1962d8a16393277f73aba1066dddb3d2adcdfc8", [:mix], [], "hexpm", "485f4dab4fc65ecf18aa342d285b393db16814d828caa671c42f9f781b68cf5a"},
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.34.1", "9751a0419bc15bc7580c73fde506b17b07f6402a1e5243be9e0f05a68c723368", [:mix], [{:earmark_parser, "~> 1.4.39", [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", "d441f1a86a235f59088978eff870de2e815e290e44a8bd976fe5d64470a4c9d2"},
Expand Down

0 comments on commit dbdf1f9

Please sign in to comment.