-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (91 loc) · 2.88 KB
/
test-elixir.yaml
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
name: test-elixir
on:
workflow_call:
inputs:
oss:
type: string
default: '["ubuntu-latest"]'
workflow_dispatch:
inputs:
oss:
type: string
default: '["ubuntu-latest"]'
defaults:
run:
working-directory: prqlc/bindings/elixir
env:
MIX_ENV: test
# We need consistent env vars across all workflows for the cache to work
CARGO_TERM_COLOR: always
CLICOLOR_FORCE: 1
RUSTFLAGS: "-C debuginfo=0"
RUSTDOCFLAGS: "-Dwarnings"
jobs:
test:
strategy:
matrix:
os: ${{ fromJSON(inputs.oss) }}
otp: ["25.1.2"]
elixir: ["1.14.2"]
runs-on: ${{matrix.os}}
steps:
# Step: Check out the code.
- name: Checkout code
uses: actions/checkout@v4
# Step: Setup Elixir + Erlang image as the base.
- name: Set up Elixir on Windows or Linux
if: runner.os != 'macOS'
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Install Erlang/Elixir on Mac
if: runner.os == 'macOS'
run: |
brew install elixir
mix local.hex --force
# Step: Define how to cache deps. Restores existing cache if present.
- name: Cache deps
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: elixir/deps
key:
${{ runner.os }}-mix-${{ env.cache-name }}-${{
hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
# Step: Define how to cache the `_build` directory. After the first run,
# this speeds up tests runs a lot. This includes not re-compiling our
# project's downloaded deps every run.
- name: Cache compiled build
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:
path: elixir/_build
key:
${{ runner.os }}-mix-${{ env.cache-name }}-${{
hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
# Step: Download project dependencies. If unchanged, uses
# the cached version.
- name: Install dependencies
run: mix deps.get
# Step: Compile the project treating any warnings as errors.
# Customize this step if a different behavior is desired.
- name: Compiles without warnings
run: mix compile --warnings-as-errors
# Step: Check that the checked in code has already been formatted.
# This step fails if something was found unformatted.
# Customize this step as desired.
- name: Check Formatting
run: mix format --check-formatted
# Step: Execute the tests.
- name: Run tests
run: mix test