Skip to content

Commit

Permalink
Integrate GitHub Actions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
terenceponce authored Apr 13, 2024
1 parent 99d8398 commit f2102e4
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
MIX_ENV: test

permissions:
contents: read

jobs:
test:
name: Lint and Test
runs-on: ubuntu-latest
strategy:
matrix:
otp:
- '26.2.4'
elixir:
- '1.16.2'

services:
db:
image: postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Erlang/Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Cache deps
uses: actions/cache@v3
id: cache-deps
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
- name: Cache compiled build
id: cache-build
uses: actions/cache@v3
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
- name: Install Dependencies
run: mix deps.get

- name: Compile
run: mix compile --warnings-as-errors

- name: Run Linter
run: mix lint.ci

- name: Run Tests
run: mix test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DashFloat

[![gh-actions](https://github.com/DashFloat/DashFloat/workflows/CI/badge.svg)](https://github.com/DashFloat/DashFloat/actions?workflow=CI)

To start your Phoenix server:

* Run `mix setup` to install and setup dependencies
Expand Down
2 changes: 2 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ defmodule DashFloat.MixProject do
"assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
lint: ["format"],
"lint.ci": ["format --check-formatted"],
setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"],
test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"]
]
Expand Down

0 comments on commit f2102e4

Please sign in to comment.