mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
name: MySQL
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
mysql:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
mysql: [5.7.28, 8.0.18]
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:${{ matrix.mysql }}
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: password
|
|
MYSQL_DATABASE: sqlx
|
|
ports:
|
|
# will assign a random free host port
|
|
- 3306/tcp
|
|
# needed because the container does not provide a healthcheck
|
|
options: >-
|
|
--health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s
|
|
--health-retries 10 -v /data/mysql:/var/lib/mysql
|
|
|
|
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
if: steps.cache_rust.outputs.cache-hit != 'true'
|
|
with:
|
|
toolchain: stable
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Cache target/
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: target
|
|
key: ${{ runner.os }}-cargo-build-target-mysql-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# -----------------------------------------------------
|
|
|
|
- run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono tls'
|
|
env:
|
|
# pass the path to the CA that the MySQL service generated
|
|
# Github Actions' YML parser doesn't handle multiline strings correctly
|
|
DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx?ssl-mode=VERIFY_CA&ssl-ca=%2Fdata%2Fmysql%2Fca.pem
|
|
|
|
# Rust ------------------------------------------------
|
|
|
|
- name: Prepare build directory for cache
|
|
run: |
|
|
find ./target/debug -maxdepth 1 -type f -delete \
|
|
&& rm -fr ./target/debug/{deps,.fingerprint}/*sqlx* \
|
|
&& rm -f ./target/.rustc_info.json
|
|
|
|
# -----------------------------------------------------
|