diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 79f7284..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: 2 # use CircleCI 2.0 instead of CircleCI Classic -jobs: # basic units of work in a run - build: # runs not using Workflows must have a `build` job as entry point - parallelism: 1 # run only one instance of this job in parallel - docker: # run the steps with Docker - - image: cimg/elixir:1.12.1 # ...with this image as the primary container; this is where all `steps` will run - environment: # environment variables for primary container - MIX_ENV: test - - working_directory: ~/app # directory where steps will run - - steps: # commands that comprise the `build` job - - checkout # check out source code to working directory - - - run: mix local.hex --force # install Hex locally (without prompt) - - run: mix local.rebar --force # fetch a copy of rebar (without prompt) - - - restore_cache: # restores saved mix cache - # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ - keys: # list of cache keys, in decreasing specificity - - v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }} - - v1-mix-cache-{{ .Branch }} - - v1-mix-cache - - restore_cache: # restores saved build cache - keys: - - v1-build-cache-{{ .Branch }} - - v1-build-cache - - run: - name: Get deps and compile - command: mix do deps.get, compile # get updated dependencies & compile them - - save_cache: # generate and store mix cache - key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }} - paths: "deps" - - save_cache: # make another, less specific cache - key: v1-mix-cache-{{ .Branch }} - paths: "deps" - - save_cache: # you should really save one more cache (just in case) - key: v1-mix-cache - paths: "deps" - - save_cache: # don't forget to save a *build* cache, too - key: v1-build-cache-{{ .Branch }} - paths: "_build" - - save_cache: # and one more build cache for good measure - key: v1-build-cache - paths: "_build" - - - run: - name: Run tests - command: mix test # run all tests in project - - - store_test_results: # upload junit test results for display in Test Summary - # Read more: https://circleci.com/docs/2.0/collect-test-data/ - path: _build/test/lib/graphmath # Replace with the name of your :app - - - run: - name: Post test coverage - command: | - export T_COMMIT_MESSAGE="`git log --pretty=format:%s -1`" - mix coveralls.circle - - run: - name: Post documentation coverage - command: | - MIX_ENV=docs mix deps.get - MIX_ENV=docs mix inch.report - \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..dfd5e44 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +# cribbed from Scenic +name: CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + env: + MIX_ENV: test + + strategy: + fail-fast: false + matrix: + include: + - elixir: '1.15.7' + otp: '25.3' + - elixir: '1.16.3' + otp: '26.2' + - elixir: '1.17.2' + otp: '26.2' + + steps: + - uses: actions/checkout@v3 + + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + + - name: Cache build artifacts + uses: actions/cache@v3 + with: + path: | + ~/.hex + ~/.mix + _build + priv/plts + key: ${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + - name: Install Dependencies + run: | + mix local.rebar --force + mix local.hex --force + mix deps.get + - name: Compile Deps + run: mix deps.compile + - name: Compile + run: mix compile --warnings-as-errors + - name: Check formatting + run: mix format --check-formatted + if: startsWith(matrix.elixir, '1.15') + - name: Run Tests + run: mix test + - name: Run coverage + run: mix coveralls.github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# - name: Run credo +# run: mix credo suggest --min-priority=high --ignore-checks Credo.Check.Design.DuplicatedCode diff --git a/mix.exs b/mix.exs index 6341236..ca66e56 100644 --- a/mix.exs +++ b/mix.exs @@ -12,7 +12,14 @@ defmodule Graphmath.Mixfile do source_url: "https://github.com/crertel/graphmath", docs: &docs/0, deps: deps(), - test_coverage: [tool: ExCoveralls] + test_coverage: [tool: ExCoveralls], + preferred_cli_env: [ + coveralls: :test, + "coveralls.detail": :test, + "coveralls.github": :test, + "coveralls.post": :test, + "coveralls.html": :test + ] ] end