Skip to content

working on json_path_exists #4647

working on json_path_exists

working on json_path_exists #4647

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, postgres_bundled, mysql_bundled]
strategy:
fail-fast: false
matrix:
rust: ["stable", "beta", "nightly"]
backend: ["postgres", "sqlite", "mysql"]
os: [ubuntu-latest, macos-13, macos-15, 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: ${{ matrix.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- 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
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: |
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
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:[email protected]/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:[email protected]/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:[email protected]/diesel_unit_test" >> $GITHUB_ENV
- name: Install postgres (MacOS)
if: matrix.os == 'macos-13' || matrix.os == 'macos-15' && matrix.backend == 'postgres'
run: |
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)
if: matrix.os == 'macos-13' && matrix.backend == 'mysql'
run: |
brew install [email protected]
/usr/local/opt/[email protected]/bin/mysql.server start
sleep 3
/usr/local/opt/[email protected]/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@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=/usr/local/opt/[email protected]/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=9.0" >> $GITHUB_ENV
- name: Install mysql (MacOS M1)
if: matrix.os == 'macos-15' && matrix.backend == 'mysql'
run: |
brew install [email protected]
ls /opt/homebrew/opt/[email protected]
/opt/homebrew/opt/[email protected]/bin/mysql.server start
sleep 3
/opt/homebrew/opt/[email protected]/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@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=/opt/homebrew/opt/[email protected]/lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=9.0" >> $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 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: 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 "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV
echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
echo "MYSQL_DATABASE_URL=mysql://[email protected]/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://[email protected]/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://[email protected]/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=C:\tools\mysql\current\lib" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=8.0.31" >> $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: |
rustup override set ${{ matrix.rust }}
cargo --version
rustc --version
- uses: taiki-e/install-action@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
- name: Add Flags (beta)
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 (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
run: |
cargo xtask run-tests ${{ matrix.backend }} $NO_DOC_TESTS $EXAMPLE_SCHEMA_CHECKS -- --no-fail-fast $FLAGS
- name: Run diesel_benches
if: runner.os == 'Linux'
shell: bash
run: cargo +${{ matrix.rust }} test --manifest-path diesel_bench/Cargo.toml --no-default-features --features "${{ matrix.backend }}" --bench benchmarks
compile_tests:
name: Compiletests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
with:
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 +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@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: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install libsqlite3-dev libpq-dev libmysqlclient-dev
- uses: taiki-e/install-action@v2
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_bundled:
name: Check sqlite bundled + Sqlite with asan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: "rust-src"
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
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
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: "rust-src"
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
with:
key: postgres_bundled-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install postgres (Linux)
run: |
sudo apt-get update
sudo apt-get 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
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: "rust-src"
- name: Cache cargo registry
uses: Swatinem/rust-cache@v2
with:
key: mysql_bundled-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install Mysql (Linux)
run: |
sudo systemctl start mysql.service
sudo apt-get update
sudo apt-get -y install libmysqlclient-dev llvm
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:[email protected]/diesel_test" >> $GITHUB_ENV
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://root:[email protected]/diesel_example" >> $GITHUB_ENV
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:[email protected]/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.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: Cache cargo registry
uses: Swatinem/rust-cache@v2
with:
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.78.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.78.0 minimal-versions check -p diesel --features "postgres mysql sqlite extras"
- name: Check diesel_dynamic_schema
run: cargo +1.78.0 minimal-versions check -p diesel-dynamic-schema --all-features
- name: Check diesel_migrations
run: cargo +1.78.0 minimal-versions check -p diesel_migrations --all-features
- name: Check diesel_cli
run: cargo +1.78.0 minimal-versions check -p diesel_cli --features "default sqlite-bundled"