chore: ci #104
Workflow file for this run
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" ] | |
env: | |
MIX_ENV: test | |
permissions: | |
contents: read | |
jobs: | |
test: | |
services: | |
db: | |
image: postgres:15 | |
ports: ['5432:5432'] | |
env: | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
runs-on: ubuntu-latest | |
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} | |
strategy: | |
matrix: | |
otp: ['26'] | |
elixir: ['1.15.4'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp}} | |
elixir-version: ${{matrix.elixir}} | |
- name: Cache Dependencies and Build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}-${{ matrix.otp }}-${{ matrix.elixir }} | |
restore-keys: | | |
${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}- | |
${{ runner.os }}-mix- | |
- name: Clean on retry | |
if: github.run_attempt != '1' | |
run: | | |
mix deps.clean --all | |
mix clean | |
shell: sh | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Compiles without warnings | |
run: mix compile --warnings-as-errors | |
- name: Check Formatting | |
run: mix format --check-formatted | |
- name: Run tests | |
run: mix test | |
deploy: | |
name: Deploy app | |
needs: test | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- run: flyctl deploy --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |