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

ci: reflect local database for tests in trunk github actions workflow #312

Merged
merged 1 commit into from
Dec 18, 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
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