Skip to content

Commit

Permalink
ci: reflect local database for tests in trunk github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rostislav-simonik committed Dec 18, 2022
1 parent 7559995 commit dbb7677
Showing 1 changed file with 79 additions and 4 deletions.
83 changes: 79 additions & 4 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ on:
branches: [main]

jobs:
test-latest-prisma:
test-latest-prisma-without-database:
name: Test with latest Prisma
timeout-minutes: 20

strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
os: ['macos-latest', 'windows-latest']
node-version: [14, 16]
database: ['no-db']

runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -41,18 +42,89 @@ jobs:

- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}

test-latest-prisma-with-database:
name: Test with latest Prisma
timeout-minutes: 20

strategy:
matrix:
os: ['ubuntu-latest']
node-version: [14, 16]
database: ['db']

runs-on: ${{ matrix.os }}

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

test-past-prisma:
- name: Install dependencies
run: yarn --frozen-lockfile

- name: Set E2E DB Schema for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $env:GITHUB_ENV

- name: Set E2E DB Schema for other operating systems
if: ${{ matrix.os != 'windows-latest' }}
run: yarn -s ts-node scripts/get-e2e-db-schema --os ${{ matrix.os }} --node-version ${{ matrix.node-version }} --github-env $GITHUB_ENV

- name: Build
run: yarn -s build

- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}

test-past-prisma-with-database:
name: Test with past Prisma
timeout-minutes: 20

strategy:
matrix:
os: ['ubuntu-latest']
node-version: [16]
database: ['db']
prisma-client-version: ['4.0']

runs-on: ${{ matrix.os }}

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -76,9 +148,12 @@ jobs:

- name: Test
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}

release-canary:
needs: [test-latest-prisma, test-past-prisma]
needs:
[test-latest-prisma-without-database, test-latest-prisma-with-database, test-past-prisma-with-database]
name: Release canary
timeout-minutes: 20

Expand Down

0 comments on commit dbb7677

Please sign in to comment.