Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix/auto_type_defs
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Mar 8, 2024
2 parents dad1557 + e5fc2a8 commit 2636d27
Show file tree
Hide file tree
Showing 178 changed files with 3,469 additions and 695 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
- uses: actions/checkout@v4
- uses: actions-rust-lang/audit@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
88 changes: 0 additions & 88 deletions .github/workflows/benches.yml

This file was deleted.

113 changes: 80 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,21 @@ concurrency:
jobs:
check_and_test:
name: Check
needs: [sqlite_bundled, rustfmt_and_clippy]
needs: [sqlite_bundled, rustfmt_and_clippy, postgres_bundled]
strategy:
fail-fast: false
matrix:
rust: ["stable", "beta", "nightly"]
backend: ["postgres", "sqlite", "mysql"]
os: [ubuntu-latest, macos-latest, windows-2019]
os: [ubuntu-latest, macos-latest, macos-14, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache cargo registry
uses: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Set environment variables
Expand Down Expand Up @@ -121,14 +118,23 @@ jobs:
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'
if: matrix.os == 'macos-latest' && 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 postgres (MacOS M1)
if: matrix.os == 'macos-14' && matrix.backend == 'postgres'
run: |
brew install postgresql
brew services start postgresql@14
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'
Expand All @@ -137,7 +143,7 @@ jobs:
echo "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
- name: Install mysql (MacOS)
if: runner.os == 'macOS' && matrix.backend == 'mysql'
if: matrix.os == 'macos-latest' && matrix.backend == 'mysql'
run: |
brew install [email protected]
/usr/local/opt/[email protected]/bin/mysql_install_db
Expand All @@ -149,6 +155,20 @@ jobs:
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://runner@localhost/diesel_unit_test" >> $GITHUB_ENV
echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/[email protected]/lib" >> $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/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=/opt/homebrew/opt/[email protected]/lib" >> $GITHUB_ENV
- name: Install sqlite (Windows)
if: runner.os == 'Windows' && matrix.backend == 'sqlite'
shell: cmd
Expand Down Expand Up @@ -240,7 +260,7 @@ jobs:
env:
BACKEND: ${{ matrix.backend }}
run: |
(cd examples/${{ matrix.backend }} && rustup run ${{ matrix.rust }} bash test_all)
(cd examples/${{ matrix.backend }} && rustup run ${{ matrix.rust }} bash test_all)
- name: Test migrations-internals
shell: bash
Expand Down Expand Up @@ -300,16 +320,13 @@ jobs:
name: Compiletests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-09-21
- name: Cache cargo registry
uses: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: compile_test-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Install dependencies
Expand All @@ -325,16 +342,13 @@ jobs:
name: Check rustfmt style && run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry
uses: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Install dependencies
Expand Down Expand Up @@ -405,16 +419,14 @@ jobs:
name: Check sqlite bundled + Sqlite with asan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: "rust-src"
- name: Cache cargo registry
uses: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: sqlite_bundled-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Test diesel-cli
Expand All @@ -432,22 +444,57 @@ jobs:
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
postgres_bundled:
name: Check postgres bundled + Postgres 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: 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 +nightly test --manifest-path diesel_cli/Cargo.toml --no-default-features --features "postgres-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 "postgres pq-sys pq-sys/bundled pq-src/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 "postgres pq-sys pq-sys/bundled pq-src/with-asan" --target x86_64-unknown-linux-gnu

minimal_rust_version:
name: Check Minimal supported rust version (1.70.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: minimal_rust_version-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Install dependencies
run: |
Expand All @@ -462,7 +509,7 @@ jobs:
- name: Check diesel_migrations
run: cargo +1.70.0 minimal-versions check -p diesel_migrations --all-features
- name: Check diesel_cli
run: cargo +1.70.0 minimal-versions check -p diesel_cli --all-features
run: cargo +1.70.0 minimal-versions check -p diesel_cli --features "default sqlite-bundled"

typos:
name: Spell Check with Typos
Expand All @@ -471,7 +518,7 @@ jobs:

steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check the spelling of the files in our repo
uses: crate-ci/typos@master
9 changes: 3 additions & 6 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Cache cargo registry
uses: actions/cache@v3
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-doc-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Get the branch name
id: current_branch
Expand All @@ -41,7 +38,7 @@ jobs:

- name: Publish documentation
if: success()
uses: JamesIves/github-pages-deploy-action@v4.2.5
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
Expand Down
Loading

0 comments on commit 2636d27

Please sign in to comment.