Update README.md (#41) #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Elixir CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:12 | |
ports: ["5432:5432"] | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: "1.13.1" | |
otp-version: "24.2" # Define the OTP version [required] | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install Mix Dependencies | |
if: steps.mix-cache.outputs.cache-hit != 'true' | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- name: Check Formatting | |
run: mix format --check-formatted | |
- name: Run Credo | |
run: mix credo --strict | |
- name: Check coverage | |
run: mix coveralls.json | |
env: | |
MIX_ENV: test | |
- name: Run codecov Script | |
run: bash <(curl -s https://codecov.io/bash) | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Run tests | |
run: mix test | |
- name: Run digest | |
run: mix phx.digest | |
deploy: | |
needs: build # Will only run if the test job succeeds | |
if: github.ref == 'refs/heads/main' # Only run this job if it is on the master branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: main # Checkout out master instead of the latest commit | |
fetch-depth: 0 # Checkout the whole branch | |
- uses: mhanberg/[email protected] | |
with: | |
GIGALIXIR_USERNAME: ${{ secrets.GIGALIXIR_USERNAME }} | |
GIGALIXIR_PASSWORD: ${{ secrets.GIGALIXIR_PASSWORD }} | |
GIGALIXIR_APP: elderly-joyous-pangolin # Feel free to also put this in your secrets | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
MIGRATIONS: false |