diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ecbf26d..3c26e509 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,8 @@ jobs: name: CI is green runs-on: ubuntu-latest needs: - - cargo-fmt-clippy-and-test-macros-and-cli + - cargo-fmt-clippy + - test-macros-and-cli - test-sqlite - test-postgres - test-tokio-postgres @@ -17,41 +18,47 @@ jobs: steps: - run: exit 0 - setup-matrix: + set-rust-versions: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.setup-matrix.outputs.matrix }} + versions: ${{ steps.set-versions.outputs.versions }} steps: - name: checkout repo uses: actions/checkout@v2 - - id: get-msrv + - id: set-versions run: | MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' ./refinery/Cargo.toml) - echo "MSRV=$MSRV" >> $GITHUB_ENV - - id: setup-matrix - uses: druzsan/setup-matrix@v2 - with: - # Use | to preserve valid YAML syntax - matrix: | - rust: [stable, nightly, ${{ env.MSRV }}] - os: [windows-latest, ubuntu-latest] + echo "versions=['stable', 'nightly', '$MSRV']" >> $GITHUB_OUTPUT - cargo-fmt-clippy-and-test-macros-and-cli: - name: Cargo fmt/clippy/test-macros-and-cli - needs: setup-matrix - strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} - runs-on: ${{ matrix.os }} + cargo-fmt-clippy: + name: Cargo fmt and clippy + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.rust }} + toolchain: beta - run: rustup self update - run: rustup component add clippy - run: rustup component add rustfmt - run: cargo fmt --all -- --check - run: cargo clippy --all-targets --all-features + + test-macros-and-cli: + name: test-macros-and-cli + needs: set-rust-versions + strategy: + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} + os: [windows-latest, ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + - run: rustup self update - run: cd refinery_core && cargo test --all-features -- --test-threads 1 - run: cd refinery && cargo build --all-features - run: cd refinery_macros && cargo test @@ -59,10 +66,11 @@ jobs: test-sqlite: name: Test Sqlite - needs: setup-matrix + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -73,10 +81,11 @@ jobs: test-postgres: name: Test postgres - needs: setup-matrix + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: postgres:9.6.13-alpine @@ -92,9 +101,10 @@ jobs: test-tokio-postgres: name: Test tokio-postgres - needs: setup-matrix + needs: set-rust-versions strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} runs-on: ubuntu-latest services: postgres: @@ -110,10 +120,11 @@ jobs: test-mysql: name: Test mysql - needs: setup-matrix + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: mysql:latest @@ -134,10 +145,11 @@ jobs: test-mysql-async: name: Test mysql-async - needs: setup-matrix + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: postgres: image: mysql:latest @@ -157,10 +169,11 @@ jobs: test-tiberius: name: Test tiberius - needs: setup-matrix + needs: set-rust-versions runs-on: ubuntu-latest strategy: - matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + matrix: + rust: ${{ fromJson(needs.set-rust-versions.outputs.versions) }} services: mssql: image: mcr.microsoft.com/mssql/server:2017-latest