Skip to content

Commit

Permalink
Add elixir coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
albertored committed Aug 23, 2023
1 parent 9bbe0b5 commit 48253c8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
48 changes: 31 additions & 17 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Elixir
on:
pull_request:
branches:
- 'main'
- "main"
push:
branches:
- 'main'
- "main"

jobs:
format:
Expand All @@ -15,9 +15,9 @@ jobs:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: '25.0'
elixir-version: '1.13.4'
version-type: 'strict'
otp-version: "25.0"
elixir-version: "1.13.4"
version-type: "strict"
- uses: actions/cache@v2
name: Cache
with:
Expand All @@ -34,9 +34,9 @@ jobs:
name: Test SDK on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) and ${{ matrix.os }}
strategy:
matrix:
otp_version: ['25.0.3', '24.1.2']
elixir_version: ['1.14', '1.13.4']
rebar3_version: ['3.20.0']
otp_version: ["25.0.3", "24.1.2"]
elixir_version: ["1.14", "1.13.4"]
rebar3_version: ["3.20.0"]
os: [ubuntu-20.04]
env:
OTP_VERSION: ${{ matrix.otp_version }}
Expand All @@ -48,21 +48,35 @@ jobs:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
version-type: 'strict'
version-type: "strict"
- run: mix local.rebar --force rebar3 /home/runner/work/_temp/.setup-beam/rebar3/bin/rebar3
- run: mix deps.get
name: Deps
- name: Compile
run: rebar3 as test compile
- name: ExUnit
run: mix test --no-start test/otel_tests.exs test/otel_metric_tests.exs
run: mix test --no-start --cover test/otel_tests.exs test/otel_metric_tests.exs
- uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
file: opentelemetry.covertool.xml
env_vars: OTP_VERSION,ELIXIR_VERSION
flags: sdk,elixir
- uses: codecov/codecov-action@v3
if: ${{ always() }}
with:
file: opentelemetry_api.covertool.xml
env_vars: OTP_VERSION,ELIXIR_VERSION
flags: api,elixir

api_tests:
runs-on: ${{ matrix.os }}
name: Test API on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) and ${{ matrix.os }}
strategy:
matrix:
otp_version: ['25.0.3', '24.1.2']
elixir_version: ['1.14', '1.13.4']
rebar3_version: ['3.20.0']
otp_version: ["25.0.3", "24.1.2"]
elixir_version: ["1.14", "1.13.4"]
rebar3_version: ["3.20.0"]
os: [ubuntu-20.04]
env:
OTP_VERSION: ${{ matrix.otp_version }}
Expand All @@ -77,7 +91,7 @@ jobs:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
version-type: 'strict'
version-type: "strict"
- uses: actions/cache@v2
name: Cache
with:
Expand All @@ -104,8 +118,8 @@ jobs:
name: Dialyze on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) and ${{ matrix.os }}
strategy:
matrix:
otp_version: ['25.0']
elixir_version: ['1.14']
otp_version: ["25.0"]
elixir_version: ["1.14"]
os: [ubuntu-20.04]
env:
OTP_VERSION: ${{ matrix.otp_version }}
Expand All @@ -119,7 +133,7 @@ jobs:
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
version-type: 'strict'
version-type: "strict"
- uses: actions/cache@v2
name: Cache
with:
Expand Down
7 changes: 6 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ defmodule OtelElixirTests.MixProject do
app: :otel_elixir_tests,
version: "0.1.0",
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env())
elixirc_paths: elixirc_paths(Mix.env()),
test_coverage: [tool: :covertool, include_apps: [:opentelemetry, :opentelemetry_api]]
]
end

def deps do
[
{:covertool,
git: "https://github.com/albertored/covertool.git",
branch: "add-include-apps-mix",
only: :test},
{:opentelemetry, path: "apps/opentelemetry", only: :test, override: true},
{:opentelemetry_api, path: "apps/opentelemetry_api", only: :test, override: true},
{:opentelemetry_semantic_conventions,
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

{cover_enabled, true}.
{cover_export_enabled, true}.
{covertool, [{coverdata_files, ["ct.coverdata"]}]}.
{covertool, [{coverdata_files, ["ct.coverdata", "eunit.coverdata"]}]}.
{cover_excl_apps, [opentelemetry_api_experimental, opentelemetry_experimental]}.
{cover_excl_mods, [opentelemetry_exporter_trace_service_pb, opentelemetry_trace_service,
opentelemetry_zipkin_pb, opentelemetry_exporter_metrics_service_pb,
Expand Down

0 comments on commit 48253c8

Please sign in to comment.