Skip to content

Commit

Permalink
chore(ci): run tests on multiple operating systems (#10526)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
Co-authored-by: Pierre-Antoine Mills <pierreantoine.urvoy@gmail.com>
  • Loading branch information
3 people committed Dec 21, 2021
1 parent f0631b2 commit a397c78
Show file tree
Hide file tree
Showing 45 changed files with 661 additions and 316 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ module.exports = {
'jest/no-export': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
// Allow the `testIf`/`describeIf` pattern.
// TODO: it's not exactly correct to have `describeIf` in `additionalTestBlockFunctions`,
// but it's better than disabling the rule completely for files that need `describeIf`.
// Ideally, a new option like `additionalDescribeBlockFunctions` should be implemented in the rule.
'jest/no-standalone-expect': [
'error',
{
additionalTestBlockFunctions: ['testIf', 'describeIf'],
},
],
},
},
],
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/install-mysql.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

scoop install mysql

$DefaultsFile = Join-Path (Resolve-Path ~).Path "scoop\apps\mysql\current\my.ini"
mysqld --install MySQL --defaults-file="$DefaultsFile"
sc start MySQL
16 changes: 16 additions & 0 deletions .github/workflows/setup-mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#/bin/bash

set -ex

if [ "$RUNNER_OS" = "Windows" ]; then
pwsh .github/workflows/install-mysql.ps1
fi

if [ "$RUNNER_OS" = "macOS" ]; then
brew install mysql
brew services run mysql
fi

echo 'TEST_MYSQL_URI=mysql://root@localhost:3306/tests' >> $GITHUB_ENV
echo 'TEST_MYSQL_URI_MIGRATE=mysql://root@localhost:3306/tests-migrate' >> $GITHUB_ENV
echo 'TEST_MYSQL_SHADOWDB_URI_MIGRATE=mysql://root@localhost:3306/tests-migrate-shadowdb' >> $GITHUB_ENV
25 changes: 25 additions & 0 deletions .github/workflows/setup-postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -ex

if [ "$RUNNER_OS" = "Windows" ]; then
export PGDATA="$RUNNER_TEMP\\pgdata"
export PGUSER="$USERNAME"
export PATH="$PATH:$(cygpath "$PGBIN")"
export PQ_LIB_DIR="$PGROOT\\lib"
fi

if [ "$RUNNER_OS" = "macOS" ]; then
export PGDATA="$RUNNER_TEMP/pgdata"
export PGUSER="$USER"
fi

pg_ctl init
pg_ctl start
createuser --createdb prisma
createdb -O prisma tests
psql -c "ALTER USER prisma PASSWORD 'prisma';" tests

echo 'TEST_POSTGRES_URI=postgres://prisma:prisma@localhost:5432/tests' >> $GITHUB_ENV
echo 'TEST_POSTGRES_URI_MIGRATE=postgres://prisma:prisma@localhost:5432/tests-migrate' >> $GITHUB_ENV
echo 'TEST_POSTGRES_SHADOWDB_URI_MIGRATE=postgres://prisma:prisma@localhost:5432/tests-migrate-shadowdb' >> $GITHUB_ENV
Loading

0 comments on commit a397c78

Please sign in to comment.