opt out of Send
for wasm32
#317
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- main | |
- 0.3.x | |
- 0.4.x | |
- 0.2.x | |
name: CI Tests | |
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. | |
# This will ensure that only one commit will be running tests at a time on each PR. | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
check_and_test: | |
name: Check | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: ["stable", "beta", "nightly"] | |
backend: ["postgres", "mysql", "sqlite"] | |
os: [ubuntu-latest, macos-13, macos-14, windows-2019] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Cache cargo registry | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
- name: Set environment variables | |
shell: bash | |
if: matrix.backend == 'mysql' | |
run: | | |
echo "RUST_TEST_THREADS=1" >> $GITHUB_ENV | |
- name: Set environment variables | |
shell: bash | |
if: matrix.backend == 'postgres' && matrix.os == 'windows-2019' | |
run: | | |
echo "AWS_LC_SYS_NO_ASM=1" | |
- name: Set environment variables | |
shell: bash | |
if: matrix.rust != 'nightly' | |
run: | | |
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV | |
echo "RUSTDOCFLAGS=-D warnings" >> $GITHUB_ENV | |
- uses: ilammy/setup-nasm@v1 | |
if: matrix.backend == 'postgres' && matrix.os == 'windows-2019' | |
- name: Install postgres (Linux) | |
if: runner.os == 'Linux' && matrix.backend == 'postgres' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql | |
echo "host all all 127.0.0.1/32 md5" > sudo tee -a /etc/postgresql/10/main/pg_hba.conf | |
sudo service postgresql restart && sleep 3 | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" | |
sudo service postgresql restart && sleep 3 | |
echo "DATABASE_URL=postgres://postgres:postgres@localhost/" >> $GITHUB_ENV | |
- name: Install mysql (Linux) | |
if: runner.os == 'Linux' && matrix.backend == 'mysql' | |
run: | | |
sudo systemctl start mysql.service | |
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot | |
echo "DATABASE_URL=mysql://root:root@localhost/diesel_test" >> $GITHUB_ENV | |
- name: Install sqlite (Linux) | |
if: runner.os == 'Linux' && matrix.backend == 'sqlite' | |
run: | | |
curl -fsS --retry 3 -o sqlite-autoconf-3400100.tar.gz https://www.sqlite.org/2022/sqlite-autoconf-3400100.tar.gz | |
tar zxf sqlite-autoconf-3400100.tar.gz | |
cd sqlite-autoconf-3400100 | |
CFLAGS="$CFLAGS -O2 -fno-strict-aliasing \ | |
-DSQLITE_DEFAULT_FOREIGN_KEYS=1 \ | |
-DSQLITE_SECURE_DELETE \ | |
-DSQLITE_ENABLE_COLUMN_METADATA \ | |
-DSQLITE_ENABLE_FTS3_PARENTHESIS \ | |
-DSQLITE_ENABLE_RTREE=1 \ | |
-DSQLITE_SOUNDEX=1 \ | |
-DSQLITE_ENABLE_UNLOCK_NOTIFY \ | |
-DSQLITE_OMIT_LOOKASIDE=1 \ | |
-DSQLITE_ENABLE_DBSTAT_VTAB \ | |
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \ | |
-DSQLITE_ENABLE_LOAD_EXTENSION \ | |
-DSQLITE_ENABLE_JSON1 \ | |
-DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ | |
-DSQLITE_THREADSAFE=1 \ | |
-DSQLITE_ENABLE_FTS3_TOKENIZER=1 \ | |
-DSQLITE_MAX_SCHEMA_RETRY=25 \ | |
-DSQLITE_ENABLE_PREUPDATE_HOOK \ | |
-DSQLITE_ENABLE_SESSION \ | |
-DSQLITE_ENABLE_STMTVTAB \ | |
-DSQLITE_MAX_VARIABLE_NUMBER=250000" \ | |
./configure --prefix=/usr \ | |
--enable-threadsafe \ | |
--enable-dynamic-extensions \ | |
--libdir=/usr/lib/x86_64-linux-gnu \ | |
--libexecdir=/usr/lib/x86_64-linux-gnu/sqlite3 | |
sudo make | |
sudo make install | |
echo "DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV | |
- name: Install postgres (MacOS) | |
if: matrix.os == 'macos-13' && matrix.backend == 'postgres' | |
run: | | |
brew install postgresql@14 | |
brew services start postgresql@14 | |
sleep 3 | |
createuser -s postgres | |
echo "DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV | |
- name: Install postgres (MacOS M1) | |
if: matrix.os == 'macos-14' && matrix.backend == 'postgres' | |
run: | | |
brew install postgresql@14 | |
brew services start postgresql@14 | |
sleep 3 | |
createuser -s postgres | |
echo "DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV | |
- name: Install sqlite (MacOS) | |
if: runner.os == 'macOS' && matrix.backend == 'sqlite' | |
run: | | |
brew install sqlite | |
echo "DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV | |
- name: Install mysql (MacOS) | |
if: matrix.os == 'macos-13' && matrix.backend == 'mysql' | |
run: | | |
brew install [email protected] | |
/usr/local/opt/[email protected]/bin/mysql_install_db | |
/usr/local/opt/[email protected]/bin/mysql.server start | |
sleep 3 | |
/usr/local/opt/[email protected]/bin/mysqladmin -u runner password diesel | |
/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 | |
echo "DATABASE_URL=mysql://runner:diesel@localhost/diesel_test" >> $GITHUB_ENV | |
- name: Install mysql (MacOS M1) | |
if: matrix.os == 'macos-14' && matrix.backend == 'mysql' | |
run: | | |
brew install [email protected] | |
ls /opt/homebrew/opt/[email protected] | |
/opt/homebrew/opt/[email protected]/bin/mysql_install_db | |
/opt/homebrew/opt/[email protected]/bin/mysql.server start | |
sleep 3 | |
/opt/homebrew/opt/[email protected]/bin/mysqladmin -u runner password diesel | |
/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 | |
echo "DATABASE_URL=mysql://runner:diesel@localhost/diesel_test" >> $GITHUB_ENV | |
- name: Install postgres (Windows) | |
if: runner.os == 'Windows' && matrix.backend == 'postgres' | |
shell: bash | |
run: | | |
choco install postgresql15 --force --params '/Password:root' | |
echo "DATABASE_URL=postgres://postgres:root@localhost/" >> $GITHUB_ENV | |
- name: Install mysql (Windows) | |
if: runner.os == 'Windows' && matrix.backend == 'mysql' | |
shell: cmd | |
run: | | |
choco install mysql | |
"C:\tools\mysql\current\bin\mysql" -e "create database diesel_test; create database diesel_unit_test; grant all on `diesel_%`.* to 'root'@'localhost';" -uroot | |
- name: Set variables for mysql (Windows) | |
if: runner.os == 'Windows' && matrix.backend == 'mysql' | |
shell: bash | |
run: | | |
echo "DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV | |
- name: Install sqlite (Windows) | |
if: runner.os == 'Windows' && matrix.backend == 'sqlite' | |
shell: cmd | |
run: | | |
choco install sqlite | |
cd /D C:\ProgramData\chocolatey\lib\SQLite\tools | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
lib /machine:x64 /def:sqlite3.def /out:sqlite3.lib | |
- name: Set variables for sqlite (Windows) | |
if: runner.os == 'Windows' && matrix.backend == 'sqlite' | |
shell: bash | |
run: | | |
echo "C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_PATH | |
echo "SQLITE3_LIB_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" >> $GITHUB_ENV | |
echo "DATABASE_URL=C:\test.db" >> $GITHUB_ENV | |
- name: Install rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Rust version check | |
run: cargo +${{ matrix.rust }} version | |
- name: Test diesel_async | |
run: cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc" | |
- name: Run examples (Postgres) | |
if: matrix.backend == 'postgres' | |
run: | | |
cargo +${{ matrix.rust }} check --manifest-path examples/postgres/pooled-with-rustls/Cargo.toml | |
cargo +${{ matrix.rust }} check --manifest-path examples/postgres/run-pending-migrations-with-rustls/Cargo.toml | |
- name: Run examples (Sqlite) | |
if: matrix.backend == 'sqlite' | |
run: | | |
cargo +${{ matrix.rust }} check --manifest-path examples/sync-wrapper/Cargo.toml | |
rustfmt_and_clippy: | |
name: Check rustfmt style && run clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Cache cargo registry | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }} | |
- name: Remove potential newer clippy.toml from dependencies | |
run: | | |
cargo update | |
cargo fetch | |
find ~/.cargo/registry -iname "*clippy.toml" -delete | |
- name: Run clippy | |
run: cargo +stable clippy --all --all-features | |
- name: Check formating | |
run: cargo +stable fmt --all -- --check | |
minimal_rust_version: | |
name: Check Minimal supported rust version (1.78.0) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/[email protected] | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@cargo-minimal-versions | |
- name: Check diesel-async | |
# cannot test mysql yet as that crate | |
# has broken min-version dependencies | |
# cannot test sqlite yet as that crate | |
# as broken min-version dependencies as well | |
run: cargo +1.78.0 minimal-versions check -p diesel-async --features "postgres bb8 deadpool mobc" |