Skip to content

Commit

Permalink
update pipelines for API tests (#3380)
Browse files Browse the repository at this point in the history
* update pipelines for API tests

* pipeline names and schedule updated
  • Loading branch information
Celiant authored Mar 26, 2024
1 parent 6024f2b commit d2e8453
Show file tree
Hide file tree
Showing 2 changed files with 223 additions and 112 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/api-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Guardian CI API Tests(Manual)
on:
workflow_dispatch:
description: 'Manual run'

jobs:
buildAndTest:
runs-on: ubuntu-latest
services:
ipfs-node:
image: ipfs/kubo:latest
ports:
- 8080:8080
- 5001:5001
strategy:
matrix:
node-version: [ 20.x ]
mongodb-version: [ 7.0.5 ]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- name: Build packages
run: |
pushd interfaces
yarn run build
popd
pushd common
yarn run build
popd
pushd notification-service
yarn run build
popd
pushd logger-service
yarn run build
popd
pushd auth-service
yarn run build
popd
pushd guardian-service
yarn run build
popd
pushd policy-service
yarn run build
popd
pushd worker-service
yarn run build
popd
pushd api-gateway
yarn run build
popd
- name: Start NatsMQ
uses: onichandame/nats-action@master
with:
port: "4222"
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Run Guardian
run: |
pushd notification-service
npm start &
sleep 20
popd
pushd logger-service
npm start &
sleep 20
popd
pushd auth-service
npm start &
sleep 20
popd
pushd guardian-service
npm start &
sleep 20
popd
pushd policy-service
npm start &
sleep 20
popd
pushd worker-service
npm start &
sleep 20
popd
pushd api-gateway
npm start &
sleep 20
popd
sleep 60
env:
CI: true
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
IPFS_NODE_ADDRESS: http://localhost:5001
IPFS_PROVIDER: local
IPFS_PUBLIC_GATEWAY: http://localhost:8080/ipfs/${cid}

- name: Run tests with Cypress
run: |
pushd e2e-tests
npm install --force
npx cypress run --env "portApi=3002,operatorId=${{ secrets.CI_HEDERA_ACCOUNT }},operatorKey=${{ secrets.CI_HEDERA_PRIV_KEY }}" --spec cypress/e2e/api-tests/**/*.cy.js
popd
- name: Publish API Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: e2e-tests/cypress/test_results/**/*.xml
222 changes: 110 additions & 112 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,115 @@
name: Guardian CI API Tests
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
description: 'Manual run'
schedule:
- cron: '0 1 * * *'

jobs:
buildAndTest:
runs-on: ubuntu-latest
services:
ipfs-node:
image: ipfs/kubo:latest
ports:
- 8080:8080
- 5001:5001
strategy:
matrix:
node-version: [ 20.x ]
mongodb-version: [ 7.0.5 ]
steps:
- uses: actions/checkout@v1
with:
ref: 'develop'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- name: Build packages
run: |
pushd interfaces
yarn run build
popd
pushd common
yarn run build
popd
pushd notification-service
yarn run build
popd
pushd logger-service
yarn run build
popd
pushd auth-service
yarn run build
popd
pushd guardian-service
yarn run build
popd
pushd policy-service
yarn run build
popd
pushd worker-service
yarn run build
popd
pushd api-gateway
yarn run build
popd
- name: Start NatsMQ
uses: onichandame/nats-action@master
with:
port: "4222"
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Run Guardian
run: |
pushd notification-service
npm start &
sleep 20
popd
pushd logger-service
npm start &
sleep 20
popd
pushd auth-service
npm start &
sleep 20
popd
pushd guardian-service
npm start &
sleep 20
popd
pushd policy-service
npm start &
sleep 20
popd
pushd worker-service
npm start &
sleep 20
popd
pushd api-gateway
npm start &
sleep 20
popd
sleep 60
env:
CI: true
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
IPFS_NODE_ADDRESS: http://localhost:5001
IPFS_PROVIDER: local
IPFS_PUBLIC_GATEWAY: http://localhost:8080/ipfs/${cid}
buildAndTest:
runs-on: ubuntu-latest
services:
ipfs-node:
image: ipfs/kubo:latest
ports:
- 8080:8080
- 5001:5001
strategy:
matrix:
node-version: [ 20.x ]
mongodb-version: [ 7.0.5 ]
steps:
- uses: actions/checkout@v1
with:
ref: 'develop'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn
- name: Build packages
run: |
pushd interfaces
yarn run build
popd
pushd common
yarn run build
popd
pushd notification-service
yarn run build
popd
pushd logger-service
yarn run build
popd
pushd auth-service
yarn run build
popd
pushd guardian-service
yarn run build
popd
pushd policy-service
yarn run build
popd
pushd worker-service
yarn run build
popd
pushd api-gateway
yarn run build
popd
- name: Start NatsMQ
uses: onichandame/nats-action@master
with:
port: "4222"
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Run Guardian
run: |
pushd notification-service
npm start &
sleep 20
popd
pushd logger-service
npm start &
sleep 20
popd
pushd auth-service
npm start &
sleep 20
popd
pushd guardian-service
npm start &
sleep 20
popd
pushd policy-service
npm start &
sleep 20
popd
pushd worker-service
npm start &
sleep 20
popd
pushd api-gateway
npm start &
sleep 20
popd
sleep 60
env:
CI: true
OPERATOR_ID: ${{ secrets.CI_HEDERA_ACCOUNT }}
OPERATOR_KEY: ${{ secrets.CI_HEDERA_PRIV_KEY }}
IPFS_NODE_ADDRESS: http://localhost:5001
IPFS_PROVIDER: local
IPFS_PUBLIC_GATEWAY: http://localhost:8080/ipfs/${cid}

- name: Run tests with Cypress
run: |
pushd e2e-tests
npm install --force
npx cypress run --spec cypress/e2e/api-tests/**/*.cy.js
popd
- name: Publish API Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: e2e-tests/cypress/test_results/**/*.xml
- name: Run tests with Cypress
run: |
pushd e2e-tests
npm install --force
npx cypress run --env "portApi=3002,operatorId=${{ secrets.CI_HEDERA_ACCOUNT }},operatorKey=${{ secrets.CI_HEDERA_PRIV_KEY }}" --spec cypress/e2e/api-tests/**/*.cy.js
popd
- name: Publish API Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: e2e-tests/cypress/test_results/**/*.xml

0 comments on commit d2e8453

Please sign in to comment.