-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9febbe
commit 2f85f27
Showing
10 changed files
with
457 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Elixir CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
mix_test_old: | ||
name: mix test (Elixir ${{matrix.elixir}} | OTP ${{matrix.otp}}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- elixir: 1.17.x | ||
otp: 27 | ||
os: ubuntu-latest | ||
env: | ||
MIX_ENV: test | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{matrix.otp}} | ||
elixir-version: ${{matrix.elixir}} | ||
- name: Install Dependencies | ||
run: | | ||
mix local.hex --force | ||
mix local.rebar --force | ||
mix deps.get --only test | ||
- name: Cache build artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.hex | ||
~/.mix | ||
_build | ||
key: ${{ matrix.otp }}-${{ matrix.elixir }}-build | ||
- run: mix compile --warnings-as-errors | ||
env: | ||
CC: gcc-10 | ||
CXX: g++-10 | ||
- run: mix test --warnings-as-errors | ||
if: matrix.warnings_as_errors | ||
env: | ||
CC: gcc-10 | ||
CXX: g++-10 | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
/_build | ||
/cover | ||
/deps | ||
/doc | ||
# The directory Mix will write compiled artifacts to. | ||
/_build/ | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover/ | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps/ | ||
|
||
# Where third-party dependencies like ExDoc output generated docs. | ||
/doc/ | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
*.beam | ||
/config/*.secret.exs | ||
.elixir_ls/ | ||
|
||
# Ignore package tarball (built via "mix hex.build"). | ||
simple_args-*.tar | ||
|
||
# Temporary files, for example, from tests. | ||
/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SimpleArgs | ||
|
||
**TODO: Add description** | ||
|
||
## Installation | ||
|
||
If [available in Hex](https://hex.pm/docs/publish), the package can be installed | ||
by adding `simple_args` to your list of dependencies in `mix.exs`: | ||
|
||
```elixir | ||
def deps do | ||
[ | ||
{:simple_args, "~> 0.1.0"} | ||
] | ||
end | ||
``` | ||
|
||
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) | ||
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can | ||
be found at <https://hexdocs.pm/simple_args>. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule SimpleArgs do | ||
@moduledoc """ | ||
Documentation for `SimpleArgs`. | ||
""" | ||
|
||
@doc """ | ||
Hello world. | ||
## Examples | ||
iex> SimpleArgs.hello() | ||
:world | ||
""" | ||
def hello do | ||
:world | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
defmodule SimpleArgs.MixProject do | ||
use Mix.Project | ||
@version "0.0.1" | ||
@url "https://github.com/RobertDober/simple_args" | ||
|
||
def project do | ||
[ | ||
app: :simple_args, | ||
version: @version, | ||
elixir: "~> 1.17", | ||
elixirc_paths: elixirc_paths(Mix.env()), | ||
start_permanent: Mix.env() == :prod, | ||
deps: deps(), | ||
description: "Simple argument parser", | ||
package: package(), | ||
preferred_cli_env: [ | ||
coveralls: :test, | ||
"coveralls.detail": :test, | ||
"coveralls.post": :test, | ||
"coveralls.html": :test | ||
], | ||
test_coverage: [tool: ExCoveralls], | ||
aliases: [docs: &build_docs/1] | ||
] | ||
end | ||
|
||
# Run "mix help compile.app" to learn about applications. | ||
def application do | ||
[ | ||
extra_applications: [:logger] | ||
] | ||
end | ||
|
||
# Run "mix help deps" to learn about dependencies. | ||
defp deps do | ||
[ | ||
{:dialyxir, "~> 1.4.3", only: [:dev], runtime: false}, | ||
{:excoveralls, "~> 0.18.1", only: [:test]}, | ||
{:extractly, "~> 0.5.4", only: [:dev]}, | ||
] | ||
end | ||
|
||
defp package do | ||
[ | ||
files: [ | ||
"lib", | ||
"mix.exs", | ||
"README.md", | ||
"LICENSE" | ||
], | ||
maintainers: [ | ||
"Robert Dober <[email protected]>" | ||
], | ||
licenses: [ | ||
"AGPL-3.0-or-later" | ||
], | ||
links: %{ | ||
"GitHub" => @url | ||
} | ||
] | ||
end | ||
|
||
defp elixirc_paths(:test), do: ["lib", "examples", "test/support"] | ||
defp elixirc_paths(:dev), do: ["lib", "examples", "dev"] | ||
defp elixirc_paths(_), do: ["lib"] | ||
|
||
@module "SimpleArgs" | ||
|
||
defp build_docs(_) do | ||
Mix.Task.run("compile") | ||
ex_doc = Path.join(Mix.path_for(:escripts), "ex_doc") | ||
Mix.shell().info("Using escript: #{ex_doc} to build the docs") | ||
|
||
unless File.exists?(ex_doc) do | ||
raise "cannot build docs because escript for ex_doc is not installed, " <> | ||
"make sure to run `mix escript.install hex ex_doc` before" | ||
end | ||
|
||
args = [@module, @version, Mix.Project.compile_path()] | ||
opts = ~w[--main #{@module} --source-ref v#{@version} --source-url #{@url}] | ||
|
||
Mix.shell().info("Running: #{ex_doc} #{inspect(args ++ opts)}") | ||
System.cmd(ex_doc, args ++ opts) | ||
Mix.shell().info("Docs built successfully") | ||
end | ||
end | ||
# SPDX-License-Identifier: AGPL-3.0-or-later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%{ | ||
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, | ||
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, | ||
"excoveralls": {:hex, :excoveralls, "0.18.1", "a6f547570c6b24ec13f122a5634833a063aec49218f6fff27de9df693a15588c", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d65f79db146bb20399f23046015974de0079668b9abb2f5aac074d078da60b8d"}, | ||
"extractly": {:hex, :extractly, "0.5.4", "22ff3a624d814227ba842a2b59a38b1298df5531dbd4772dcbe9b97e05627145", [:mix], [], "hexpm", "612e16920317b2fb963b2da013019a614ba12b928d535a053a1efb21ddaa6268"}, | ||
"jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule SimpleArgsTest do | ||
use ExUnit.Case | ||
doctest SimpleArgs | ||
|
||
test "greets the world" do | ||
assert SimpleArgs.hello() == :world | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ExUnit.start() |