Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed Mar 1, 2024
1 parent fbc3893 commit 381f79c
Showing 1 changed file with 44 additions and 31 deletions.
75 changes: 44 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,52 +18,59 @@ 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
- run: cd refinery_cli && cargo test

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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 381f79c

Please sign in to comment.