Skip to content

CI

CI #1670

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: '0 5 * * *'
jobs:
asdf:
name: ASDF
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
# cache the ASDF directory, using the values from .tool-versions
- name: ASDF cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: ${{ runner.os }}-asdf-v2-${{ hashFiles('.tool-versions') }}
id: asdf-cache
# only run `asdf install` if we didn't hit the cache
- uses: asdf-vm/actions/install@v1
if: steps.asdf-cache.outputs.cache-hit != 'true'
build:
name: Build Elixir
runs-on: ubuntu-22.04
needs: asdf
steps:
- uses: actions/checkout@v2
- name: ASDF cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: ${{ runner.os }}-asdf-v2-${{ hashFiles('.tool-versions') }}
id: asdf-cache
- uses: mbta/actions/reshim-asdf@v1
- name: Restore dependencies cache
id: deps-cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
elixir:
name: Test Elixir
runs-on: ubuntu-22.04
needs: build
env:
DATABASE_POSTGRESQL_PASSWORD: postgres
DATABASE_POSTGRESQL_USER: postgres
DATABASE_NAME: arrow_test
DATABASE_HOST: localhost
services:
postgres:
image: postgres:11
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: ${{env.DATABASE_POSTGRESQL_PASSWORD}}
POSTGRES_USER: ${{env.DATABASE_POSTGRESQL_USER}}
POSTGRES_DB: ${{env.DATABASE_NAME}}
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: ASDF cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: ${{ runner.os }}-asdf-v2-${{ hashFiles('.tool-versions') }}
id: asdf-cache
- uses: mbta/actions/reshim-asdf@v1
- name: Restore dependencies cache
id: deps-cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: |
mix local.rebar --force
mix local.hex --force
- name: Compile (warnings as errors)
run: mix compile --force --warnings-as-errors
- name: Check formatting
run: mix format --check-formatted
- name: Credo
run: mix credo --strict
- name: Run tests
run: mix test --cover
- name: Save PR information
run: |
echo "${{ github.event.pull_request.number }}" > cover/PR_NUMBER
echo "${{ github.event.pull_request.head.sha }}" > cover/PR_SHA
if: github.event.pull_request
- name: Upload coverage artifact
uses: actions/upload-artifact@v2
with:
name: elixir-lcov
path: cover/
- uses: mbta/actions/dialyzer@v1
elixir-integration:
name: Elixir integration tests
runs-on: ubuntu-22.04
needs: build
env:
DATABASE_POSTGRESQL_PASSWORD: postgres
DATABASE_POSTGRESQL_USER: postgres
DATABASE_NAME: arrow_test
DATABASE_HOST: localhost
services:
postgres:
image: postgres:11
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: ${{env.DATABASE_POSTGRESQL_PASSWORD}}
POSTGRES_USER: ${{env.DATABASE_POSTGRESQL_USER}}
POSTGRES_DB: ${{env.DATABASE_NAME}}
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: ASDF cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: ${{ runner.os }}-asdf-v2-${{ hashFiles('.tool-versions') }}
id: asdf-cache
- uses: mbta/actions/reshim-asdf@v1
- name: Restore dependencies cache
id: deps-cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: |
mix local.rebar --force
mix local.hex --force
- name: Install NPM assets
run: npm --prefix assets ci
- uses: mbta/setup-chromedriver@v1.0.5
- name: Run integration tests
run: mix test.integration
nodejs:
name: Test Node
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v2
- name: ASDF cache
uses: actions/cache@v2
with:
path: ~/.asdf
key: ${{ runner.os }}-asdf-v2-${{ hashFiles('.tool-versions') }}
id: asdf-cache
- uses: mbta/actions/reshim-asdf@v1
- name: Restore dependencies cache
id: deps-cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install NPM assets
run: npm --prefix assets ci
- name: Check JS formatting
run: npm --prefix assets run check
- name: Node tests
run: npm --prefix assets test