-
Notifications
You must be signed in to change notification settings - Fork 59
107 lines (92 loc) · 2.74 KB
/
build.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: build
on:
push:
branches:
- '**/*'
workflow_dispatch:
jobs:
build:
name: build
runs-on: ubuntu-24.04
env:
ERLANG_VERSION: 26.2.5.5
ELIXIR_VERSION: 1.17.3
MINESWEEPER_DATABASE_URL: ecto://minesweeper:minesweeper@localhost/minesweeper
MINESWEEPER_SECRET_KEY_BASE: secret
strategy:
matrix:
postgres: [12, 13, 14, 15, 16, 17]
services:
postgres:
image: postgres:${{ matrix.postgres }}
ports:
- 5432:5432
env:
POSTGRES_DB: minesweeper
POSTGRES_USER: minesweeper
POSTGRES_PASSWORD: minesweeper
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# https://github.com/actions/checkout
- name: Checkout the repository
uses: actions/checkout@v4
# https://github.com/actions/cache
- name: Cache build
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-erlang-${{ env.ERLANG_VERSION }}-elixir-${{ env.ELIXIR_VERSION }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-erlang-${{ env.ERLANG_VERSION }}-elixir-${{ env.ELIXIR_VERSION }}-
# https://github.com/erlef/setup-beam
- name: Install Erlang/OTP & Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.ERLANG_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
# https://github.com/asdf-vm/actions#setup
- name: Install asdf
uses: asdf-vm/actions/setup@v3
with:
asdf_branch: v0.14.1
- name: Install Node.js with asdf
run: |
asdf plugin add nodejs
asdf install nodejs
node --version
- name: Install backend dependencies
run: |
mix deps.get
- name: Install frontend dependencies
run: |
npm ci
- name: Compile the application
run: |
mix compile
- name: Create and migrate the database
run: |
mix ecto.create
mix ecto.migrate
- name: Run automated tests & measure code coverage for the backend
id: tests
run: |
mix coveralls.html --raise
- name: Check backend code formatting
run: |
mix format --check-formatted
- name: Check for unused dependencies
run: |
mix deps.unlock --check-unused
- name: Show retired dependencies
run: |
mix hex.audit
- name: Ensure there are no uncommitted changes
run: |
git status --porcelain
test -z "$(git status --porcelain)"