Skip to content

Commit

Permalink
test(integration-tests): Improve tests pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed May 6, 2022
1 parent 3ee7b87 commit a8b502c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 21,488 deletions.
45 changes: 28 additions & 17 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,40 +25,48 @@ 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
defaults:
run:
working-directory: integration-tests
strategy:
matrix:
node-version: [14.x, 15., 16.x]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: medusa-extender
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/[email protected]
with:
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: 'prepare packages and install'
run: |
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} && rm -f ${PACKAGE_NAME} && npm i
- name: 'run integration tests'
run: npm run test:integration
run: |
cd integration-tests
npm run test:integration
4 changes: 3 additions & 1 deletion integration-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ tsconfig.tsbuildinfo

.env
.env.local
.env.test
.env.test

package-lock.json
Loading

0 comments on commit a8b502c

Please sign in to comment.