Skip to content

fix: Save listener duration as milliseconds #2235

fix: Save listener duration as milliseconds

fix: Save listener duration as milliseconds #2235

Workflow file for this run

name: Elixir CI
on:
pull_request:
types:
- opened
- edited
- synchronize
jobs:
server:
services:
postgres:
image: postgres:12.2-alpine
env:
POSTGRES_PASSWORD: postgres
# Start in localhost
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
GH_PERSONNAL_TOKEN: ${{secrets.GH_PERSONNAL_TOKEN}}
name: server checks
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Elixir
uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: "1.13" # Define the elixir version [required]
otp-version: "24" # Define the OTP version [required]
- name: Restore dependencies & build cache
uses: actions/cache@v2
with:
path: |
deps
_build
key: server-${{ runner.os }}-mix-${{ vars.CACHE_VERSION }}-${{ hashFiles('**/mix.lock') }}
restore-keys: server-${{ runner.os }}-mix-${{ vars.CACHE_VERSION }}-${{ hashFiles('**/mix.lock') }}
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
# (Source : https://github.com/jeremyjh/dialyxir#github-actions)
- name: Restore PLT cache
uses: actions/cache@v2
id: plt_cache
with:
key: |
server-${{ runner.os }}-${{ vars.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
restore-keys: |
server-${{ runner.os }}-${{ vars.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
path: |
.plts
- name: Install dependencies
run: mix deps.get
- name: Compile project
run: mix compile
- name: Check formatting
run: mix format --check-formatted
- name: Check code style with credo
run: mix credo --strict
- name: Run tests
run: mix test
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
- name: Run dialyzer
run: mix dialyzer
application_runner:
name: application_runner checks
env:
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
GH_PERSONNAL_TOKEN: ${{secrets.GH_PERSONNAL_TOKEN}}
services:
postgres:
# Docker Hub image
image: postgres:15.1-alpine
# Provide the password for postgres
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
ports:
# Maps tcp port 5432 on service container to the host (localhost)
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: ./libs/application_runner
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Elixir
uses: erlef/setup-beam@v1
id: beam
with:
elixir-version: "1.13" # Define the elixir version [required]
otp-version: "24" # Define the OTP version [required]
- name: Restore dependencies & build cache
uses: actions/cache@v2
with:
path: |
deps
_build
key: application-runner-${{ runner.os }}-mix-${{ vars.CACHE_VERSION }}-${{ hashFiles('**/mix.lock') }}
restore-keys: application-runner-${{ runner.os }}-mix-${{ vars.CACHE_VERSION }}-${{ hashFiles('**/mix.lock') }}
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
# (Source : https://github.com/jeremyjh/dialyxir#github-actions)
- name: Restore PLT cache
uses: actions/cache@v2
id: plt_cache
with:
key: |
application-runner-${{ runner.os }}-${{ vars.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
restore-keys: |
application-runner-${{ runner.os }}-${{ vars.CACHE_VERSION }}-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-plt
path: |
.plts
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: "5.0"
mongodb-replica-set: test-rs
- name: Install dependencies
run: MIX_ENV=test mix deps.get
- name: Compile project
run: MIX_ENV=test mix compile
- name: Check formatting
run: mix format --check-formatted
- name: Check code style with credo
run: mix credo --strict
- name: Run tests
run: mix test
- name: Run dialyzer
run: MIX_ENV=test mix dialyzer --format short