Skip to content

Add Ecto test case and coverage tool (#68) #39

Add Ecto test case and coverage tool (#68)

Add Ecto test case and coverage tool (#68) #39

Workflow file for this run

name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
SlackChannel: "#jenkins-ci-mv-opentelemetry"
MIX_ENV: test
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: ubuntupassword
POSTGRES_HOST: localhost
jobs:
test:
permissions:
contents: read
id-token: write
pull-requests: write
checks: write
runs-on: ubuntu-latest
name: Test on OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }}
strategy:
# Specify the OTP and Elixir versions to use when building
# and running the workflow steps.
matrix:
otp: ["25.2", "26.2"]
elixir: ["1.15.6", "1.16.1"]
services:
db:
env:
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: ubuntupassword
image: postgres:12-alpine
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Erlang/OTP with Elixir and mix
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Restore dependencies cache
uses: actions/cache@v4
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix
- name: Install dependencies
run: |
mix do deps.get, compile
- name: Run pre-checks
run: |
mix format --check-formatted
mix credo --strict
mix dialyzer
- name: Run mv-opentelemetry tests
run: |
mix test --cover
- name: Test coverage
uses: mindvalley/cobertura-action@master
with:
path: "mv_opentelemetry.covertool.xml"
minimum_coverage: 74
report_name: "Test coverage: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}"
show_missing: true
link_missing_lines: true
only_changed_files: true
link_missing_lines_source_dir: lib