Skip to content

Commit

Permalink
Merge pull request #39 from sgrif/feature/bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed May 10, 2024
2 parents e865208 + 921e9a1 commit f4a0d53
Show file tree
Hide file tree
Showing 12 changed files with 12,739 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-14, windows-2022]
features: [default, buildtime_bindgen]
features: [default, buildtime_bindgen, bundled]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand Down Expand Up @@ -74,6 +74,7 @@ jobs:
echo "BINDGEN_EXTRA_CLANG_ARGS=-I/opt/homebrew/opt/mariadb@10.5/include" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=10.5" >> $GITHUB_ENV
ls /opt/homebrew/opt/mariadb@10.5/include/mysql
- name: Install mysql (Windows)
if: runner.os == 'Windows' && matrix.features != 'bundled'
shell: cmd
Expand All @@ -82,19 +83,24 @@ jobs:
unzip library.zip
- name: Set variables for mysql (Windows)
if: runner.os == 'Windows' && matrix.bundled != 'bundled'
if: runner.os == 'Windows' && matrix.features != 'bundled'
shell: bash
run: |
echo "MYSQLCLIENT_LIB_DIR=${{github.workspace}}/mysql-8.3.0-winx64/lib/" >> $GITHUB_ENV
echo "MYSQLCLIENT_VERSION=8.3.0" >> $GITHUB_ENV
echo "C:\tools\mysql\current\lib" >> $GITHUB_PATH
echo "C:\tools\mysql\current\bin" >> $GITHUB_PATH
echo "BINDGEN_EXTRA_CLANG_ARGS=-I./include" >> $GITHUB_ENV
mkdir include
cp ./mysql-8.3.0-winx64/include include/mysql -r
dir ./include/mysql
dir ./mysql-8.3.0-winx64/lib
- name: Windows setup (bundled)
if: runner.os == 'Windows' && matrix.features == 'bundled'
shell: bash
run: |
echo "OPENSSL_RUST_USE_NASM=0" >> $GITHUB_ENV
echo OPENSSL_SRC_PERL=C:/Strawberry/perl/bin/perl >> $GITHUB_ENV
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable

Expand Down Expand Up @@ -122,3 +128,12 @@ jobs:
echo "use diesel::prelude::*;" > src/main.rs
echo "fn main() { MysqlConnection::establish(\"foo\").unwrap(); }" >> src/main.rs
cargo build --features "mysqlclient-sys/${{ matrix.features }}"
- name: Test all files included
shell: bash
if: matrix.features == 'bundled'
run: |
rm -rf test_diesel
git reset --hard HEAD
cd mysqlclient-src
cargo publish --dry-run
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "mysqlclient-src/source"]
path = mysqlclient-src/source
url = https://github.com/weiznich/mysql-server/
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ edition = "2021"
pkg-config = "0.3.9"
bindgen = { version = "0.69.4", optional = true }

[dependencies]
mysqlclient-src = { path = "mysqlclient-src", optional = true }

[target.'cfg(target_env = "msvc")'.build-dependencies]
vcpkg = "0.2.4"

[features]
default = []
buildtime_bindgen = ["dep:bindgen"]
bundled = ["dep:mysqlclient-src"]

[workspace]
members = ["mysqlclient-src"]

0 comments on commit f4a0d53

Please sign in to comment.