From 77fbe3dd9e962ef863171f19624d212eca012557 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Fri, 3 Jan 2020 18:01:52 -0800 Subject: [PATCH] Try a different health check for MariaDB --- .github/workflows/mariadb.yml | 2 +- .github/workflows/mysql.yml | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mysql.yml diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml index bd208d8c5..a9dc5c027 100644 --- a/.github/workflows/mariadb.yml +++ b/.github/workflows/mariadb.yml @@ -21,7 +21,7 @@ jobs: # will assign a random free host port - 3306/tcp # needed because the container does not provide a healthcheck - options: --health-cmd "mysql --user=root --password=$MYSQL_PASSWORD -e 'show databases;'" --health-interval 30s --health-timeout 30s --health-retries 10 + options: --health-cmd "mysqladmin ping --silent" --health-interval 30s --health-timeout 30s --health-retries 10 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml new file mode 100644 index 000000000..8e54dff85 --- /dev/null +++ b/.github/workflows/mysql.yml @@ -0,0 +1,55 @@ +name: MySQL + +on: [push] + +jobs: + test: + + 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 + + steps: + - uses: actions/checkout@v1 + + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-mysql-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-mysql-cargo-index-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-mysql-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + - name: Setup rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - run: cargo test -p sqlx --no-default-features --features 'mysql macros chrono' + env: + DATABASE_URL: mysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/sqlx