Skip to content

Fix impl SqlOrd postgres > postgres_backend feature flag. #3060

Fix impl SqlOrd postgres > postgres_backend feature flag.

Fix impl SqlOrd postgres > postgres_backend feature flag. #3060

Workflow file for this run

on:
merge_group:
types: [checks_requested]
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
- "0.[0-9]+.x"
- "1.[0-9]+.x"
- "2.[0-9]+.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
needs: [sqlite_bundled, rustfmt_and_clippy]
strategy:
fail-fast: false
matrix:
rust: ["stable", "beta", "nightly"]
backend: ["postgres", "sqlite", "mysql"]
os: [ubuntu-latest, macos-latest, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
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.rust == 'nightly'
run: |
echo "RUSTFLAGS=--cfg doc_cfg" >> $GITHUB_ENV
echo "RUSTDOCFLAGS=--cfg doc_cfg" >> $GITHUB_ENV
- name: Set environment variables
shell: bash
if: matrix.rust != 'nightly'
run: |
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
echo "RUSTDOCFLAGS=-D warnings" >> $GITHUB_ENV
- name: Install postgres (Linux)
if: runner.os == 'Linux' && matrix.backend == 'postgres'
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev 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 "PG_DATABASE_URL=postgres://postgres:postgres@localhost/" >> $GITHUB_ENV
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres:postgres@localhost/diesel_example" >> $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 "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
- name: Install mysql (Linux)
if: runner.os == 'Linux' && matrix.backend == 'mysql'
run: |
sudo systemctl start mysql.service
sudo apt-get update
sudo apt-get -y install libmysqlclient-dev
mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot -proot
echo "MYSQL_DATABASE_URL=mysql://root:root@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:root@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@localhost/diesel_unit_test" >> $GITHUB_ENV
- name: Install postgres (MacOS)
if: runner.os == 'macOS' && matrix.backend == 'postgres'
run: |
initdb -D /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres start
sleep 3
createuser -s postgres
echo "PG_DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres@localhost/diesel_example" >> $GITHUB_ENV
- name: Install sqlite (MacOS)
if: runner.os == 'macOS' && matrix.backend == 'sqlite'
run: |
brew install sqlite
echo "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
- name: Install mysql (MacOS)
if: runner.os == 'macOS' && matrix.backend == 'mysql'
run: |
brew install mariadb@10.5
/usr/local/opt/mariadb@10.5/bin/mysql_install_db
/usr/local/opt/mariadb@10.5/bin/mysql.server start
sleep 3
/usr/local/opt/mariadb@10.5/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'runner'@'localhost';" -urunner
echo "MYSQL_DATABASE_URL=mysql://runner@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://runner@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://runner@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/mariadb@10.5/lib" >> $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 "SQLITE_DATABASE_URL=C:\test.db" >> $GITHUB_ENV
- name: Install postgres (Windows)
if: runner.os == 'Windows' && matrix.backend == 'postgres'
shell: bash
run: |
choco install postgresql12 --force --params '/Password:root'
echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH
echo "C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_PATH
echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\12\lib" >> $GITHUB_ENV
echo "PG_DATABASE_URL=postgres://postgres:root@localhost/" >> $GITHUB_ENV
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres:root@localhost/diesel_example" >> $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 "MYSQL_DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@localhost/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=C:\tools\mysql\current\lib" >> $GITHUB_ENV
echo "C:\tools\mysql\current\lib" >> $GITHUB_PATH
echo "C:\tools\mysql\current\bin" >> $GITHUB_PATH
dir "C:\tools\mysql\current\lib"
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Rust version check
shell: bash
run: |
cargo +${{ matrix.rust }} --version
rustc +${{ matrix.rust }} --version
- name: Test diesel (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel/Cargo.toml --no-default-features --features "${{ matrix.backend }} unstable extras i-implement-a-third-party-backend-and-opt-into-breaking-changes"
- name: Test diesel
if: matrix.rust == 'stable'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel/Cargo.toml --no-default-features --features "${{ matrix.backend }} extras r2d2"
- name: Test diesel (with-deprecated)
if: matrix.rust == 'beta'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel/Cargo.toml --no-default-features --features "${{ matrix.backend }} extras with-deprecated"
- name: Test diesel-derives (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} diesel/unstable diesel/time time diesel/chrono chrono ${{ matrix.backend }}"
- name: Test diesel-derives
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_derives/Cargo.toml --no-default-features --features "diesel/${{ matrix.backend }} ${{ matrix.backend }}"
- name: Test diesel-cli
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "${{ matrix.backend }}"
- name: Test diesel examples
shell: bash
env:
BACKEND: ${{ matrix.backend }}
run: |
(cd examples/${{ matrix.backend }} && rustup run ${{ matrix.rust }} bash test_all)
- name: Test migrations-internals
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_migrations/migrations_internals/Cargo.toml
- name: Test migrations-macros
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_migrations/migrations_macros/Cargo.toml --features "diesel/${{ matrix.backend }} ${{ matrix.backend }}"
- name: Test table-macro-syntax
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_table_macro_syntax/Cargo.toml
- name: Test diesel_migrations
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_migrations/Cargo.toml --features "${{ matrix.backend }} diesel/${{ matrix.backend }}"
- name: Run diesel_tests (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "${{ matrix.backend }} unstable"
- name: Run diesel_tests (beta)
if: matrix.rust == 'beta'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "${{ matrix.backend }} returning_clauses_for_sqlite_3_35 libsqlite3-sys/bundled"
- name: Run diesel_tests
if: matrix.rust == 'stable'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "${{ matrix.backend }}"
- name: Run diesel_dynamic_schema tests
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_dynamic_schema/Cargo.toml --no-default-features --features "${{ matrix.backend }} diesel/${{ matrix.backend }}"
- name: Run diesel_benches
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_bench/Cargo.toml --no-default-features --features "${{ matrix.backend }}" --bench benchmarks
- name: Run rustdoc (nightly)
if: matrix.rust == 'nightly'
shell: bash
run: cargo +${{ matrix.rust }} doc --manifest-path diesel/Cargo.toml --no-deps --no-default-features --features "${{ matrix.backend }} unstable i-implement-a-third-party-backend-and-opt-into-breaking-changes extras"
- name: Run rustdoc
if: matrix.rust == 'stable'
shell: bash
run: cargo +${{ matrix.rust }} doc --manifest-path diesel/Cargo.toml --no-deps --no-default-features --features "${{ matrix.backend }}"
- name: Run rustdoc (with-deprecated)
if: matrix.rust == 'beta'
shell: bash
run: cargo +${{ matrix.rust }} doc --manifest-path diesel/Cargo.toml --no-deps --no-default-features --features "${{ matrix.backend }} with-deprecated"
compile_tests:
name: Compiletests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-09-21
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: compile_test-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
- name: Run compile tests
shell: bash
run: cargo +nightly-2023-09-21 test --manifest-path diesel_compile_tests/Cargo.toml
rustfmt_and_clippy:
name: Check rustfmt style && run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
- name: Set environment variables
shell: bash
run: |
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV
echo "RUSTDOCFLAGS=-D warnings" >> $GITHUB_ENV
- name: Remove potential newer clippy.toml from dependencies
run: |
cargo +stable update
cargo +stable fetch
find ~/.cargo/registry -iname "*clippy.toml" -delete
- name: Run clippy
run: |
cargo +stable clippy --tests --manifest-path diesel_table_macro_syntax/Cargo.toml
cargo +stable clippy --tests --manifest-path diesel_derives/Cargo.toml --features "postgres diesel/postgres"
cargo +stable clippy --tests --manifest-path diesel/Cargo.toml --features "postgres"
cargo +stable clippy --tests --manifest-path diesel_dynamic_schema/Cargo.toml --features "postgres diesel/postgres"
cargo +stable clippy --tests --manifest-path diesel_migrations/migrations_internals/Cargo.toml
cargo +stable clippy --tests --manifest-path diesel_migrations/migrations_macros/Cargo.toml --features "postgres diesel/postgres"
cargo +stable clippy --tests --manifest-path diesel_migrations/Cargo.toml --features "postgres diesel/postgres"
cargo +stable clippy --tests --manifest-path diesel_cli/Cargo.toml --features "postgres" --no-default-features
cargo +stable clippy --tests --manifest-path diesel_tests/Cargo.toml --features "postgres"
cargo +stable clippy --tests --manifest-path examples/postgres/getting_started_step_1/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/getting_started_step_2/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/getting_started_step_3/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/advanced-blog-cli/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/all_about_inserts/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/all_about_updates/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/custom_types/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/postgres/relations/Cargo.toml
cargo +stable clippy --tests --manifest-path diesel_derives/Cargo.toml --features "sqlite diesel/sqlite"
cargo +stable clippy --tests --manifest-path diesel/Cargo.toml --features "sqlite"
cargo +stable clippy --tests --manifest-path diesel_dynamic_schema/Cargo.toml --features "sqlite diesel/sqlite"
cargo +stable clippy --tests --manifest-path diesel_migrations/migrations_macros/Cargo.toml --features "sqlite diesel/sqlite"
cargo +stable clippy --tests --manifest-path diesel_migrations/Cargo.toml --features "sqlite diesel/sqlite"
cargo +stable clippy --tests --manifest-path diesel_cli/Cargo.toml --features "sqlite" --no-default-features
cargo +stable clippy --tests --manifest-path diesel_tests/Cargo.toml --features "sqlite"
cargo +stable clippy --tests --manifest-path examples/sqlite/getting_started_step_1/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/sqlite/getting_started_step_2/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/sqlite/getting_started_step_3/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/sqlite/all_about_inserts/Cargo.toml
cargo +stable clippy --tests --manifest-path diesel_derives/Cargo.toml --features "mysql diesel/mysql"
cargo +stable clippy --tests --manifest-path diesel/Cargo.toml --features "mysql"
cargo +stable clippy --tests --manifest-path diesel_dynamic_schema/Cargo.toml --features "mysql diesel/mysql"
cargo +stable clippy --tests --manifest-path diesel_migrations/migrations_macros/Cargo.toml --features "mysql diesel/mysql"
cargo +stable clippy --tests --manifest-path diesel_migrations/Cargo.toml --features "mysql diesel/mysql"
cargo +stable clippy --tests --manifest-path diesel_cli/Cargo.toml --features "mysql" --no-default-features
cargo +stable clippy --tests --manifest-path diesel_tests/Cargo.toml --features "mysql"
cargo +stable clippy --tests --manifest-path examples/mysql/getting_started_step_1/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/mysql/getting_started_step_2/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/mysql/getting_started_step_3/Cargo.toml
cargo +stable clippy --tests --manifest-path examples/mysql/all_about_inserts/Cargo.toml
- name: Check formatting
run: cargo +stable fmt --all -- --check
sqlite_bundled:
name: Check sqlite bundled + Sqlite with asan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: "rust-src"
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: sqlite_bundled-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Test diesel-cli
run: cargo +nightly test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "sqlite-bundled"
- name: Run diesel_tests with ASAN enabled
env:
RUSTFLAGS: -Zsanitizer=address
ASAN_OPTIONS: detect_stack_use_after_return=1
run: cargo +nightly -Z build-std test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "sqlite libsqlite3-sys libsqlite3-sys/bundled libsqlite3-sys/with-asan" --target x86_64-unknown-linux-gnu
- name: Run diesel tests with ASAN enabled
env:
RUSTDOCFLAGS: -Zsanitizer=address
RUSTFLAGS: -Zsanitizer=address
ASAN_OPTIONS: detect_stack_use_after_return=1
run: cargo +nightly -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "sqlite extras libsqlite3-sys libsqlite3-sys/bundled libsqlite3-sys/with-asan" --target x86_64-unknown-linux-gnu
minimal_rust_version:
name: Check Minimal supported rust version (1.66.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.66.0
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: minimal_rust_version-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
- name: Check diesel_derives
run: cargo +1.66.0 minimal-versions check -p diesel_derives --features "postgres sqlite mysql 32-column-tables 64-column-tables 128-column-tables without-deprecated with-deprecated r2d2"
- name: Check diesel
run: cargo +1.66.0 minimal-versions check -p diesel --features "postgres mysql sqlite extras"
- name: Check diesel_dynamic_schema
run: cargo +1.66.0 minimal-versions check -p diesel-dynamic-schema --all-features
- name: Check diesel_migrations
run: cargo +1.66.0 minimal-versions check -p diesel_migrations --all-features
- name: Check diesel_cli
run: cargo +1.66.0 minimal-versions check -p diesel_cli --all-features
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check the spelling of the files in our repo
uses: crate-ci/typos@master