Repository navigation
Preserve view inference across nested query scopes #7800
Workflow file for this run
This file contains hidden or 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: | |
| merge_group: | |
| types: [checks_requested] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: | |
| - main | |
| - "0.[0-9]+.x" | |
| - "1.[0-9]+.x" | |
| - "2.[0-9]+.x" | |
| name: CI Tests | |
| permissions: | |
| contents: "read" | |
| env: | |
| CARGO_NET_RETRY: 10 | |
| RUSTUP_MAX_RETRIES: 10 | |
| # Force HTTP/1.1 for crates.io downloads: HTTP/2 multiplexing against the | |
| # CDN intermittently drops connections mid-stream (SSL "unexpected eof"), | |
| # and cargo does not retry those, so CARGO_NET_RETRY alone cannot recover. | |
| CARGO_HTTP_MULTIPLEXING: "false" | |
| # 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: [rustfmt_and_clippy] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: ["stable"] | |
| backend: ["postgres", "sqlite", "mysql", "mariadb"] | |
| os: | |
| [ | |
| ubuntu-latest, | |
| macos-15-intel, | |
| macos-26, | |
| windows-2025, | |
| ubuntu-24.04-arm, | |
| ] | |
| include: | |
| - rust: "beta" | |
| backend: "postgres" | |
| os: "ubuntu-latest" | |
| - rust: "beta" | |
| backend: "sqlite" | |
| os: "ubuntu-latest" | |
| - rust: "beta" | |
| backend: "mysql" | |
| os: "ubuntu-latest" | |
| - rust: "beta" | |
| backend: "mariadb" | |
| os: "ubuntu-latest" | |
| - rust: "nightly" | |
| backend: "postgres" | |
| os: "ubuntu-latest" | |
| - rust: "nightly" | |
| backend: "sqlite" | |
| os: "ubuntu-latest" | |
| - rust: "nightly" | |
| backend: "mysql" | |
| os: "ubuntu-latest" | |
| - rust: "nightly" | |
| backend: "mariadb" | |
| os: "ubuntu-latest" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: ${{ matrix.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Set environment variables | |
| shell: bash | |
| if: matrix.rust == 'nightly' | |
| run: | | |
| 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 -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 install -y libpq-dev postgresql | |
| 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: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 install -y libsqlite3-dev | |
| echo "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV | |
| - name: Install mysql (Linux) | |
| if: runner.os == 'Linux' && matrix.backend == 'mysql' | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 install -y libtirpc-dev | |
| 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 "MYSQL_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| - name: Install mariadb (Linux) | |
| if: runner.os == 'Linux' && matrix.backend == 'mariadb' | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 install -y libmariadb-dev libmariadb-dev-compat mariadb-client | |
| # apt ships only MariaDB 10.x, so the 13.0 server comes from the official image | |
| docker run -d --name mariadb13 -e MARIADB_ROOT_PASSWORD=root -p 3306:3306 mariadb:13.0 | |
| # -h forces a TCP ping, which only succeeds once the entrypoint's init server is gone | |
| for i in $(seq 1 60); do | |
| if docker exec mariadb13 mariadb-admin ping -h 127.0.0.1 -uroot -proot --silent >/dev/null 2>&1; then | |
| break | |
| fi | |
| echo "Waiting for MariaDB 13 to accept connections ($i)..." | |
| sleep 2 | |
| done | |
| docker exec mariadb13 mariadb-admin ping -h 127.0.0.1 -uroot -proot --silent >/dev/null 2>&1 || { echo "MariaDB 13 did not become ready in time"; docker logs mariadb13; exit 1; } | |
| docker exec mariadb13 mariadb -uroot -proot -e "create database diesel_test; create database diesel_unit_test;" | |
| docker exec mariadb13 mariadb -h 127.0.0.1 -uroot -proot -e "SELECT VERSION();" | |
| echo "MARIADB_DATABASE_URL=mariadb://root:root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MARIADB_EXAMPLE_DATABASE_URL=mariadb://root:root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MARIADB_UNIT_TEST_DATABASE_URL=mariadb://root:root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| mariadb_config --cc_version | |
| - name: Install postgres (MacOS) | |
| if: runner.os == 'macOS' && matrix.backend == 'postgres' | |
| run: | | |
| brew update | |
| brew install postgresql@14 | |
| brew services start postgresql@14 | |
| sleep 3 | |
| createuser -s postgres | |
| echo "PG_DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV | |
| - name: Install sqlite (MacOS) | |
| if: runner.os == 'macOS' && matrix.backend == 'sqlite' | |
| run: | | |
| # otherwise brew install fails | |
| HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install sqlite | |
| echo "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV | |
| - name: Install mysql (MacOS Intel) | |
| if: matrix.os == 'macos-15-intel' && matrix.backend == 'mysql' | |
| run: | | |
| brew install mysql@8.4 | |
| /usr/local/opt/mysql@8.4/bin/mysql.server start | |
| sleep 3 | |
| /usr/local/opt/mysql@8.4/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot | |
| echo "MYSQL_DATABASE_URL=mysql://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/mysql@8.4/lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=8.4" >> $GITHUB_ENV | |
| - name: Install mariadb (MacOS Intel) | |
| if: matrix.os == 'macos-15-intel' && matrix.backend == 'mariadb' | |
| run: | | |
| brew install mariadb@12.3 | |
| /usr/local/opt/mariadb@12.3/bin/mysql.server start | |
| sleep 3 | |
| sudo /usr/local/opt/mariadb@12.3/bin/mariadb -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost' identified by '';" -uroot | |
| echo "MARIADB_DATABASE_URL=mariadb://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MARIADB_EXAMPLE_DATABASE_URL=mariadb://root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MARIADB_UNIT_TEST_DATABASE_URL=mariadb://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/mariadb@12.3/lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=3.4.9" >> $GITHUB_ENV | |
| - name: Install mysql (MacOS M1) | |
| if: matrix.os == 'macos-26' && matrix.backend == 'mysql' | |
| run: | | |
| brew install mysql@8.4 | |
| ls /opt/homebrew/opt/mysql@8.4 | |
| /opt/homebrew/opt/mysql@8.4/bin/mysql.server start | |
| sleep 3 | |
| /opt/homebrew/opt/mysql@8.4/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -uroot | |
| echo "MYSQL_DATABASE_URL=mysql://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@l127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=/opt/homebrew/opt/mysql@8.4/lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=8.4" >> $GITHUB_ENV | |
| - name: Install mariadb (MacOS M1) | |
| if: matrix.os == 'macos-26' && matrix.backend == 'mariadb' | |
| run: | | |
| brew install mariadb@12.3 | |
| ls /opt/homebrew/opt/mariadb@12.3 | |
| /opt/homebrew/opt/mariadb@12.3/bin/mysql.server start | |
| sleep 3 | |
| sudo /opt/homebrew/opt/mariadb@12.3/bin/mariadb -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost' identified by '';" -uroot | |
| echo "MARIADB_DATABASE_URL=mariadb://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MARIADB_EXAMPLE_DATABASE_URL=mariadb://root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MARIADB_UNIT_TEST_DATABASE_URL=mariadb://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=/opt/homebrew/opt/mariadb@12.3/lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=3.4.9" >> $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 | |
| for /f "usebackq tokens=*" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -property installationPath`) do call "%%i\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 postgresql14 --force --params '/Password:root' | |
| echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV | |
| echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV | |
| echo "PQ_LIB_DIR=C:\Program Files\PostgreSQL\14\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: bash | |
| run: | | |
| mkdir "C:\\Program Files\\MySQL\\MySQL Server 8.0\\data\\" | |
| "C:\\Program Files\\MySQL\MySQL Server 8.0\\bin\\mysqld" --console --initialize --initialize-insecure | |
| "C:\\Program Files\\MySQL\MySQL Server 8.0\\bin\\mysqld" --console & | |
| # Wait until the server actually accepts connections instead of a fixed | |
| # sleep, which races a slow startup on the Windows runner. | |
| for i in $(seq 1 60); do | |
| if "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqladmin" ping -u root --silent >/dev/null 2>&1; then | |
| break | |
| fi | |
| echo "Waiting for MySQL to accept connections ($i)..." | |
| sleep 2 | |
| done | |
| "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqladmin" ping -u root --silent >/dev/null 2>&1 || { echo "MySQL did not become ready in time"; exit 1; } | |
| "C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysql" -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -u root | |
| # remove doxygen because mysqlclient build otherwise breaks? | |
| rm "C:/Strawberry/c/bin/doxygen.exe" | |
| echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV | |
| echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV | |
| echo "MYSQL_DATABASE_URL=mysql://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=C:\Program Files\MySQL\MySQL Server 8.0\lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=8.0.40" >> $GITHUB_ENV | |
| echo "C:\Program Files\MySQL\MySQL Server 8.0\lib" >> $GITHUB_PATH | |
| echo "C:\Program Files\MySQL\MySQL Server 8.0\bin" >> $GITHUB_PATH | |
| dir "C:\Program Files\MySQL\MySQL Server 8.0\lib" | |
| - name: Install mariadb (Windows) | |
| if: runner.os == 'Windows' && matrix.backend == 'mariadb' | |
| shell: bash | |
| run: | | |
| choco install mariadb --version=12.3.2 -y | |
| "C:\\Program Files\\MariaDB 12.3\\bin\\mariadb" -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'root'@'localhost';" -u root | |
| echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV | |
| echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV | |
| echo "MARIADB_DATABASE_URL=mariadb://root@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MARIADB_EXAMPLE_DATABASE_URL=mariadb://root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MARIADB_UNIT_TEST_DATABASE_URL=mariadb://root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIB_DIR=C:\Program Files\MariaDB 12.3\lib" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_LIBNAME=libmariadb" >> $GITHUB_ENV | |
| echo "MYSQLCLIENT_VERSION=3.4.9" >> $GITHUB_ENV | |
| echo "C:\Program Files\MariaDB 12.3\lib" >> $GITHUB_PATH | |
| echo "C:\Program Files\MariaDB 12.3\bin" >> $GITHUB_PATH | |
| dir "C:\Program Files\MariaDB 12.3\lib" | |
| - name: Rust version check | |
| shell: bash | |
| env: | |
| RUST: ${{ matrix.rust }} | |
| run: | | |
| rustup override set $RUST | |
| rustup component add rustfmt llvm-tools-preview | |
| cargo --version | |
| rustc --version | |
| - uses: taiki-e/install-action@26e9283f268b880168bdbd2c545dfcd60ec2c6ab # v2.87.13 | |
| with: | |
| tool: cargo-llvm-cov,nextest | |
| - name: Add Flags (nightly) | |
| if: matrix.rust == 'nightly' | |
| shell: bash | |
| run: | | |
| echo FLAGS="-F diesel/i-implement-a-third-party-backend-and-opt-into-breaking-changes -F diesel/unstable -F diesel/without-deprecated" >> $GITHUB_ENV | |
| # Recording doctest coverage is a nightly only feature. | |
| echo COV_DOCTESTS="--doctests" >> $GITHUB_ENV | |
| # Persisted doctest binaries otherwise keep several GB of debuginfo. | |
| echo RUSTDOCFLAGS="$RUSTDOCFLAGS -C strip=debuginfo" >> $GITHUB_ENV | |
| - name: Add Flags (beta + Sqlite) | |
| if: matrix.rust == 'beta' && matrix.backend == 'sqlite' | |
| shell: bash | |
| run: | | |
| echo FLAGS="-F diesel/returning_clauses_for_sqlite_3_35 -F libsqlite3-sys/bundled" >> $GITHUB_ENV | |
| - name: Add Flags (beta) | |
| if: matrix.rust == 'beta' | |
| shell: bash | |
| run: | | |
| echo FLAGS="${FLAGS} -F diesel/time -F diesel/chrono -F diesel/numeric -F diesel/extras -F diesel_derives/time -F diesel_derives/chrono -F diesel_derives/numeric" | |
| - name: Add Flags (stable) | |
| if: matrix.rust == 'stable' | |
| shell: bash | |
| run: | | |
| echo FLAGS="-F diesel/with-deprecated" >> $GITHUB_ENV | |
| - name: Skip Doc tests for windows/macos | |
| if: runner.os != 'Linux' | |
| shell: bash | |
| run: | | |
| echo NO_DOC_TESTS="--no-doc-tests" >> $GITHUB_ENV | |
| - name: Enable example schema checks on linux | |
| if: runner.os != 'Linux' | |
| shell: bash | |
| run: | | |
| echo EXAMPLE_SCHEMA_CHECKS="--no-example-schema-check" >> $GITHUB_ENV | |
| - name: Run tests | |
| shell: bash | |
| env: | |
| BACKEND: ${{ matrix.backend }} | |
| run: | | |
| # The wrapper instruments the nested cargo invocations xtask spawns. | |
| if [ "$GITHUB_EVENT_NAME" != "merge_group" ]; then | |
| cargo llvm-cov show-env --sh $COV_DOCTESTS > "$RUNNER_TEMP/llvm-cov.env" | |
| source "$RUNNER_TEMP/llvm-cov.env" | |
| cargo llvm-cov clean --workspace | |
| fi | |
| cargo xtask run-tests $BACKEND $NO_DOC_TESTS $EXAMPLE_SCHEMA_CHECKS -- --no-fail-fast $FLAGS | |
| if [ "$GITHUB_EVENT_NAME" != "merge_group" ]; then | |
| cargo llvm-cov report --codecov --output-path codecov.json --ignore-filename-regex 'xtask|doctest_setup\.rs' --failure-mode all $COV_DOCTESTS | |
| fi | |
| - name: Upload coverage | |
| if: github.event_name != 'merge_group' | |
| uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 | |
| with: | |
| files: codecov.json | |
| disable_search: true | |
| flags: ${{ matrix.backend }} | |
| plugins: noop | |
| name: ${{ matrix.os }}-${{ matrix.backend }}-${{ matrix.rust }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Run diesel_benches | |
| if: runner.os == 'Linux' | |
| env: | |
| RUST: ${{ matrix.rust }} | |
| BACKEND: ${{ matrix.backend }} | |
| shell: bash | |
| run: cargo +$RUST test --manifest-path diesel_bench/Cargo.toml --no-default-features --features "$BACKEND" --bench benchmarks | |
| compile_tests: | |
| name: Compiletests | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: compile_test-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 -y install libsqlite3-dev libpq-dev libmysqlclient-dev | |
| - name: Run compile tests | |
| shell: bash | |
| run: | | |
| rustc +stable --version | |
| cargo +stable 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| rustup component add clippy | |
| rustup component add rustfmt | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Fixing up rustup | |
| shell: bash | |
| run: | | |
| rustc --version | |
| rustup component add rustfmt clippy | |
| which rustc | |
| rustup component list | |
| cargo fmt --version | |
| cargo clippy --version | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 -y install libsqlite3-dev libpq-dev libmysqlclient-dev libtirpc-dev | |
| - uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787 # v2.64.2 | |
| with: | |
| tool: typos | |
| - name: Set environment variables | |
| shell: bash | |
| run: | | |
| echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV | |
| echo "RUSTDOCFLAGS=-D warnings" >> $GITHUB_ENV | |
| - name: Run clippy + rustfmt | |
| run: cargo xtask tidy --keep-going | |
| sqlite_wasm: | |
| name: Check sqlite wasm | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| rustup component add rust-src | |
| rustup component add rustfmt | |
| rustup target add wasm32-unknown-unknown | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: sqlite_wasm-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787 # v2.64.2 | |
| with: | |
| # Keep in sync with wasm-bindgen-test in diesel/Cargo.toml. | |
| tool: wasm-bindgen@0.2.128 | |
| - name: Test unit and integration tests | |
| env: | |
| DATABASE_URL: ":memory:" | |
| run: cargo xtask run-tests --wasm sqlite --no-example-schema-check -- --no-fail-fast | |
| - name: Test the wasm example | |
| env: | |
| CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner | |
| run: cd examples/sqlite/wasm && cargo test --target wasm32-unknown-unknown | |
| sqlite_bundled: | |
| name: Check sqlite bundled + Sqlite with asan | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| rustup component add rust-src | |
| rustup component add rustfmt | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: sqlite_bundled-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Test diesel-cli | |
| run: cargo +stable test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "sqlite-bundled" | |
| - name: Run diesel_tests with ASAN enabled | |
| env: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTFLAGS: -Zsanitizer=address | |
| ASAN_OPTIONS: detect_stack_use_after_return=1 | |
| run: cargo +stable -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: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTDOCFLAGS: -Zsanitizer=address | |
| RUSTFLAGS: -Zsanitizer=address | |
| ASAN_OPTIONS: detect_stack_use_after_return=1 | |
| run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "sqlite extras __with_asan_tests" --target x86_64-unknown-linux-gnu | |
| postgres_bundled: | |
| name: Check postgres bundled + Postgres with asan | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| rustup component add rust-src | |
| rustup component add rustfmt | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: postgres_bundled-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Install postgres (Linux) | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 install -y libpq-dev postgresql valgrind | |
| 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_DATABASE_URL | |
| - name: Test diesel-cli | |
| run: cargo +stable test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "postgres-bundled" | |
| - name: Run diesel_tests with ASAN enabled | |
| env: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTFLAGS: -Zsanitizer=address | |
| ASAN_OPTIONS: detect_stack_use_after_return=1 | |
| run: cargo +stable -Z build-std test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "postgres pq-sys pq-sys/bundled pq-src/with-asan" --target x86_64-unknown-linux-gnu | |
| - name: Run diesel tests with ASAN enabled | |
| env: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTDOCFLAGS: -Zsanitizer=address | |
| RUSTFLAGS: -Zsanitizer=address | |
| ASAN_OPTIONS: detect_stack_use_after_return=1 | |
| run: cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "postgres extras __with_asan_tests" --target x86_64-unknown-linux-gnu | |
| mysql_bundled: | |
| name: Check mysql bundled + Mysql with asan | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| rustup component add rust-src | |
| rustup component add rustfmt | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: mysql_bundled-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Install Mysql (Linux) | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 -y install libmysqlclient-dev llvm libtirpc-dev | |
| sudo systemctl start mysql.service | |
| sleep 5 | |
| 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@127.0.0.1/diesel_test" >> $GITHUB_ENV | |
| echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_example" >> $GITHUB_ENV | |
| echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@127.0.0.1/diesel_unit_test" >> $GITHUB_ENV | |
| - name: Test diesel-cli | |
| env: | |
| RUST_TEST_THREADS: 1 | |
| run: cargo +stable test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "mysql-bundled" | |
| - name: Run diesel_tests with ASAN enabled | |
| env: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTFLAGS: -Zsanitizer=address | |
| RUST_TEST_THREADS: 1 | |
| ASAN_OPTIONS: symbolize=1,detect_stack_use_after_return=1 | |
| ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer | |
| LSAN_OPTIONS: suppressions=/tmp/suppr.txt | |
| run: | | |
| echo "leak:mysql_server_init" > /tmp/suppr.txt | |
| cargo +stable -Z build-std test --manifest-path diesel_tests/Cargo.toml --no-default-features --features "mysql mysqlclient-sys mysqlclient-sys/bundled mysqlclient-src/with-asan" --target x86_64-unknown-linux-gnu | |
| - name: Run diesel tests with ASAN enabled | |
| env: | |
| RUSTC_BOOTSTRAP: 1 | |
| RUSTDOCFLAGS: -Zsanitizer=address | |
| RUSTFLAGS: -Zsanitizer=address | |
| RUST_TEST_THREADS: 1 | |
| ASAN_OPTIONS: symbolize=1,detect_stack_use_after_return=1 | |
| ASAN_SYMBOLIZER_PATH: /usr/bin/llvm-symbolizer | |
| LSAN_OPTIONS: suppressions=/tmp/suppr.txt | |
| run: | | |
| echo "leak:mysql_server_init" > /tmp/suppr.txt | |
| cargo +stable -Z build-std test --manifest-path diesel/Cargo.toml --no-default-features --features "mysql extras __with_asan_tests" --target x86_64-unknown-linux-gnu | |
| minimal_rust_version: | |
| name: Check Minimal supported rust version (1.88.0) | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup install 1.88.0 | |
| rustup install nightly | |
| - uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787 # v2.64.2 | |
| with: | |
| tool: cargo-hack,cargo-minimal-versions | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@f51f967e158417aafa338a1e46ab22095f07aa01 # v2.8.2 | |
| with: | |
| key: minimal_rust_version-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -o DPkg::Lock::Timeout=300 update | |
| sudo apt-get -o DPkg::Lock::Timeout=300 -y install libsqlite3-dev libpq-dev libmysqlclient-dev | |
| - name: Check diesel_derives | |
| run: cargo +1.88.0 minimal-versions check -p diesel_derives --features "postgres sqlite mysql mariadb 32-column-tables 64-column-tables 128-column-tables without-deprecated with-deprecated r2d2" | |
| - name: Check diesel | |
| run: cargo +1.88.0 minimal-versions check -p diesel --features "postgres mysql mariadb sqlite extras" | |
| - name: Check diesel_dynamic_schema | |
| run: cargo +1.88.0 minimal-versions check -p diesel-dynamic-schema --all-features | |
| - name: Check diesel_migrations | |
| run: cargo +1.88.0 minimal-versions check -p diesel_migrations --all-features | |
| - name: Check diesel_cli | |
| run: cargo +1.88.0 minimal-versions check -p diesel_cli --features "default sqlite-bundled" | |
| Semver-Checks: | |
| name: Run Cargo Semver-Checks | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| rustup update stable | |
| rustup override set stable | |
| - uses: taiki-e/install-action@60581cd7025e0e855cebd745379013e286d9c787 # v2.64.2 | |
| with: | |
| tool: cargo-semver-checks | |
| - name: Run cargo semver-checks | |
| run: | | |
| cargo xtask semver-checks | |
| Sqlite-no-std: | |
| name: Sqlite (no-std) | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| cd examples/sqlite/embedded | |
| rustup override set stable | |
| rustup target add riscv32imac-unknown-none-elf | |
| - name: Install cross compiler | |
| run: | | |
| curl -L https://github.com/nycu-arclab/riscv32-toolchain/releases/download/v14.2.0/riscv32-unknown-elf-gcc-14.2.0-linux.tar.gz -o riscv32-toolchain-linux.tar.gz | |
| tar -xzvf riscv32-toolchain-linux.tar.gz -C /opt | |
| - name: Check if diesel builds for no-std targets | |
| run: | | |
| cd examples/sqlite/embedded | |
| rustup target add riscv32imac-unknown-none-elf | |
| LIBSQLITE3_FLAGS="-DSQLITE_SMALL_STACK=1 -DSQLITE_THREADSAFE=0 -DSQLITE_OS_OTHER=1 -DSQLITE_OMIT_LOCALTIME=1 -USQLITE_ENABLE_FTS3 -UQLITE_ENABLE_DBSTAT_VTAB -UDSQLITE_ENABLE_JSON1 -USQLITE_ENABLE_FTS5 -USQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_MEMSYS3=1" TARGET_CC=/opt/riscv/bin/riscv32-unknown-elf-gcc cargo build --target riscv32imac-unknown-none-elf | |
| Miri: | |
| name: Miri Tests | |
| runs-on: ubuntu-latest | |
| needs: [rustfmt_and_clippy] | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup rust toolchain | |
| run: | | |
| cd diesel | |
| rustup override set nightly | |
| rustup component add miri | |
| - name: Run miri tests for default target | |
| run: | | |
| cargo +nightly miri test -p diesel -F postgres check_as_ref_ | |
| cargo +nightly miri test -p diesel -F sqlite -F serde_json sqlite::types::json::tests:: | |
| - name: Run miri tests for big-endian target | |
| run: | | |
| cargo +nightly miri test -p diesel -F postgres check_as_ref_ --target s390x-unknown-linux-gnu |