Skip to content

Commit

Permalink
feat(integration-tests): Setup integration tests (#85)
Browse files Browse the repository at this point in the history
* feat(integration-tests): Setup integration tests

* test(integration-tests): Update action to run integration tests

* test(integration-tests): Fix pipeline

* test(integration-tests): Fix tests

* fix(integration-tests): Remove cwd

* test(integration-tests): Update config
  • Loading branch information
adrien2p authored May 11, 2022
1 parent 5c11ec4 commit 12ef12f
Show file tree
Hide file tree
Showing 14 changed files with 1,175 additions and 14 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.jest-cache/*
.jest-coverage/*
node_modules/*
integration-tests/*

**/dist/*
**/node_modules/*
Expand Down
50 changes: 47 additions & 3 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 15., 16.x]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -22,13 +25,54 @@ jobs:
fetch-depth: 0

- name: Setup Node.js environment
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v3.1.1
with:
node-version: "14"
cache: "npm"
node-version: ${{ matrix.node }}

- name: 'npm install'
run: npm install

- name: 'run unit tests'
run: npm run test

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 15., 16.x]

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

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}

- name: 'prepare packages and install'
run: |
npm i && npm run build && npm pack --pack-destination integration-tests && PACKAGE_NAME=$(cat package.json | grep version | head -1 | awk -F: '{ print "medusa-extender-", $2, ".tgz" }' | sed 's/[ ",]//g') && cd integration-tests && npm i ${PACKAGE_NAME} && npm i
- name: 'run integration tests'
run: cd integration-tests && npm run test:integration
env:
DB_PASSWORD: postgres
IS_CI: true
9 changes: 9 additions & 0 deletions integration-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist
node_modules
tsconfig.tsbuildinfo

.env
.env.local
.env.test

package-lock.json
Loading

0 comments on commit 12ef12f

Please sign in to comment.