-
Notifications
You must be signed in to change notification settings - Fork 42
58 lines (48 loc) · 1.65 KB
/
lint_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Perform linting and run tests
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build-and-test:
name: Build, Lint, and Test
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
env:
COMPOSE_FILE: ./docker-compose.ci.yml
MIX_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pull prebuilt images
run: docker compose pull
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/dev.Dockerfile
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Docker image
run: docker compose up --detach
# NOTE: All exec commands use the -T flag to compensate for
# a bug in the GitHub Actions runner where its stdin/stderr
# will erroneously report that it's a TTY.
# Aside from handling this bug the -T flag is not required
# See https://github.com/actions/runner/issues/241 and https://github.com/docker/compose/issues/8537
- name: Install Elixir and JS deps
run: |
docker compose exec -T phx mix deps.get && yarn install && cd assets && yarn install && cd ..
- name: Create and Migrate database
run: |
docker compose exec -T phx mix ecto.create
docker compose exec -T phx mix ecto.migrate
- name: Run code checks
run: docker compose exec -T phx mix check --no-fix --no-retry