@@ -21,19 +21,16 @@ jobs:
21
21
fail-fast : false
22
22
matrix :
23
23
rust : ["stable", "beta", "nightly"]
24
- backend : ["postgres", "mysql"]
25
- os : [ubuntu-latest, macos-latest, windows-latest]
24
+ backend : ["postgres", "mysql", "sqlite" ]
25
+ os : [ubuntu-latest, macos-latest, macos-14, windows-latest]
26
26
runs-on : ${{ matrix.os }}
27
27
steps :
28
28
- name : Checkout sources
29
- uses : actions/checkout@v2
29
+ uses : actions/checkout@v4
30
30
31
31
- name : Cache cargo registry
32
- uses : actions/ cache@v2
32
+ uses : Swatinem/rust- cache@v2
33
33
with :
34
- path : |
35
- ~/.cargo/registry
36
- ~/.cargo/git
37
34
key : ${{ runner.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }}
38
35
39
36
- name : Set environment variables
@@ -66,25 +63,85 @@ jobs:
66
63
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot
67
64
echo "DATABASE_URL=mysql://root:root@localhost/diesel_test" >> $GITHUB_ENV
68
65
66
+ - name : Install sqlite (Linux)
67
+ if : runner.os == 'Linux' && matrix.backend == 'sqlite'
68
+ run : |
69
+ curl -fsS --retry 3 -o sqlite-autoconf-3400100.tar.gz https://www.sqlite.org/2022/sqlite-autoconf-3400100.tar.gz
70
+ tar zxf sqlite-autoconf-3400100.tar.gz
71
+ cd sqlite-autoconf-3400100
72
+ CFLAGS="$CFLAGS -O2 -fno-strict-aliasing \
73
+ -DSQLITE_DEFAULT_FOREIGN_KEYS=1 \
74
+ -DSQLITE_SECURE_DELETE \
75
+ -DSQLITE_ENABLE_COLUMN_METADATA \
76
+ -DSQLITE_ENABLE_FTS3_PARENTHESIS \
77
+ -DSQLITE_ENABLE_RTREE=1 \
78
+ -DSQLITE_SOUNDEX=1 \
79
+ -DSQLITE_ENABLE_UNLOCK_NOTIFY \
80
+ -DSQLITE_OMIT_LOOKASIDE=1 \
81
+ -DSQLITE_ENABLE_DBSTAT_VTAB \
82
+ -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \
83
+ -DSQLITE_ENABLE_LOAD_EXTENSION \
84
+ -DSQLITE_ENABLE_JSON1 \
85
+ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \
86
+ -DSQLITE_THREADSAFE=1 \
87
+ -DSQLITE_ENABLE_FTS3_TOKENIZER=1 \
88
+ -DSQLITE_MAX_SCHEMA_RETRY=25 \
89
+ -DSQLITE_ENABLE_PREUPDATE_HOOK \
90
+ -DSQLITE_ENABLE_SESSION \
91
+ -DSQLITE_ENABLE_STMTVTAB \
92
+ -DSQLITE_MAX_VARIABLE_NUMBER=250000" \
93
+ ./configure --prefix=/usr \
94
+ --enable-threadsafe \
95
+ --enable-dynamic-extensions \
96
+ --libdir=/usr/lib/x86_64-linux-gnu \
97
+ --libexecdir=/usr/lib/x86_64-linux-gnu/sqlite3
98
+ sudo make
99
+ sudo make install
100
+ echo "DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
101
+
69
102
- name : Install postgres (MacOS)
70
- if : runner .os == 'macOS ' && matrix.backend == 'postgres'
103
+ if : matrix .os == 'macos-latest ' && matrix.backend == 'postgres'
71
104
run : |
72
105
initdb -D /usr/local/var/postgres
73
106
pg_ctl -D /usr/local/var/postgres start
74
107
sleep 3
75
108
createuser -s postgres
76
109
echo "DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV
77
110
111
+ - name : Install postgres (MacOS M1)
112
+ if : matrix.os == 'macos-14' && matrix.backend == 'postgres'
113
+ run : |
114
+ brew install postgresql
115
+ brew services start postgresql@14
116
+ sleep 3
117
+ createuser -s postgres
118
+ echo "DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV
119
+ - name : Install sqlite (MacOS)
120
+ if : runner.os == 'macOS' && matrix.backend == 'sqlite'
121
+ run : |
122
+ brew install sqlite
123
+ echo "DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
124
+
78
125
- name : Install mysql (MacOS)
79
- if : runner .os == 'macOS ' && matrix.backend == 'mysql'
126
+ if : matrix .os == 'macos-latest ' && matrix.backend == 'mysql'
80
127
run : |
81
- brew install --overwrite mariadb@10.8
82
- /usr/local/opt/mariadb@10.8 /bin/mysql_install_db
83
- /usr/local/opt/mariadb@10.8 /bin/mysql.server start
128
+ brew install mariadb@10.5
129
+ /usr/local/opt/mariadb@10.5 /bin/mysql_install_db
130
+ /usr/local/opt/mariadb@10.5 /bin/mysql.server start
84
131
sleep 3
85
- /usr/local/opt/[email protected] /bin/mysql -e "ALTER USER 'runner'@'localhost' IDENTIFIED BY 'diesel';" -urunner
86
- /usr/local/opt/[email protected] /bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'runner'@'localhost';" -urunner -pdiesel
87
- echo "DATABASE_URL=mysql://runner:diesel@localhost/diesel_test" >> $GITHUB_ENV
132
+ /usr/local/opt/[email protected] /bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'runner'@'localhost';" -urunner
133
+ echo "DATABASE_URL=mysql://runner@localhost/diesel_test" >> $GITHUB_ENV
134
+
135
+ - name : Install mysql (MacOS M1)
136
+ if : matrix.os == 'macos-14' && matrix.backend == 'mysql'
137
+ run : |
138
+
139
+ ls /opt/homebrew/opt/[email protected]
140
+ /opt/homebrew/opt/[email protected] /bin/mysql_install_db
141
+ /opt/homebrew/opt/[email protected] /bin/mysql.server start
142
+ sleep 3
143
+ /opt/homebrew/opt/[email protected] /bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'runner'@'localhost';" -urunner
144
+ echo "DATABASE_URL=mysql://runner@localhost/diesel_test" >> $GITHUB_ENV
88
145
89
146
- name : Install postgres (Windows)
90
147
if : runner.os == 'Windows' && matrix.backend == 'postgres'
@@ -106,6 +163,22 @@ jobs:
106
163
run : |
107
164
echo "DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV
108
165
166
+ - name : Install sqlite (Windows)
167
+ if : runner.os == 'Windows' && matrix.backend == 'sqlite'
168
+ shell : cmd
169
+ run : |
170
+ choco install sqlite
171
+ cd /D C:\ProgramData\chocolatey\lib\SQLite\tools
172
+ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
173
+ lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib
174
+ - name : Set variables for sqlite (Windows)
175
+ if : runner.os == 'Windows' && matrix.backend == 'sqlite'
176
+ shell : bash
177
+ run : |
178
+ echo "C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_PATH
179
+ echo "SQLITE3_LIB_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_ENV
180
+ echo "DATABASE_URL=C:\test.db" >> $GITHUB_ENV
181
+
109
182
- name : Install rust toolchain
110
183
uses : dtolnay/rust-toolchain@master
111
184
with :
@@ -115,26 +188,29 @@ jobs:
115
188
116
189
- name : Test diesel_async
117
190
run : cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc"
118
- - name : Run examples
191
+
192
+ - name : Run examples (Postgres)
119
193
if : matrix.backend == 'postgres'
120
194
run : |
121
195
cargo +${{ matrix.rust }} check --manifest-path examples/postgres/pooled-with-rustls/Cargo.toml
122
196
cargo +${{ matrix.rust }} check --manifest-path examples/postgres/run-pending-migrations-with-rustls/Cargo.toml
123
197
198
+ - name : Run examples (Sqlite)
199
+ if : matrix.backend == 'sqlite'
200
+ run : |
201
+ cargo +${{ matrix.rust }} check --manifest-path examples/sync-wrapper/Cargo.toml
202
+
124
203
rustfmt_and_clippy :
125
204
name : Check rustfmt style && run clippy
126
205
runs-on : ubuntu-latest
127
206
steps :
128
- - uses : actions/checkout@v2
207
+ - uses : actions/checkout@v4
129
208
- uses : dtolnay/rust-toolchain@stable
130
209
with :
131
210
components : clippy, rustfmt
132
211
- name : Cache cargo registry
133
- uses : actions/ cache@v2
212
+ uses : Swatinem/rust- cache@v2
134
213
with :
135
- path : |
136
- ~/.cargo/registry
137
- ~/.cargo/git
138
214
key : clippy-cargo-${{ hashFiles('**/Cargo.toml') }}
139
215
140
216
- name : Remove potential newer clippy.toml from dependencies
@@ -152,12 +228,12 @@ jobs:
152
228
name : Check Minimal supported rust version (1.65.0)
153
229
runs-on : ubuntu-latest
154
230
steps :
155
- - uses : actions/checkout@v3
231
+ - uses : actions/checkout@v4
156
232
157
233
- uses : dtolnay/rust-toolchain@nightly
158
234
- uses : taiki-e/install-action@cargo-hack
159
235
- uses : taiki-e/install-action@cargo-minimal-versions
160
236
- name : Check diesel-async
161
237
# cannot test mysql yet as that crate
162
238
# has broken min-version dependencies
163
- run : cargo +stable minimal-versions check -p diesel-async --features "postgres bb8 deadpool mobc"
239
+ run : cargo +stable minimal-versions check -p diesel-async --features "postgres bb8 deadpool mobc sqlite "
0 commit comments