Repository navigation
109 lines (97 loc) · 3.3 KB
/
Copy pathtest-elixir.yaml
File metadata and controls
109 lines (97 loc) · 3.3 KB
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
name: test-elixir
on:
workflow_call:
inputs:
oss:
type: string
default: '["ubuntu-24.04"]'
workflow_dispatch:
inputs:
oss:
type: string
default: '["ubuntu-24.04"]'
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.15.7"]
runs-on: ${{matrix.os}}
steps:
# Step: Check out the code.
- name: Checkout code
uses: actions/checkout@v7
# 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.24.1
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@v6
env:
cache-name: cache-elixir-deps
with:
path: prqlc/bindings/elixir/deps
key:
${{ runner.os }}-mix-${{ env.cache-name }}-${{
hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
# Step: Cache `_build` and `priv`. Rustler builds the NIF via cargo into
# the workspace `target/` and copies it to `priv/native/prql.so`; without
# caching `priv`, the cache restores beam files (which look up-to-date to
# mix) but the .so is missing, so `mix compile` skips Rustler and tests
# fail to load the NIF.
#
# The key includes Cargo.lock and Rust sources so the .so is rebuilt when
# any prqlc Rust code changes. Restore-keys are intentionally absent —
# a partial-prefix restore would deliver a stale .so on Rust changes.
- name: Cache compiled build
id: cache-build
uses: actions/cache@v6
env:
cache-name: cache-compiled-build-v2
with:
path: |
prqlc/bindings/elixir/_build
prqlc/bindings/elixir/priv
key:
${{ runner.os }}-mix-${{ env.cache-name }}-${{
hashFiles('**/mix.lock', '**/Cargo.lock', 'prqlc/**/*.rs',
'prqlc/**/Cargo.toml') }}
# 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