|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - master |
| 7 | + - development |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-with-mysql: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + ruby: [2.3, 2.4, 2.5, 2.6] |
| 15 | + db_version: [5.7] |
| 16 | + runs-on: ubuntu-latest |
| 17 | + container: |
| 18 | + image: ruby:${{ matrix.ruby }} |
| 19 | + services: |
| 20 | + db: |
| 21 | + image: mysql:${{ matrix.db_version }} |
| 22 | + env: |
| 23 | + MYSQL_ROOT_PASSWORD: password |
| 24 | + ports: |
| 25 | + - 3306:3306 |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - name: Cache gems |
| 29 | + uses: actions/cache@v2 |
| 30 | + with: |
| 31 | + path: vendor/bundle |
| 32 | + key: ${{ matrix.ruby }}-mysql-${{ hashFiles('**/Gemfile') }} |
| 33 | + restore-keys: | |
| 34 | + ${{ matrix.ruby }}-mysql- |
| 35 | + ${{ matrix.ruby }}- |
| 36 | + - name: Install & run tests |
| 37 | + run: ./.github/actions/test-with-db.sh mysql |
| 38 | + env: |
| 39 | + DB_HOST: db |
| 40 | + test-with-postgres: |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + ruby: [2.3, 2.4, 2.5, 2.6] |
| 45 | + db_version: [9.5] |
| 46 | + runs-on: ubuntu-latest |
| 47 | + container: |
| 48 | + image: ruby:${{ matrix.ruby }} |
| 49 | + services: |
| 50 | + db: |
| 51 | + image: postgres:${{ matrix.db_version }} |
| 52 | + env: |
| 53 | + LANG: C.UTF-8 |
| 54 | + POSTGRES_INITDB_ARGS: --locale=C.UTF-8 |
| 55 | + POSTGRES_PASSWORD: postgres |
| 56 | + ports: |
| 57 | + - 5432:5432 |
| 58 | + # needed because the postgres container does not provide a healthcheck |
| 59 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + - name: Cache gems |
| 63 | + uses: actions/cache@v2 |
| 64 | + with: |
| 65 | + path: vendor/bundle |
| 66 | + key: ${{ matrix.ruby }}-postgres-${{ hashFiles('**/Gemfile') }} |
| 67 | + restore-keys: | |
| 68 | + ${{ matrix.ruby }}-postgres- |
| 69 | + ${{ matrix.ruby }}- |
| 70 | + - name: Install & run tests |
| 71 | + run: ./.github/actions/test-with-db.sh postgres |
| 72 | + env: |
| 73 | + DB_HOST: db |
| 74 | + test-with-sqlite: |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + ruby: [2.3, 2.4, 2.5, 2.6] |
| 79 | + runs-on: ubuntu-latest |
| 80 | + container: |
| 81 | + image: ruby:${{ matrix.ruby }} |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v2 |
| 84 | + - name: Cache gems |
| 85 | + uses: actions/cache@v2 |
| 86 | + with: |
| 87 | + path: vendor/bundle |
| 88 | + key: ${{ matrix.ruby }}-sqlite-${{ hashFiles('**/Gemfile') }} |
| 89 | + restore-keys: | |
| 90 | + ${{ matrix.ruby }}-sqlite- |
| 91 | + ${{ matrix.ruby }}- |
| 92 | + - name: Install & run tests |
| 93 | + run: ./.github/actions/test-with-db.sh sqlite |
0 commit comments