Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto discover and run all issues & examples CI #903

Merged
merged 5 commits into from
Jul 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 52 additions & 33 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

init:
name: Init
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
outputs:
run-sqlite: ${{ contains(steps.git-log.outputs.message, '[sqlite]') }}
run-mysql: ${{ contains(steps.git-log.outputs.message, '[mysql]') }}
Expand All @@ -89,7 +89,7 @@ jobs:

clippy:
name: Clippy
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -144,8 +144,9 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-sqlite == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime: [async-std]
tls: [native-tls, rustls]
Expand Down Expand Up @@ -183,8 +184,9 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime: [actix]
tls: [native-tls, rustls]
Expand Down Expand Up @@ -222,8 +224,9 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-postgres == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime: [tokio]
tls: [native-tls, rustls]
Expand Down Expand Up @@ -255,7 +258,7 @@ jobs:

test:
name: Unit Test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -287,10 +290,7 @@ jobs:
name: CLI
needs: init
if: ${{ (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-cli == 'true') }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

Expand All @@ -307,14 +307,26 @@ jobs:
--path sea-orm-cli
--debug

examples-matrix:
name: Examples Matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- 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/\(.)" ]')"
outputs:
path_matrix: ${{ steps.set-matrix.outputs.path_matrix }}

examples:
name: Examples
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
needs: examples-matrix
strategy:
fail-fast: false
max-parallel: 12
matrix:
os: [ubuntu-latest]
path: [basic, actix_example, actix3_example, axum_example, graphql_example, rocket_example, poem_example, jsonrpsee_example, tonic_example]
path: ${{ fromJson(needs.examples-matrix.outputs.path_matrix) }}
steps:
- uses: actions/checkout@v2

Expand All @@ -328,31 +340,38 @@ jobs:
with:
command: build
args: >
--manifest-path examples/${{ matrix.path }}/Cargo.toml

- name: Check existence of migration directory
id: migration_dir_exists
uses: andstor/file-existence-action@v1
with:
files: examples/${{ matrix.path }}/migration/Cargo.toml
--manifest-path ${{ matrix.path }}

- uses: actions-rs/cargo@v1
if: steps.migration_dir_exists.outputs.files_exists == 'true'
with:
command: build
command: test
args: >
--manifest-path examples/${{ matrix.path }}/migration/Cargo.toml
--manifest-path ${{ matrix.path }}

issues-matrix:
name: Issues Matrix
needs: init
if: ${{ (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-issues == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- 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/\(.)" ]')"
outputs:
path_matrix: ${{ steps.set-matrix.outputs.path_matrix }}

issues:
name: Issues
needs: init
needs:
- init
- issues-matrix
if: ${{ (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-issues == 'true') }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
path: [86, 249, 262, 319, 324, 352, 356, 471, 630, 693]
path: ${{ fromJson(needs.issues-matrix.outputs.path_matrix) }}
steps:
- uses: actions/checkout@v2

Expand All @@ -366,13 +385,13 @@ jobs:
with:
command: build
args: >
--manifest-path issues/${{ matrix.path }}/Cargo.toml
--manifest-path ${{ matrix.path }}

- uses: actions-rs/cargo@v1
with:
command: test
args: >
--manifest-path issues/${{ matrix.path }}/Cargo.toml
--manifest-path ${{ matrix.path }}

sqlite:
name: SQLite
Expand All @@ -384,7 +403,7 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-sqlite == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
DATABASE_URL: "sqlite::memory:"
strategy:
Expand Down Expand Up @@ -435,7 +454,7 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
Expand Down Expand Up @@ -504,7 +523,7 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
DATABASE_URL: "mysql://root:@localhost"
strategy:
Expand Down Expand Up @@ -565,7 +584,7 @@ jobs:
needs.init.outputs.run-partial == 'false' ||
(needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-postgres == 'true')
}}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
DATABASE_URL: "postgres://root:root@localhost"
strategy:
Expand Down