|
| 1 | +name: diesel-tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - '.github/workflows/diesel.yml' |
| 7 | + - 'examples/diesel_*/**' |
| 8 | + - 'sea-query-diesel/**' |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - master |
| 12 | + - 0.*.x |
| 13 | + - pr/**/ci |
| 14 | + - ci-* |
| 15 | + paths: |
| 16 | + - '.github/workflows/diesel.yml' |
| 17 | + - 'examples/diesel_*/**' |
| 18 | + - 'sea-query-diesel/**' |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +env: |
| 25 | + CARGO_TERM_COLOR: always |
| 26 | + |
| 27 | +jobs: |
| 28 | + rustfmt: |
| 29 | + name: Rustfmt |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v3 |
| 33 | + - uses: dtolnay/rust-toolchain@master |
| 34 | + with: |
| 35 | + toolchain: nightly |
| 36 | + components: rustfmt |
| 37 | + - run: cargo fmt --manifest-path examples/diesel_sqlite/Cargo.toml --all -- --check |
| 38 | + - run: cargo fmt --manifest-path examples/diesel_postgres/Cargo.toml --all -- --check |
| 39 | + - run: cargo fmt --manifest-path examples/diesel_mysql/Cargo.toml --all -- --check |
| 40 | + |
| 41 | + diesel-build: |
| 42 | + name: Build `sea-query-diesel` |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v3 |
| 46 | + - uses: dtolnay/rust-toolchain@stable |
| 47 | + - run: cargo update --manifest-path sea-query-diesel/Cargo.toml --workspace -p bigdecimal:0.4.1 --precise 0.3.1 |
| 48 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-chrono,with-json,with-rust_decimal,with-bigdecimal,with-uuid,with-time,with-ipnetwork,with-mac_address,postgres-array |
| 49 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-chrono |
| 50 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-json |
| 51 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-rust_decimal |
| 52 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres --features=with-rust_decimal-postgres |
| 53 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features mysql --features=with-rust_decimal-mysql |
| 54 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-bigdecimal |
| 55 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-uuid |
| 56 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-time |
| 57 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-ipnetwork |
| 58 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=with-mac_address |
| 59 | + - run: cargo build --manifest-path sea-query-diesel/Cargo.toml --workspace --features postgres,sqlite,mysql --features=postgres-array |
| 60 | + |
| 61 | + sqlite: |
| 62 | + name: SQLite |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: diesel-build |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + example: [diesel_sqlite] |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v3 |
| 70 | + - uses: dtolnay/rust-toolchain@stable |
| 71 | + - run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 72 | + - run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 73 | + |
| 74 | + mysql: |
| 75 | + name: MySQL |
| 76 | + runs-on: ubuntu-latest |
| 77 | + needs: diesel-build |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + version: [8.0, 5.7] |
| 81 | + example: [diesel_mysql] |
| 82 | + services: |
| 83 | + mysql: |
| 84 | + image: mysql:${{ matrix.version }} |
| 85 | + env: |
| 86 | + MYSQL_HOST: 127.0.0.1 |
| 87 | + MYSQL_DATABASE: query |
| 88 | + MYSQL_USER: sea |
| 89 | + MYSQL_PASSWORD: sea |
| 90 | + MYSQL_ROOT_PASSWORD: sea |
| 91 | + ports: |
| 92 | + - "3306:3306" |
| 93 | + options: >- |
| 94 | + --health-cmd="mysqladmin ping" |
| 95 | + --health-interval=10s |
| 96 | + --health-timeout=5s |
| 97 | + --health-retries=3 |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v3 |
| 100 | + - uses: dtolnay/rust-toolchain@stable |
| 101 | + - run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 102 | + - run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 103 | + |
| 104 | + mariadb: |
| 105 | + name: MariaDB |
| 106 | + runs-on: ubuntu-latest |
| 107 | + needs: diesel-build |
| 108 | + strategy: |
| 109 | + matrix: |
| 110 | + version: [10.6] |
| 111 | + example: [diesel_mysql] |
| 112 | + services: |
| 113 | + mariadb: |
| 114 | + image: mariadb:${{ matrix.version }} |
| 115 | + env: |
| 116 | + MYSQL_HOST: 127.0.0.1 |
| 117 | + MYSQL_DATABASE: query |
| 118 | + MYSQL_USER: sea |
| 119 | + MYSQL_PASSWORD: sea |
| 120 | + MYSQL_ROOT_PASSWORD: sea |
| 121 | + ports: |
| 122 | + - "3306:3306" |
| 123 | + options: >- |
| 124 | + --health-cmd="mysqladmin ping" |
| 125 | + --health-interval=10s |
| 126 | + --health-timeout=5s |
| 127 | + --health-retries=3 |
| 128 | + steps: |
| 129 | + - uses: actions/checkout@v3 |
| 130 | + - uses: dtolnay/rust-toolchain@stable |
| 131 | + - run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 132 | + - run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 133 | + |
| 134 | + postgres: |
| 135 | + name: PostgreSQL |
| 136 | + runs-on: ubuntu-latest |
| 137 | + needs: diesel-build |
| 138 | + strategy: |
| 139 | + matrix: |
| 140 | + version: [14.4, 13.7, 12.11] |
| 141 | + example: [diesel_postgres] |
| 142 | + services: |
| 143 | + postgres: |
| 144 | + image: postgres:${{ matrix.version }} |
| 145 | + env: |
| 146 | + POSTGRES_HOST: 127.0.0.1 |
| 147 | + POSTGRES_DB: query |
| 148 | + POSTGRES_USER: sea |
| 149 | + POSTGRES_PASSWORD: sea |
| 150 | + ports: |
| 151 | + - "5432:5432" |
| 152 | + options: >- |
| 153 | + --health-cmd pg_isready |
| 154 | + --health-interval 10s |
| 155 | + --health-timeout 5s |
| 156 | + --health-retries 5 |
| 157 | + steps: |
| 158 | + - uses: actions/checkout@v3 |
| 159 | + - uses: dtolnay/rust-toolchain@stable |
| 160 | + - run: cargo update --manifest-path examples/${{ matrix.example }}/Cargo.toml -p bigdecimal:0.4.1 --precise 0.3.1 |
| 161 | + - run: cargo build --manifest-path examples/${{ matrix.example }}/Cargo.toml |
| 162 | + - run: cargo run --manifest-path examples/${{ matrix.example }}/Cargo.toml |
0 commit comments