Skip to content

Build and Test

Build and Test #304

Workflow file for this run

name: Build and Test
on:
# Run when pushing to stable branches
push:
branches:
- 'master'
- 'release-*'
# Run on branch/tag creation
create:
# Run on pull requests
pull_request:
env:
elixir_version: 1.8.1
otp_version: 21.3
jobs:
test-dialyzer:
name: Check Dialyzer
runs-on: ubuntu-latest
env:
MIX_ENV: ci
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
${{ runner.os }}-mix-
- uses: actions/cache@v1
with:
path: _build
key: ${{ runner.os }}-_build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-_build-${{ github.sha }}
${{ runner.os }}-_build-
- uses: actions/cache@v1
with:
path: dialyzer_cache
key: ${{ runner.os }}-dialyzer_cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-dialyzer_cache-${{ github.sha }}
${{ runner.os }}-dialyzer_cache-
- uses: actions/[email protected]
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
- name: Allow git to pull from private astarte_rpc repo
run: |
git config --global url."https://${{ secrets.GH_TOKEN }}:@github.com/astarte-enterprise/".insteadOf "[email protected]:astarte-enterprise/"
- name: Install Dependencies
run: mix deps.get
- name: Run dialyzer
# FIXME: This should be set to fail when dialyzer issues are fixed
run: mix dialyzer || exit 0
test-coverage:
name: Build and Test
runs-on: ubuntu-latest
# Wait for Dialyzer to give it a go before building
needs:
- test-dialyzer
strategy:
fail-fast: false
matrix:
rabbitmq:
- "rabbitmq:3.7.21-management"
services:
rabbitmq:
image: ${{ matrix.rabbitmq }}
ports:
- 5672:5672
- 15672:15672
env:
MIX_ENV: test
RABBITMQ_HOST: localhost
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
${{ runner.os }}-mix-
- uses: actions/cache@v1
with:
path: _build
key: ${{ runner.os }}-_build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-_build-${{ github.sha }}
${{ runner.os }}-_build-
- uses: actions/[email protected]
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
- name: Allow git to pull from private astarte_rpc repo
run: |
git config --global url."https://${{ secrets.GH_TOKEN }}:@github.com/astarte-enterprise/".insteadOf "[email protected]:astarte-enterprise/"
- name: Install Dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Compile
run: mix do compile
- name: Test and Coverage
run: mix coveralls.json --exclude wip -o coverage_results
- name: Upload Coverage Results to CodeCov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN