diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml new file mode 100644 index 00000000..bd76cdee --- /dev/null +++ b/.github/workflows/mariadb.yml @@ -0,0 +1,55 @@ +name: MariaDB + +on: [push] + +jobs: + test: + + runs-on: ubuntu-latest + + strategy: + matrix: + mariadb: [10.1.43, 10.4.11] + + services: + mariadb: + image: mariadb:${{ matrix.mariadb }} + env: + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: sqlx + ports: + # will assign a random free host port + - 3309/tcp + # needed because the container does not provide a healthcheck + options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5 + + 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: mariadb://root:password@localhost:${{ job.services.mariadb.ports[3309] }}/sqlx diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml new file mode 100644 index 00000000..a8f9a0a6 --- /dev/null +++ b/.github/workflows/postgres.yml @@ -0,0 +1,56 @@ +name: Postgres + +on: [push] + +jobs: + test: + + runs-on: ubuntu-latest + + strategy: + matrix: + postgres: [9.4.25, 10.11, 12.1] + + services: + postgres: + image: postgres:${{ matrix.postgres }} + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + # will assign a random free host port + - 5432/tcp + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v1 + + - name: Setup rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-postgres-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-postgres-cargo-index-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-postgres-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + + - run: cargo test -p sqlx --no-default-features --features 'postgres macros uuid chrono' + env: + DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8c9175b9..458072c9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,11 +10,12 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Setup rust - uses: actions-rs/toolchain@v1 + - name: Cache rust + id: cache_rust + uses: actions/cache@v1 with: - toolchain: stable - override: true + path: ~/.rustup/toolchains + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo registry uses: actions/cache@v1 @@ -34,6 +35,13 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Setup rust + uses: actions-rs/toolchain@v1 + if: steps.cache_rust.outputs.cache-hit != 'true' + with: + toolchain: stable + override: true + - run: cargo check --all-features - run: cargo test -p sqlx-core --all-features