[CI] use dtolnay/rust-toolchain (#1284)

* Try dtolnay/rust-toolchain

* Fixup

* Remove deprecated set-output

* Fixup

* Remove unused
This commit is contained in:
Billy Chan 2022-12-06 20:38:23 +08:00 committed by GitHub
parent 86781e1899
commit 23b6e66c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,110 +94,36 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- id: git-log - id: git-log
run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" run: echo "message=$(git log --no-merges -1 --oneline)" >> $GITHUB_OUTPUT
clippy: clippy:
name: Clippy name: Clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: stable toolchain: stable
components: clippy components: clippy
override: true - run: cargo clippy --all -- -D warnings
- run: cargo clippy --manifest-path sea-orm-cli/Cargo.toml -- -D warnings
- name: Run clippy on `sea-orm` workspace - run: cargo clippy --manifest-path sea-orm-migration/Cargo.toml -- -D warnings
uses: actions-rs/cargo@v1 - run: cargo clippy --manifest-path sea-orm-rocket/Cargo.toml -- -D warnings
with:
command: clippy
args: >
--all
--
-D warnings
- name: Run clippy on `sea-orm-cli`
uses: actions-rs/cargo@v1
with:
command: clippy
args: >
--manifest-path sea-orm-cli/Cargo.toml
--
-D warnings
- name: Run clippy on `sea-orm-migration`
uses: actions-rs/cargo@v1
with:
command: clippy
args: >
--manifest-path sea-orm-migration/Cargo.toml
--
-D warnings
- name: Run clippy on `sea-orm-rocket`
uses: actions-rs/cargo@v1
with:
command: clippy
args: >
--manifest-path sea-orm-rocket/Cargo.toml
--
-D warnings
rustfmt: rustfmt:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: nightly toolchain: nightly
components: rustfmt components: rustfmt
override: true - run: cargo fmt --all -- --check
- run: cargo fmt --manifest-path sea-orm-cli/Cargo.toml --all -- --check
- name: Run rustfmt on `sea-orm` workspace - run: cargo fmt --manifest-path sea-orm-migration/Cargo.toml --all -- --check
uses: actions-rs/cargo@v1 - run: cargo fmt --manifest-path sea-orm-rocket/Cargo.toml --all -- --check
with:
command: fmt
args: >
--all
--
--check
- name: Run rustfmt on `sea-orm-cli`
uses: actions-rs/cargo@v1
with:
command: fmt
args: >
--manifest-path sea-orm-cli/Cargo.toml
--all
--
--check
- name: Run rustfmt on `sea-orm-migration`
uses: actions-rs/cargo@v1
with:
command: fmt
args: >
--manifest-path sea-orm-migration/Cargo.toml
--all
--
--check
- name: Run rustfmt on `sea-orm-rocket`
uses: actions-rs/cargo@v1
with:
command: fmt
args: >
--manifest-path sea-orm-rocket/Cargo.toml
--all
--
--check
compile-sqlite: compile-sqlite:
name: Compile SQLite name: Compile SQLite
@ -215,13 +141,7 @@ jobs:
tls: [native-tls, rustls] tls: [native-tls, rustls]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -230,14 +150,7 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }} --no-run
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
compile-mysql: compile-mysql:
name: Compile MySQL name: Compile MySQL
@ -255,13 +168,7 @@ jobs:
tls: [native-tls, rustls] tls: [native-tls, rustls]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -270,14 +177,7 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }} --no-run
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
compile-postgres: compile-postgres:
name: Compile PostgreSQL name: Compile PostgreSQL
@ -295,13 +195,7 @@ jobs:
tls: [native-tls, rustls] tls: [native-tls, rustls]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -310,44 +204,17 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }} --no-run
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--no-run
test: test:
name: Unit Test name: Unit Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1 - run: cargo test --workspace
with: - run: cargo test --manifest-path sea-orm-rocket/Cargo.toml
profile: minimal - run: cargo test --manifest-path sea-orm-cli/Cargo.toml
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--workspace
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-rocket/Cargo.toml
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-cli/Cargo.toml
cli: cli:
name: CLI name: CLI
@ -356,28 +223,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1 - run: cargo install --path sea-orm-cli --debug
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: install
args: >
--path sea-orm-cli
--debug
examples-matrix: examples-matrix:
name: Examples Matrix name: Examples Matrix
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- id: set-matrix - id: set-matrix
run: echo "::set-output name=path_matrix::$(find examples -type f -name 'Cargo.toml' -printf '%P\0' | jq -Rc '[ split("\u0000") | .[] | "examples/\(.)" ]')" run: echo "path_matrix=$(find examples -type f -name 'Cargo.toml' -printf '%P\0' | jq -Rc '[ split("\u0000") | .[] | "examples/\(.)" ]')" >> $GITHUB_OUTPUT
outputs: outputs:
path_matrix: ${{ steps.set-matrix.outputs.path_matrix }} path_matrix: ${{ steps.set-matrix.outputs.path_matrix }}
@ -393,37 +248,15 @@ jobs:
path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }} path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
- uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: stable toolchain: stable
override: true components: rustfmt
- run: cargo fmt --manifest-path ${{ matrix.path }} --all -- --check
- name: check rustfmt - run: cargo build --manifest-path ${{ matrix.path }}
run: | - run: cargo test --manifest-path ${{ matrix.path }}
cargo fmt --manifest-path ${{ matrix.path }} --all -- --check - if: ${{ contains(matrix.path, 'core/Cargo.toml') }}
run: cargo test --manifest-path ${{ matrix.path }} --features mock
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path ${{ matrix.path }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path ${{ matrix.path }}
- name: Run mock test if it is core crate
uses: actions-rs/cargo@v1
if: ${{ contains(matrix.path, 'core/Cargo.toml') }}
with:
command: test
args: >
--manifest-path ${{ matrix.path }}
--features mock
issues-matrix: issues-matrix:
name: Issues Matrix name: Issues Matrix
@ -432,9 +265,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- id: set-matrix - id: set-matrix
run: echo "::set-output name=path_matrix::$(find issues -type f -name 'Cargo.toml' -printf '%P\0' | jq -Rc '[ split("\u0000") | .[] | "issues/\(.)" ]')" run: echo "path_matrix=$(find issues -type f -name 'Cargo.toml' -printf '%P\0' | jq -Rc '[ split("\u0000") | .[] | "issues/\(.)" ]')" >> $GITHUB_OUTPUT
outputs: outputs:
path_matrix: ${{ steps.set-matrix.outputs.path_matrix }} path_matrix: ${{ steps.set-matrix.outputs.path_matrix }}
@ -451,24 +283,9 @@ jobs:
path: ${{ fromJson(needs.issues-matrix.outputs.path_matrix) }} path: ${{ fromJson(needs.issues-matrix.outputs.path_matrix) }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1 - run: cargo build --manifest-path ${{ matrix.path }}
with: - run: cargo test --manifest-path ${{ matrix.path }}
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path ${{ matrix.path }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path ${{ matrix.path }}
sqlite: sqlite:
name: SQLite name: SQLite
@ -490,13 +307,7 @@ jobs:
tls: [native-tls, rustls] tls: [native-tls, rustls]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -505,21 +316,8 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-sqlite-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1 - run: cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
with:
command: test
args: >
--test '*'
--features default,sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-migration/Cargo.toml
--test '*'
--features sqlx-sqlite,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
mysql: mysql:
name: MySQL name: MySQL
@ -559,13 +357,7 @@ jobs:
--health-retries=3 --health-retries=3
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -574,21 +366,8 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1 - run: cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
with:
command: test
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-migration/Cargo.toml
--test '*'
--features sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
mariadb: mariadb:
name: MariaDB name: MariaDB
@ -628,13 +407,7 @@ jobs:
--health-retries=3 --health-retries=3
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -643,13 +416,7 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-mysql-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--test '*'
--features default,sqlx-mysql,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
postgres: postgres:
name: Postgres name: Postgres
@ -686,13 +453,7 @@ jobs:
--health-retries 5 --health-retries 5
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: | path: |
@ -701,18 +462,5 @@ jobs:
Cargo.lock Cargo.lock
target target
key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }} key: ${{ github.sha }}-${{ github.run_id }}-${{ runner.os }}-postgres-${{ matrix.runtime }}-${{ matrix.tls }}
- run: cargo test --test '*' --features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1 - run: cargo test --manifest-path sea-orm-migration/Cargo.toml --test '*' --features sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
with:
command: test
args: >
--test '*'
--features default,sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path sea-orm-migration/Cargo.toml
--test '*'
--features sqlx-postgres,runtime-${{ matrix.runtime }}-${{ matrix.tls }}