From cdde38d2880e2926def95d3b5d7c2f65bbbed0d2 Mon Sep 17 00:00:00 2001 From: James Harton Date: Fri, 10 Jul 2020 17:37:37 +1200 Subject: [PATCH] Set up CI. --- .gitlab-ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++ lib/wopr.ex | 13 ----------- mix.exs | 16 +++++++++++-- mix.lock | 11 +++++++++ test/wopr_test.exs | 4 ---- 5 files changed, 81 insertions(+), 19 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 mix.lock diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..493ca07 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,56 @@ +image: elixir:latest + +cache: + key: "$CI_JOB_NAME" + paths: + - deps + - _build + - /root/.mix + +variables: + MIX_ENV: "test" + +before_script: + - mix local.hex --force + - mix local.rebar --force + - mix deps.get --only test + +test: + stage: test + script: + - mix test + +credo: + stage: test + script: + - mix credo + +audit: + stage: test + script: + - mix hex.audit + +format: + stage: test + script: + - mix format --check-formatted + +pages: + stage: deploy + script: + - mix docs -o public + artifacts: + paths: + - public + only: + - master + +package: + stage: deploy + only: + - /^v[0-9]+\.[0-9]+\.[0-9]+$/ + script: + - mix hex.build + artifacts: + paths: + - "wopr-*.tar" diff --git a/lib/wopr.ex b/lib/wopr.ex index f2c3940..8e663bd 100644 --- a/lib/wopr.ex +++ b/lib/wopr.ex @@ -2,17 +2,4 @@ defmodule WOPR do @moduledoc """ Documentation for `WOPR`. """ - - @doc """ - Hello world. - - ## Examples - - iex> WOPR.hello() - :world - - """ - def hello do - :world - end end diff --git a/mix.exs b/mix.exs index ba16b42..2757c98 100644 --- a/mix.exs +++ b/mix.exs @@ -7,6 +7,7 @@ defmodule WOPR.MixProject do version: "0.1.0", elixir: "~> 1.10", start_permanent: Mix.env() == :prod, + package: package(), deps: deps() ] end @@ -19,11 +20,22 @@ defmodule WOPR.MixProject do ] end + def package do + [ + maintainers: ["James Harton "], + licenses: ["Hippocratic"], + links: %{ + "Source" => "https://gitlab.com/jimsy/wopr" + } + ] + end + # Run "mix help deps" to learn about dependencies. defp deps do [ - # {:dep_from_hexpm, "~> 0.3.0"}, - # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"} + {:credo, "~> 1.1", only: [:dev, :test], runtime: false}, + {:earmark, ">= 0.0.0", only: [:dev, :test]}, + {:ex_doc, ">= 0.0.0", only: [:dev, :test]} ] end end diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..788197e --- /dev/null +++ b/mix.lock @@ -0,0 +1,11 @@ +%{ + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"}, + "earmark": {:hex, :earmark, "1.4.9", "837e4c1c5302b3135e9955f2bbf52c6c52e950c383983942b68b03909356c0d9", [:mix], [{:earmark_parser, ">= 1.4.9", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "0d72df7d13a3dc8422882bed5263fdec5a773f56f7baeb02379361cb9e5b0d8e"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.9", "819bda2049e6ee1365424e4ced1ba65806eacf0d2867415f19f3f80047f8037b", [:mix], [], "hexpm", "8bf54fddabf2d7e137a0c22660e71b49d5a0a82d1fb05b5af62f2761cd6485c4"}, + "ex_doc": {:hex, :ex_doc, "0.22.1", "9bb6d51508778193a4ea90fa16eac47f8b67934f33f8271d5e1edec2dc0eee4c", [:mix], [{:earmark, "~> 1.4.0", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "d957de1b75cb9f78d3ee17820733dc4460114d8b1e11f7ee4fd6546e69b1db60"}, + "jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"}, + "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, +} diff --git a/test/wopr_test.exs b/test/wopr_test.exs index c6e1822..03c2e6a 100644 --- a/test/wopr_test.exs +++ b/test/wopr_test.exs @@ -1,8 +1,4 @@ defmodule WOPRTest do use ExUnit.Case doctest WOPR - - test "greets the world" do - assert WOPR.hello() == :world - end end