|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths-ignore: |
| 6 | + - '**.md' |
| 7 | + - '.github/ISSUE_TEMPLATE/**' |
| 8 | + push: |
| 9 | + paths-ignore: |
| 10 | + - '**.md' |
| 11 | + - '.github/ISSUE_TEMPLATE/**' |
| 12 | + branches: |
| 13 | + - main |
| 14 | + - 1.*.x |
| 15 | + - 0.*.x |
| 16 | + - pr/**/ci |
| 17 | + - ci-* |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +env: |
| 24 | + CARGO_TERM_COLOR: always |
| 25 | + |
| 26 | +jobs: |
| 27 | + |
| 28 | + clippy: |
| 29 | + name: Clippy |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - uses: dtolnay/rust-toolchain@master |
| 34 | + with: |
| 35 | + toolchain: stable |
| 36 | + components: clippy |
| 37 | + - run: cargo clippy --all -- -D warnings |
| 38 | + - run: cargo clippy --manifest-path migration/Cargo.toml -- -D warnings |
| 39 | + |
| 40 | + rustfmt: |
| 41 | + name: Rustfmt |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - uses: dtolnay/rust-toolchain@master |
| 46 | + with: |
| 47 | + toolchain: nightly |
| 48 | + components: rustfmt |
| 49 | + - run: cargo fmt --all -- --check |
| 50 | + - run: cargo fmt --manifest-path migration/Cargo.toml --all -- --check |
| 51 | + |
| 52 | + sqlite: |
| 53 | + name: SQLite |
| 54 | + runs-on: ubuntu-latest |
| 55 | + env: |
| 56 | + DATABASE_URL: "sqlite://db.sqlite?mode=rwc" |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + - uses: dtolnay/rust-toolchain@stable |
| 60 | + - run: cargo run --no-default-features --features sqlx-sqlite task seed_data |
| 61 | + |
| 62 | + mysql: |
| 63 | + name: MySQL |
| 64 | + runs-on: ubuntu-latest |
| 65 | + env: |
| 66 | + DATABASE_URL: "mysql://root:@localhost/AdventureWorksLT2016" |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + version: [lts] |
| 71 | + services: |
| 72 | + mysql: |
| 73 | + image: mysql:${{ matrix.version }} |
| 74 | + env: |
| 75 | + MYSQL_HOST: 127.0.0.1 |
| 76 | + MYSQL_DB: mysql |
| 77 | + MYSQL_USER: sea |
| 78 | + MYSQL_PASSWORD: sea |
| 79 | + MYSQL_ALLOW_EMPTY_PASSWORD: yes |
| 80 | + ports: |
| 81 | + - "3306:3306" |
| 82 | + options: >- |
| 83 | + --health-cmd="mysqladmin ping" |
| 84 | + --health-interval=10s |
| 85 | + --health-timeout=5s |
| 86 | + --health-retries=3 |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + - uses: dtolnay/rust-toolchain@stable |
| 90 | + - run: mysql -uroot -h 127.0.0.1 mysql -e 'CREATE DATABASE `AdventureWorksLT2016`' |
| 91 | + - run: cargo run --no-default-features --features sqlx-mysql task seed_data |
| 92 | + |
| 93 | + mariadb: |
| 94 | + name: MariaDB |
| 95 | + runs-on: ubuntu-latest |
| 96 | + env: |
| 97 | + DATABASE_URL: "mysql://root:@localhost/AdventureWorksLT2016" |
| 98 | + strategy: |
| 99 | + fail-fast: false |
| 100 | + matrix: |
| 101 | + version: [lts] |
| 102 | + services: |
| 103 | + mariadb: |
| 104 | + image: mariadb:${{ matrix.version }} |
| 105 | + env: |
| 106 | + MARIADB_HOST: 127.0.0.1 |
| 107 | + MARIADB_DB: mysql |
| 108 | + MARIADB_USER: sea |
| 109 | + MARIADB_PASSWORD: sea |
| 110 | + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: yes |
| 111 | + ports: |
| 112 | + - "3306:3306" |
| 113 | + options: >- |
| 114 | + --health-cmd="healthcheck.sh |
| 115 | + --connect |
| 116 | + --innodb_initialized" |
| 117 | + --health-interval=10s |
| 118 | + --health-timeout=5s |
| 119 | + --health-retries=3 |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@v4 |
| 122 | + - uses: dtolnay/rust-toolchain@stable |
| 123 | + - run: mysql -uroot -h 127.0.0.1 mysql -e 'CREATE DATABASE `AdventureWorksLT2016`' |
| 124 | + - run: cargo run --no-default-features --features sqlx-mysql task seed_data |
| 125 | + |
| 126 | + postgres: |
| 127 | + name: Postgres |
| 128 | + runs-on: ubuntu-latest |
| 129 | + env: |
| 130 | + DATABASE_URL: "postgres://root:root@localhost/AdventureWorksLT2016" |
| 131 | + strategy: |
| 132 | + fail-fast: false |
| 133 | + matrix: |
| 134 | + version: [14, 16] |
| 135 | + services: |
| 136 | + postgres: |
| 137 | + image: postgres:${{ matrix.version }} |
| 138 | + env: |
| 139 | + POSTGRES_HOST: 127.0.0.1 |
| 140 | + POSTGRES_USER: root |
| 141 | + POSTGRES_PASSWORD: root |
| 142 | + ports: |
| 143 | + - "5432:5432" |
| 144 | + options: >- |
| 145 | + --health-cmd pg_isready |
| 146 | + --health-interval 10s |
| 147 | + --health-timeout 5s |
| 148 | + --health-retries 5 |
| 149 | + steps: |
| 150 | + - uses: actions/checkout@v4 |
| 151 | + - uses: dtolnay/rust-toolchain@stable |
| 152 | + - run: psql -q postgres://root:root@localhost/postgres -c 'CREATE DATABASE "AdventureWorksLT2016"' |
| 153 | + - run: cargo run --no-default-features --features sqlx-postgres task seed_data |
0 commit comments