Skip to content

Commit

Permalink
test #1
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgnlez committed Jun 3, 2024
1 parent 2b51162 commit e9d36ee
Show file tree
Hide file tree
Showing 32 changed files with 21,677 additions and 33,632 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-database-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand Down
45 changes: 22 additions & 23 deletions .github/workflows/testing-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,25 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use Node.js 18.16
uses: actions/setup-node@v3
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '18.16'
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4

- name: Install API dependencies
working-directory: api
run: yarn install
run: pnpm api:deps

- name: Prepare database
working-directory: api
run: yarn test:db-prepare
run: pnpm test:db-prepare

- name: Run API tests + coverage
working-directory: api
run: yarn test:e2e
run: pnpm test:e2e

# - name: Generate API coverage artifact
# uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -86,24 +87,23 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js 18.16
uses: actions/setup-node@v3
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '18.16'
node-version-file: '.nvmrc'

- name: Install API dependencies
working-directory: api
run: yarn install
run: pnpm api:deps

- name: Prepare database
working-directory: api
run: yarn test:db-prepare
run: pnpm test:db-prepare

- name: Run API tests + coverage
working-directory: api
run: yarn test:integration
run: pnpm test:integration

testing-api-unit:
name: Unit Tests
Expand All @@ -112,20 +112,19 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js 18.16
uses: actions/setup-node@v3
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: '18.16'
node-version-file: '.nvmrc'

- name: Install API dependencies
working-directory: api
run: yarn install
run: pnpm api:deps

- name: Run API tests + coverage
working-directory: api
run: yarn test:unit
run: pnpm test:unit

# - name: Generate API coverage artifact
# uses: actions/upload-artifact@v2
Expand Down
32 changes: 12 additions & 20 deletions .github/workflows/testing-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
- 'client/**'
- '.github/workflows/testing-client.yml'

workflow_dispatch:

env:
NODE_ENV: production

jobs:
testing-client:
name: Running client tests
Expand All @@ -19,36 +14,33 @@ jobs:
if: ${{ github.ref_name != 'test' }}
strategy:
fail-fast: false
defaults:
run:
working-directory: ${{github.workspace}}/client
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js 18.13
uses: actions/setup-node@v3
- name: Node setup
uses: actions/setup-node@v4
with:
node-version-file: 'client/.nvmrc'
cache: 'yarn'
cache-dependency-path: client/yarn.lock
node-version-file: '.nvmrc'

- uses: pnpm/action-setup@v4

- name: Install dependencies
run: yarn install --immutable
- name: Install Client dependencies
run: pnpm client:deps

- name: Cypress run
uses: cypress-io/github-action@v5
with:
record: true
working-directory: client
install: false
build: yarn build
start: yarn start
build: pnpm build
start: pnpm start
browser: chrome
wait-on: http://localhost:3000/auth/signin
config-file: cypress.config.ts
command-prefix: yarn dlx
command: "yarn test:e2e"
command-prefix: pnpm dlx
command: "pnpm test:e2e"
env:
NEXT_PUBLIC_API_URL: ${{ secrets.CYPRESS_API_URL }}
NEXT_TELEMETRY_DISABLED: 1
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public-hoist-pattern[]=@tanstack/table-core
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.14.0
1 change: 0 additions & 1 deletion api/.nvmrc

This file was deleted.

14 changes: 7 additions & 7 deletions api/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ set -e
case "$1" in
develop)
echo "Running api application in development mode"
exec yarn start
exec pnpm start
;;
test)
echo "Synchronizing database..."
exec yarn typeorm schema:sync
exec pnpm typeorm schema:sync
echo "Running Tests"
exec yarn test
exec pnpm test
;;
build)
echo "Build api application"
exec yarn build
exec pnpm build
;;
start:watch)
echo "Synchronizing database..."
exec yarn typeorm schema:sync
exec pnpm typeorm schema:sync
echo "Running api application in development mode with watch"
exec yarn start:watch
exec pnpm start:watch
;;
start:prod)
echo "Synchronizing database..."
yarn start:prod
pnpm start:prod
;;
*)
echo "Usage: service.sh {develop|test|build|start:watch|start:prod}" >&2
Expand Down
13 changes: 5 additions & 8 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"name": "@landgriffon/api",
"name": "api",
"version": "0.2.0",
"description": "API service for the LandGriffon platform",
"author": "Vizzuality <[email protected]> (https://vizzuality.com/)",
"private": true,
"license": "MIT",
"scripts": {
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "yarn typeorm schema:sync && nest start",
"start:watch": "yarn typeorm schema:sync && nest start --watch",
"start": "pnpm typeorm schema:sync && nest start",
"start:watch": "pnpm typeorm schema:sync && nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "yarn typeorm schema:sync && NODE_ENV=production, NODE_PATH=dist/src node dist/src/main",
"start:prod": "pnpm typeorm schema:sync && NODE_ENV=production, NODE_PATH=dist/src node dist/src/main",
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d src/data-source.ts",
"build": "rm -rf dist && tsc",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test:db-prepare": "yarn typeorm schema:drop && yarn typeorm schema:sync",
"test:db-prepare": "pnpm typeorm schema:drop && pnpm typeorm schema:sync",
"test": "node --expose-gc ./node_modules/.bin/jest --config test/jest-config.json -i --logHeapUsage --forceExit",
"test:watch": "jest --config test/jest-config.json --watch",
"test:cov": "node --expose-gc ./node_modules/.bin/jest --config test/jest-config.json --coverage --forceExit",
Expand All @@ -23,9 +23,6 @@
"test:unit": "node --expose-gc ./node_modules/.bin/jest --config test/jest-config.json --forceExit -i test/unit/",
"test:e2e": "NODE_OPTIONS=\"--max-old-space-size=6144\" node --expose-gc ./node_modules/.bin/jest --config test/jest-config.json --logHeapUsage --forceExit -i test/e2e/"
},
"engines": {
"node": "^18.16"
},
"dependencies": {
"@google-cloud/bigquery": "^7.5.0",
"@googlemaps/google-maps-services-js": "~3.3.2",
Expand Down
Loading

0 comments on commit e9d36ee

Please sign in to comment.