From d73f988c9b6012fc825b440ea8dbe130db9508ea Mon Sep 17 00:00:00 2001 From: Andrew Dryga Date: Tue, 20 Sep 2022 12:43:33 -0500 Subject: [PATCH] Enable Github Actions as the new CI --- .github/workflows/ci.yml | 78 ++++++++++++++++++++++++++++++++ .github/workflows/type-check.yml | 41 +++++++++++++++++ .travis.yml | 43 ------------------ README.md | 3 +- mix.exs | 2 +- mix.lock | 1 + test/test_helper.exs | 1 + 7 files changed, 123 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/type-check.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..06809bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +name: Elixir + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + permissions: + # required by test reporter + pull-requests: write + checks: write + issues: write + statuses: write + strategy: + matrix: + include: + - otp-version: 21.3 + elixir-version: 1.7.0 + - otp-version: 22.2 + elixir-version: 1.9.4 + - otp-version: 23.2 + elixir-version: 1.10.4 + - otp-version: 24.3 + elixir-version: 1.13.4 + - otp-version: 25.0 + elixir-version: 1.14.0 + check-formatted: true + report-coverage: true + steps: + - uses: actions/checkout@v3 + - name: Set up Elixir + uses: erlef/setup-beam@988e02bfe678367a02564f65ca2e37726dc0268f + with: + elixir-version: ${{ matrix.elixir-version }} + otp-version: ${{ matrix.otp-version }} + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: | + deps + _build + key: deps-${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-elixir-${{ matrix.elixir-version }}-otp-${{ matrix.otp-version }} + - name: Install and compile dependencies + env: + MIX_ENV: test + run: mix do deps.get, deps.compile + - name: Make sure code is formatted + env: + MIX_ENV: test + if: ${{ matrix.check-formatted == true }} + run: mix format --check-formatted + - name: Run tests + env: + MIX_ENV: test + run: mix test --exclude pending + - name: Test Report + env: + MIX_ENV: test + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Mix Tests on Elixir ${{ matrix.elixir-version }} / OTP ${{ matrix.otp-version }} + path: _build/test/lib/sage/test-junit-report.xml + reporter: java-junit + - name: Report code coverage + env: + MIX_ENV: test + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ matrix.report-coverage == true }} + run: mix coveralls.github diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml new file mode 100644 index 0000000..60f4f61 --- /dev/null +++ b/.github/workflows/type-check.yml @@ -0,0 +1,41 @@ +name: Elixir Dialyzer + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + name: Build and run Dialyzer + runs-on: ubuntu-latest + strategy: + matrix: + include: + - otp-version: 25.0 + elixir-version: 1.14.0 + steps: + - uses: actions/checkout@v3 + - name: Set up Elixir + uses: erlef/setup-beam@988e02bfe678367a02564f65ca2e37726dc0268f + with: + elixir-version: ${{ matrix.elixir-version }} + otp-version: ${{ matrix.otp-version }} + - name: Restore Dialyzer PLT cache + uses: actions/cache@v3 + with: + path: | + deps + _build + key: plt-${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-elixir-${{ matrix.elixir-version }}-otp-${{ matrix.otp-version }} + - name: Install and compile dependencies + run: mix do deps.get, deps.compile + - name: Build Dialyzer PLT + run: mix dialyzer --plt + - name: Type check + run: mix dialyzer + \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 507cba9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: elixir -cache: - directories: - - deps - - _build/test - - _build/dev -elixir: - - 1.9.4 -otp_release: - - 22.2 -env: - global: - - MIX_ENV=test -matrix: - include: - - otp_release: 21.3 - elixir: 1.7.0 - - otp_release: 22.2 - elixir: 1.9.4 - after_script: - # Submit docs coverage to Inch CI - - "mix inch.report" - # Submit code coverage report to Coveralls - - "mix coveralls.travis" - - otp_release: 22.2 - elixir: 1.9.4 - env: - - MIX_ENV=dev - script: - # Make sure code is formatted - - "mix format --check-formatted" - - otp_release: 22.2 - elixir: 1.9.4 - env: - - MIX_ENV=dev - script: - # Type check - - "mix dialyzer" -script: - # Run all tests except pending ones - - "mix test --exclude pending" -after_script: -# Keep it empty in order for matrix override to work diff --git a/README.md b/README.md index fc99020..cf89a16 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # Sage -[![Build Status](https://travis-ci.org/Nebo15/sage.svg?branch=master)](https://travis-ci.org/Nebo15/sage) +[![Elixir](https://github.com/Nebo15/sage/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Nebo15/sage/actions/workflows/ci.yml) [![Coverage Status](https://coveralls.io/repos/github/Nebo15/sage/badge.svg?branch=master)](https://coveralls.io/github/Nebo15/sage?branch=master) [![Module Version](https://img.shields.io/hexpm/v/sage.svg)](https://hex.pm/packages/sage) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/sage/) [![Total Download](https://img.shields.io/hexpm/dt/sage.svg)](https://hex.pm/packages/sage) [![License](https://img.shields.io/hexpm/l/sage.svg)](https://github.com/Nebo15/sage/blob/master/LICENSE.md) -[![Last Updated](https://img.shields.io/github/last-commit/Nebo15/sage.svg)](https://github.com/Nebo15/sage/commits/master) Sage is a dependency-free implementation of the [Sagas](http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf) pattern in pure Elixir and provides a set of additional built-in features. diff --git a/mix.exs b/mix.exs index 848a905..2d6b034 100644 --- a/mix.exs +++ b/mix.exs @@ -45,7 +45,7 @@ defmodule Sage.Mixfile do {:ex_doc, ">= 0.0.0", only: [:dev, :test]}, {:excoveralls, ">= 0.7.0", only: [:dev, :test]}, {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, - {:inch_ex, ">= 0.0.0", only: :test} + {:junit_formatter, "~> 3.3", only: [:test]} ] end diff --git a/mix.lock b/mix.lock index 35c2993..17df792 100644 --- a/mix.lock +++ b/mix.lock @@ -13,6 +13,7 @@ "inch_ex": {:hex, :inch_ex, "2.0.0", "24268a9284a1751f2ceda569cd978e1fa394c977c45c331bb52a405de544f4de", [:mix], [{:bunt, "~> 0.2", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "96d0ec5ecac8cf63142d02f16b7ab7152cf0f0f1a185a80161b758383c9399a8"}, "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm"}, + "junit_formatter": {:hex, :junit_formatter, "3.3.1", "c729befb848f1b9571f317d2fefa648e9d4869befc4b2980daca7c1edc468e40", [:mix], [], "hexpm", "761fc5be4b4c15d8ba91a6dafde0b2c2ae6db9da7b8832a55b5a1deb524da72b"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, diff --git a/test/test_helper.exs b/test/test_helper.exs index f635f16..add1c0b 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,3 +1,4 @@ Sage.EffectsAgent.start_link() Sage.CounterAgent.start_link() +ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter]) ExUnit.start(capture_log: true)