Skip to content

Commit

Permalink
Add sqlx-rustls support (#720)
Browse files Browse the repository at this point in the history
I'd like to add optional rustls support for SQLx. This PR implements the
required features, but tests using `--all-features` fail, because
runtime selection features are not additive. I didn't find a solution
apart from avoiding `--all-features`.

---------

Co-authored-by: Yuri Astrakhan <[email protected]>
  • Loading branch information
pka and nyurik authored Jul 3, 2023
1 parent 8e7bba3 commit aabcb0a
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: [maplibre]
github: [ maplibre ]
open_collective: maplibre
76 changes: 38 additions & 38 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: actix
versions:
- 0.11.0
- 0.11.1
- dependency-name: docopt
versions:
- 1.1.1
- dependency-name: actix-rt
versions:
- 2.0.0
- 2.0.2
- 2.1.0
- 2.2.0
- dependency-name: postgres
versions:
- 0.19.1
- dependency-name: serde
versions:
- 1.0.124
- 1.0.125
- dependency-name: env_logger
versions:
- 0.8.3
- dependency-name: criterion
versions:
- 0.3.4
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: actix
versions:
- 0.11.0
- 0.11.1
- dependency-name: docopt
versions:
- 1.1.1
- dependency-name: actix-rt
versions:
- 2.0.0
- 2.0.2
- 2.1.0
- 2.2.0
- dependency-name: postgres
versions:
- 0.19.1
- dependency-name: serde
versions:
- 1.0.124
- 1.0.125
- dependency-name: env_logger
versions:
- 0.8.3
- dependency-name: criterion
versions:
- 0.3.4
4 changes: 2 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Benchmark

on:
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
push:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
mdbook-version: 'latest'

- run: mdbook build docs

Expand Down
114 changes: 62 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ name: CI

on:
push:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
pull_request:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
release:
types: [published]
types: [ published ]
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -48,8 +48,15 @@ jobs:
if: matrix.target == 'x86_64-unknown-linux-gnu'
shell: bash
run: |
set -x
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo clippy --package martin-tile-utils -- -D warnings
cargo clippy --package martin-mbtiles -- -D warnings
cargo clippy --package martin-mbtiles --no-default-features --features native-tls -- -D warnings
cargo clippy --package martin-mbtiles --no-default-features --features rustls -- -D warnings
cargo clippy --package martin -- -D warnings
cargo clippy --package martin --features vendored-openssl -- -D warnings
cargo clippy --package martin --features bless-tests -- -D warnings
- name: Install OpenSSL (Windows)
if: runner.os == 'Windows'
run: |
Expand Down Expand Up @@ -84,7 +91,7 @@ jobs:
test:
# Don't change this name - it is used by the merge protection rules
name: Test & package ${{ matrix.target }}
needs: [build]
needs: [ build ]
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -136,8 +143,11 @@ jobs:
if: matrix.target == 'x86_64-unknown-linux-gnu'
shell: bash
run: |
cargo test --all-targets
cargo test --all-targets --all-features
set -x
cargo test --package martin-tile-utils
cargo test --package martin-mbtiles
cargo test --package martin-mbtiles --no-default-features --features rustls
cargo test --package martin --features vendored-openssl
cargo test --doc
rm -rf target
env:
Expand Down Expand Up @@ -203,7 +213,7 @@ jobs:
test-legacy:
# Don't change this name - it is used by the merge protection rules
name: Test Legacy DB
needs: [build]
needs: [ build ]
runs-on: ubuntu-latest
strategy:
fail-fast: true
Expand Down Expand Up @@ -249,47 +259,47 @@ jobs:
${{ matrix.image }}
-c "exec docker-entrypoint.sh ${{ matrix.args }}"
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup database
run: |
# sudo apt-get install postgresql-client
tests/fixtures/initdb.sh
env:
PGPORT: ${{ job.services.postgres.ports[5432] }}
- name: Unit Tests (Linux)
shell: bash
run: |
echo "Running unit tests, connecting to DATABASE_URL=$DATABASE_URL"
echo "Same but as base64 to prevent GitHub obfuscation (this is not a secret):"
echo "$DATABASE_URL" | base64
if [[ "${{ matrix.sslmode }}" == "disable" ]]; then
# This only works if SSL is not required
cargo test --all-targets
fi
cargo test --all-targets --all-features
cargo test --doc
rm -rf target
env:
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
- name: Save test output on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-output
path: tests/output/*
retention-days: 5
- uses: actions/download-artifact@v3
with:
name: build-x86_64-unknown-linux-gnu
path: target/
- name: Integration Tests
run: |
chmod +x target/martin target/mbtiles
tests/test.sh
env:
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
MARTIN_BUILD: "-"
MARTIN_BIN: target/martin
MBTILES_BUILD: "-"
MBTILES_BIN: target/mbtiles
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup database
run: |
# sudo apt-get install postgresql-client
tests/fixtures/initdb.sh
env:
PGPORT: ${{ job.services.postgres.ports[5432] }}
- name: Unit Tests (Linux)
shell: bash
run: |
echo "Running unit tests, connecting to DATABASE_URL=$DATABASE_URL"
echo "Same but as base64 to prevent GitHub obfuscation (this is not a secret):"
echo "$DATABASE_URL" | base64
set -x
cargo test --package martin-tile-utils
cargo test --package martin-mbtiles
cargo test --package martin-mbtiles --no-default-features --features rustls
cargo test --package martin --features vendored-openssl
cargo test --doc
rm -rf target
env:
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
- name: Save test output on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-output
path: tests/output/*
retention-days: 5
- uses: actions/download-artifact@v3
with:
name: build-x86_64-unknown-linux-gnu
path: target/
- name: Integration Tests
run: |
chmod +x target/martin target/mbtiles
tests/test.sh
env:
DATABASE_URL: postgres://${{ env.PGUSER }}:${{ env.PGUSER }}@${{ env.PGHOST }}:${{ job.services.postgres.ports[5432] }}/${{ env.PGDATABASE }}?sslmode=${{ matrix.sslmode }}
MARTIN_BUILD: "-"
MARTIN_BIN: target/martin
MBTILES_BUILD: "-"
MBTILES_BIN: target/mbtiles
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ name: Docker

on:
push:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
pull_request:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
release:
types: [published]
types: [ published ]
workflow_dispatch:

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/grcov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Code coverage

on:
push:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
- 'docs/**'
- 'homebrew-formula/**'
pull_request:
branches: [main]
branches: [ main ]
paths-ignore:
- '**.md'
- 'demo/**'
Expand Down Expand Up @@ -74,6 +74,6 @@ jobs:

- name: Check conditional cfg values
run: |
cargo +nightly check -Z unstable-options -Z check-cfg=features,names,values,output --workspace --all-features
cargo +nightly check -Z unstable-options -Z check-cfg=features,names,values,output --workspace
env:
RUSTFLAGS: '-D warnings'
Loading

0 comments on commit aabcb0a

Please sign in to comment.