-
Notifications
You must be signed in to change notification settings - Fork 427
139 lines (137 loc) · 4.54 KB
/
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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Test
on:
pull_request:
push:
branches:
- main
- "v*.*"
jobs:
main:
runs-on: ubuntu-latest
env:
MIX_ENV: test
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Read ./versions
run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.otp }}
elixir-version: ${{ env.elixir }}
- name: Cache Mix
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
- name: Install mix dependencies
run: mix deps.get
- name: Check formatting
run: mix format --check-formatted
- name: Check warnings
run: mix compile --warnings-as-errors
- name: Run tests
run: mix test
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install npm dependencies
run: npm ci --prefix assets
- name: Check assets formatting
run: npm run format-check --prefix assets
- name: Run assets tests
run: npm test --prefix assets
windows:
runs-on: windows-latest
if: github.event_name == 'push'
env:
MIX_ENV: test
ELIXIR_ERL_OPTIONS: "-epmd_module Elixir.Livebook.EPMD"
steps:
- name: Configure Git
run: git config --global core.autocrlf input
- name: Checkout git repo
uses: actions/checkout@v4
- name: Read ./versions
shell: bash
run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Install Erlang & Elixir
uses: erlef/setup-beam@v1
with:
version-type: strict
otp-version: ${{ env.otp }}
elixir-version: ${{ env.elixir }}
- name: Start epmd
run: $(elixir -e 'IO.puts "#{:code.root_dir()}/erts-#{:erlang.system_info(:version)}"')/bin/epmd.exe -daemon
shell: bash
# Add tar that supports symlinks, see https://github.com/actions/virtual-environments/issues/4679
- name: Add tar.exe
run: |
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Cache Mix
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
# Reinstalling deps fails on Windows in rare cases, so we always use a new cache
# restore-keys: |
# ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
- name: Install mix dependencies
run: mix deps.get
- name: Run tests
run: mix test
- name: Build the app
run: bash .github/scripts/app/build_windows.sh
macos:
runs-on: macos-latest
if: github.event_name == 'push'
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Read ./versions
run: |
. versions
echo "elixir=$elixir" >> $GITHUB_ENV
echo "otp=$otp" >> $GITHUB_ENV
echo "openssl=$openssl" >> $GITHUB_ENV
- name: Cache Mix Deps
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
- name: Cache Bootstrap OTP
uses: actions/cache@v4
with:
path: elixirkit/otp_bootstrap/_build/otp-rel-${{ env.otp }}-openssl-${{ env.openssl }}-macos-universal
key: ${{ runner.os }}-bootstrap-${{ env.otp }}-${{ hashFiles('elixirkit/otp_bootstrap/build.sh') }}
- name: Cache Elixir
uses: actions/cache@v4
with:
path: _build/elixir-${{ env.elixir }}
key: ${{ runner.os }}-elixir-${{ env.elixir }}
- name: Build the app
run: .github/scripts/app/build_macos.sh