Skip to content

chore: Added tests

chore: Added tests #96

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- "*"
paths-ignore:
- "*.md"
tags-ignore:
- "*"
pull_request:
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
ELIXIR_VERSION: 1.15.7
ERLANG_VERSION: 26.2.1
jobs:
format:
name: Check formatting
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Erlang and Elixir
id: beam
uses: erlef/setup-beam@v1
with:
version-type: "strict"
version-file: ".tool-versions"
install-hex: true
install-rebar: true
- name: Restore formatting environment
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-format
path: |
deps/
_build/dev/
- name: Fetch the dependencies
run: mix deps.get
- name: Format code
run: mix format --check-formatted
credo:
name: Run Credo
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Erlang and Elixir
id: beam
uses: erlef/setup-beam@v1
with:
version-type: "strict"
version-file: ".tool-versions"
install-hex: true
install-rebar: true
- name: Restore Credo environment
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-credo
path: |
deps/
_build/dev/
- name: Fetch the dependencies
run: mix deps.get
- name: Run credo
run: mix credo --format sarif
dialyxir:
name: Run Dialyxir
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Erlang and Elixir
id: beam
uses: erlef/setup-beam@v1
with:
version-type: "strict"
version-file: ".tool-versions"
install-hex: true
install-rebar: true
- name: Restore PLT cache
id: plt_cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-dialyxir-${{ hashFiles('mix.lock') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-dialyxir-
path: |
deps/
_build/dev/
priv/plts
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: |
mix deps.get
mix dialyzer --plt
- name: Save PLT cache
uses: actions/cache/save@v3
if: steps.plt_cache.outputs.cache-hit != 'true'
with:
key: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-dialyxir-${{ hashFiles('mix.lock') }}
path: |
deps/
_build/dev/
priv/plts
- name: Run dialyzer
run: mix dialyzer --format github
test:
name: Run tests
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
include:
# Elixir 1.16.0-rc.1 / Elasticsearch 8.11.3
- elixir: "1.16.0-rc.1"
erlang: "26.2.1"
elasticsearch: "8.11.3"
- elixir: "1.16.0-rc.1"
erlang: "25.3.2.8"
elasticsearch: "8.11.3"
- elixir: "1.16.0-rc.1"
erlang: "24.3.4.15"
elasticsearch: "8.11.3"
# Elixir 1.16.0-rc.1 / Elasticsearch 7.17.16
- elixir: "1.16.0-rc.1"
erlang: "26.2.1"
elasticsearch: "7.17.16"
- elixir: "1.16.0-rc.1"
erlang: "25.3.2.8"
elasticsearch: "7.17.16"
- elixir: "1.16.0-rc.1"
erlang: "24.3.4.15"
elasticsearch: "7.17.16"
# Elixir 1.15.7 / Elasticsearch 8.11.3
- elixir: "1.15.7"
erlang: "26.2.1"
elasticsearch: "8.11.3"
- elixir: "1.15.7"
erlang: "25.3.2.8"
elasticsearch: "8.11.3"
- elixir: "1.15.7"
erlang: "24.3.4.15"
elasticsearch: "8.11.3"
# Elixir 1.15.7 / Elasticsearch 7.17.16
- elixir: "1.15.7"
erlang: "26.2.1"
elasticsearch: "7.17.16"
- elixir: "1.15.7"
erlang: "25.3.2.8"
elasticsearch: "7.17.16"
- elixir: "1.15.7"
erlang: "24.3.4.15"
elasticsearch: "7.17.16"
# Elixir 1.14.5 / Elasticsearch 8.11.3
- elixir: "1.14.5"
erlang: "26.2.1"
elasticsearch: "8.11.3"
- elixir: "1.14.5"
erlang: "25.3.2.8"
elasticsearch: "8.11.3"
- elixir: "1.14.5"
erlang: "24.3.4.15"
elasticsearch: "8.11.3"
# Elixir 1.14.5 / Elasticsearch 7.17.16
- elixir: "1.14.5"
erlang: "26.2.1"
elasticsearch: "7.17.16"
- elixir: "1.14.5"
erlang: "25.3.2.8"
elasticsearch: "7.17.16"
- elixir: "1.14.5"
erlang: "24.3.4.15"
elasticsearch: "7.17.16"
# Elixir 1.13.4 / Elasticsearch 8.11.3
- elixir: "1.13.4"
erlang: "25.3.2.8"
elasticsearch: "8.11.3"
- elixir: "1.13.4"
erlang: "24.3.4.15"
elasticsearch: "8.11.3"
# Elixir 1.13.4 / Elasticsearch 7.17.16
- elixir: "1.13.4"
erlang: "25.3.2.8"
elasticsearch: "7.17.16"
- elixir: "1.13.4"
erlang: "24.3.4.15"
elasticsearch: "7.17.16"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch }}
ports: ["9200:9200"]
env:
discovery.type: "single-node"
ELASTIC_PASSWORD: "elastic"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Set up Erlang and Elixir
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.erlang }}
elixir-version: ${{ matrix.elixir }}
install-hex: true
install-rebar: true
- name: Restore formatting environment
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ runner.arch }}-erlang-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-elasticsearch-${{ matrix.elasticsearch }}-test
path: |
deps/
_build/test/
- name: Fetch the dependencies
run: mix deps.get
- name: Run tests
run: |
until $(curl --output /dev/null --silent --head --fail --user "elastic:elastic" "https://elasticsearch:9200"); do
printf '.'
sleep 1
done
# First wait for ES to start...
response=$(curl $host)
until [ "$response" = "200" ]; do
response=$(curl --write-out %{http_code} --silent --output /dev/null --user "elastic:elastic" "https://elasticsearch:9200")
echo >&2 "Elasticsearch is unavailable - sleeping"
sleep 1
done
# next wait for ES status to turn to Green
health="$(curl -fsSL --user "elastic:elastic" "https://elasticsearch:9200/_cat/health?h=status")"
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
until [ "$health" = 'green' ]; do
health="$(curl -fsSL --user "elastic:elastic" "https://elasticsearch:9200/_cat/health?h=status")"
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
echo >&2 "Elasticsearch is unavailable - sleeping"
sleep 1
done
echo >&2 "Elasticsearch is up"
mix test