Skip to content

Commit

Permalink
build(CI/CD): Added elixir_ci.yml 'Build and test' job for Github Act…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
Gabrielparizet committed Jun 5, 2024
1 parent 77f89e6 commit cc0aef5
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/elixir_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Elixir CI

on:
push:
branches:
- main
- "release/*"
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: my_app_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MIX_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost/my_app_test

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Elixir
uses: erlef/setup-elixir@v1
with:
elixir-version: 1.15.7
otp-version: 26.0

- name: Install dependencies
run: mix deps.get

- name: Install Node.js (for assets)
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install npm dependencies
run: npm install --prefix assets

- name: Compile assets
run: npm run deploy --prefix assets

- name: Compile Elixir code
run: mix compile

- name: Setup database
run: |
mix ecto.create
mix ecto.migrate
- name: Run tests
run: mix test

0 comments on commit cc0aef5

Please sign in to comment.