Skip to content

Instantly share code, notes, and snippets.

@Grantimus9
Last active August 16, 2020 04:04
Show Gist options
  • Save Grantimus9/7f5bc6780b2da4edbb4702050270535d to your computer and use it in GitHub Desktop.
Save Grantimus9/7f5bc6780b2da4edbb4702050270535d to your computer and use it in GitHub Desktop.
Github Actions Elixir.yml file that works on my Elixir Phoenix apps using Postgres, such as on Heroku
name: Elixir CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
elixir: [1.8.2]
otp: [22.2]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }} # Define the elixir version [required]
otp-version: ${{ matrix.otp }} # Define the OTP version [required]
- name: Retrieve Mix Dependencies Cache
uses: actions/cache@v1
id: mix-cache # id to use in retrieve action
with:
path: deps
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Tests
run: |
mix compile
mix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment