Repository navigation
147 lines (138 loc) · 5.56 KB
/
Copy pathci.yml
File metadata and controls
147 lines (138 loc) · 5.56 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
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
140
141
142
143
144
145
146
147
name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "*"
jobs:
lint:
runs-on: ${{ matrix.os }}
env:
MIX_ENV: dev
name: Lint
strategy:
matrix:
os: ["ubuntu-latest"]
elixir: ["1.20"]
otp: ["29"]
steps:
- uses: actions/checkout@v7
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@v6
with:
path: deps
key: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_
- run: mix deps.get
- run: mix deps.compile
- run: mix format --check-formatted
- run: clang-format --dry-run --Werror c_src/sqlite3_nif.c
- run: mix deps.unlock --check-unused
- run: mix credo --all
test:
runs-on: ${{ matrix.os }}
env:
MIX_ENV: test
DEBUG: "1"
name: Test Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}, OS ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
elixir: ["1.20", "1.19", "1.18"]
otp: ["29", "28", "27"]
exclude:
- elixir: "1.19"
otp: "29"
- elixir: "1.18"
otp: "29"
include:
- os: "windows-2022"
otp: "29"
elixir: "1.20"
steps:
- uses: actions/checkout@v7
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-2022'
with:
arch: x64
- uses: actions/cache@v6
with:
path: deps
key: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_
- run: mix deps.get --only test
- run: mix deps.compile
- run: mix compile
- name: Test with Erlang allocator
run: mix test
env:
EXQLITE_DISABLE_ERLANG_ALLOCATOR: "false"
- name: Test without Erlang allocator
run: mix test
env:
EXQLITE_DISABLE_ERLANG_ALLOCATOR: "true"
c-check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: erlef/setup-beam@v1
with:
otp-version: "29"
elixir-version: "1.20"
- id: c-check-key
run: |
header=$(erl -noshell -eval 'io:format("~s", [filename:join([code:root_dir(), "erts-" ++ erlang:system_info(version), "include", "erl_nif.h"])]), halt().')
nif=$(sha256sum "$header" | awk '{print $1}')
echo "nif=${nif}" >> "$GITHUB_OUTPUT"
# Not the Test job cache, and not the ASan build cache. This job
# does not compile the NIF. An exact hit means these sources
# already passed for this erl_nif.h.
- uses: actions/cache@v6
id: c-check-cache
with:
path: .cache/c-check
key: c-check-${{ runner.os }}-${{ env.ImageVersion }}-otp_29-elixir_1.20-${{ steps.c-check-key.outputs.nif }}-${{ hashFiles('c_src/sqlite3_nif.c', 'c_src/sqlite3.h', 'c_src/sqlite3ext.h', 'Makefile') }}
- if: steps.c-check-cache.outputs.cache-hit == 'true'
run: echo "c-check already passed for these sources."
- if: steps.c-check-cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y clang
- if: steps.c-check-cache.outputs.cache-hit != 'true'
run: |
make c-check
mkdir -p .cache/c-check
: > .cache/c-check/ok
c-sanitizers:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v7
- uses: erlef/setup-beam@v1
with:
otp-version: "29"
elixir-version: "1.20"
# Separate from the Test job cache. That cache is deps built
# without ASan. Restoring it here would mix the two trees.
- uses: actions/cache@v6
with:
path: |
deps
_build/c-sanitizers
key: c-sanitizers-asan-${{ runner.os }}-otp_29-elixir_1.20-${{ hashFiles('**/mix.lock', 'mix.exs', 'c_src/*', 'Makefile', 'scripts/test-c-sanitizers.sh') }}
restore-keys: |
c-sanitizers-asan-${{ runner.os }}-otp_29-elixir_1.20-
- run: sudo apt-get update && sudo apt-get install -y clang libclang-rt-dev llvm
- run: mix deps.get
# No arguments: the script runs the full test/ suite.
- run: sh scripts/test-c-sanitizers.sh