-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from UN-OCHA/env/stage
🚀 Release v4.6.4 and deploy to production
- Loading branch information
Showing
19 changed files
with
10,194 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,5 @@ package-lock.json | |
.smbdelete* | ||
test-data/* | ||
.env | ||
.vscode | ||
*.sublime-project | ||
*.sublime-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Jest Tests", | ||
"type": "node", | ||
"preLaunchTask": "start-containers", | ||
"request": "launch", | ||
"runtimeArgs": [ | ||
"--inspect-brk", | ||
"${workspaceRoot}/node_modules/.bin/jest", | ||
"--runInBand" | ||
], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "start-containers", | ||
"type": "shell", | ||
"command": "${workspaceRoot}/bin/test.sh", | ||
"args": ["-oc"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env bash | ||
|
||
root=$(pwd) | ||
|
||
# Global variables | ||
USAGE="Usage: $(basename "$0") [options] [-- [options]]. | ||
Options: | ||
-oc, --only-containers: Only start Docker containers | ||
-sc, --stop-containers: Stop Docker containers | ||
-k, --keep: Keep Jest running after the completion of the test suites | ||
-c: Run tests with coverage | ||
-h, --help: Show this help message | ||
--: Pass extra options" | ||
KEEP=0 | ||
FORCE_STOP_JEST='--forceExit' | ||
ONLY_CONTAINERS=0 | ||
STOP_CONTAINERS=0 | ||
COMMAND_ARGS='' | ||
|
||
function moveToTestDir { | ||
cd ${root}/tests | ||
} | ||
|
||
function moveToRootDir { | ||
cd ${root} | ||
} | ||
|
||
# Obtain options | ||
while [ "$1" != "" ]; do | ||
case $1 in | ||
-oc | --only-containers ) ONLY_CONTAINERS=1 | ||
;; | ||
-sc | --stop-containers ) STOP_CONTAINERS=1 | ||
;; | ||
-k | --keep ) KEEP=1 | ||
;; | ||
-c) shift | ||
COMMAND_ARGS="${COMMAND_ARGS} --coverage" | ||
;; | ||
-h | --help ) echo "$USAGE" | ||
exit | ||
;; | ||
--) shift | ||
while [ "$1" != "" ]; do | ||
COMMAND_ARGS="${COMMAND_ARGS} -- $1" | ||
shift | ||
done | ||
;; | ||
* ) echo "$USAGE" | ||
exit 1 | ||
esac | ||
shift | ||
done | ||
|
||
# ONLY_CONTAINERS must be 1 and STOP_CONTAINERS must be 0 | ||
if [ $ONLY_CONTAINERS -eq 1 ] && [ "$STOP_CONTAINERS" -eq 1 ]; then | ||
echo "$USAGE" | ||
exit 1 | ||
fi | ||
|
||
# STOP_CONTAINERS is a final option | ||
if [[ $STOP_CONTAINERS -eq 1 ]]; then | ||
echo "Stopping Docker containers" | ||
moveToTestDir | ||
docker compose down | ||
exit 0 | ||
fi | ||
|
||
|
||
echo "Starting Docker containers" | ||
moveToTestDir | ||
docker compose up -d | ||
|
||
if [ $ONLY_CONTAINERS -eq 1 ]; then | ||
exit 0 | ||
fi | ||
|
||
# Run tests | ||
echo "Running tests" | ||
moveToRootDir | ||
|
||
if [ $KEEP -eq 0 ]; then | ||
FORCE_STOP_JEST='' | ||
fi | ||
|
||
yarn jest "$COMMAND_ARGS" $FORCE_STOP_JEST | ||
|
||
if [ $KEEP -eq 0 ]; then | ||
# Stop Docker containers | ||
echo "Stopping Docker containers" | ||
moveToTestDir | ||
docker compose down | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
verbose: true, | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testPathIgnorePatterns: ['<rootDir>/node_modules/'], | ||
testMatch: ['<rootDir>/**/*.spec.ts'], | ||
coveragePathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/test/'], | ||
clearMocks: true, | ||
transform: { | ||
'^.+\\.ts?$': 'ts-jest', | ||
}, | ||
transformIgnorePatterns: ['node_modules/(?!(@unocha)/)'], | ||
modulePathIgnorePatterns: ['<rootDir>/test/'], | ||
setupFilesAfterEnv: ['<rootDir>/tests/test-environment-setup.ts'], | ||
testTimeout: 100_000, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
services: | ||
db: | ||
image: postgres:14.8-alpine3.18 | ||
ports: | ||
- 6432:5432 | ||
environment: | ||
- POSTGRES_DB=hpc-test | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
volumes: | ||
- ./migration/schema-2024-03-13.sql:/docker-entrypoint-initdb.d/init.sql |
Oops, something went wrong.