[CI] Compile & test each examples on a single instance (#1767)

* Try

* Try

* Ignore examples root folder

* Try

* Try

* Try

* Try

* Try

* Try
This commit is contained in:
Billy Chan 2023-07-20 21:46:52 +08:00 committed by GitHub
parent 09c416744f
commit c64a46a683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- id: set-matrix - id: set-matrix
run: echo "path_matrix=$(find examples -type f -name 'Cargo.toml' -printf '%P\0' | jq -Rc '[ split("\u0000") | .[] | "examples/\(.)" ]')" >> $GITHUB_OUTPUT run: echo "path_matrix=$(find examples -mindepth 1 -maxdepth 1 -type d -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 }}
@ -239,10 +239,8 @@ jobs:
name: Examples name: Examples
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: examples-matrix needs: examples-matrix
timeout-minutes: 15
strategy: strategy:
fail-fast: false fail-fast: false
max-parallel: 12
matrix: matrix:
path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }} path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }}
steps: steps:
@ -251,11 +249,10 @@ jobs:
with: with:
toolchain: stable toolchain: stable
components: rustfmt components: rustfmt
- run: cargo fmt --manifest-path ${{ matrix.path }} -- --check - run: find ${{ matrix.path }} -type f -name 'Cargo.toml' -printf '\ncargo fmt --manifest-path %p -- --check\n' -exec cargo fmt --manifest-path {} -- --check \;
- run: cargo build --manifest-path ${{ matrix.path }} - run: find ${{ matrix.path }} -type f -name 'Cargo.toml' -printf '\ncargo build --manifest-path %p\n' -exec cargo build --manifest-path {} \;
- run: cargo test --manifest-path ${{ matrix.path }} - run: find ${{ matrix.path }} -type f -name 'Cargo.toml' -printf '\ncargo test --manifest-path %p\n' -exec cargo test --manifest-path {} \;
- if: ${{ contains(matrix.path, 'core/Cargo.toml') }} - run: (${{ '[ -d "' }}${{ matrix.path }}${{ '/service" ]' }} && find ${{ matrix.path }}/service -type f -name 'Cargo.toml' -printf '\ncargo test --manifest-path %p --features mock\n' -exec cargo test --manifest-path {} --features mock \;) || true
run: cargo test --manifest-path ${{ matrix.path }} --features mock
issues-matrix: issues-matrix:
name: Issues Matrix name: Issues Matrix