Skip to content

Commit 7520670

Browse files
Merge pull request #202 from shubham1172/shubham1172/fix-e2e-pipeline-2
Update testing pipeline
2 parents f503465 + 3eebeb5 commit 7520670

File tree

4 files changed

+84
-19
lines changed

4 files changed

+84
-19
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ jobs:
4343

4444
- name: Build Package
4545
run: ./scripts/build.sh
46+
47+
- name: Run unit tests
48+
id: tests
49+
run: npm run test:unit:all
50+
51+
- name: Upload test coverage
52+
uses: codecov/codecov-action@v1
4653

4754
- name: Is Release?
4855
if: startswith(github.ref, 'refs/tags/v')

.github/workflows/test-e2e.yml

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,84 @@ jobs:
2929
test-e2e:
3030
runs-on: ubuntu-latest
3131
env:
32-
NODE_VER: 16.14.0
32+
GOVER: 1.17
33+
DAPR_CLI_VER: 1.6.0
34+
DAPR_RUNTIME_VER: 1.6.0
3335
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
36+
DAPR_CLI_REF: '9472e6d977817243d6da28af3e3ca744414c54e6' # TODO, remove once DAPR CLI is upgraded to v1.7
37+
DAPR_REF: ''
38+
NODE_VER: 16.14.0
3439
services:
3540
emqx:
3641
image: emqx/emqx
3742
ports:
38-
- 1883:1883
39-
- 8081:8081
40-
- 8083:8083
41-
- 8883:8883
43+
- 1883:1883
44+
- 8081:8081
45+
- 8083:8083
46+
- 8883:8883
4247
# - 8084:8084 // this port is already used?
4348
- 18083:18083
4449
mongodb:
4550
image: mongo
4651
ports:
4752
- 27017:27017
4853
steps:
49-
- uses: actions/checkout@v2
54+
- name: Set up Dapr CLI
55+
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
56+
57+
- name: Set up Go ${{ env.GOVER }}
58+
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
59+
uses: actions/setup-go@v2
60+
with:
61+
go-version: ${{ env.GOVER }}
62+
63+
- name: Checkout Dapr CLI repo to custom reference
64+
uses: actions/checkout@v2
65+
if: env.DAPR_CLI_REF != ''
66+
with:
67+
repository: dapr/cli
68+
ref: ${{ env.DAPR_CLI_REF }}
69+
path: cli
70+
71+
- name: Checkout Dapr runtime repo to custom reference
72+
uses: actions/checkout@v2
73+
if: env.DAPR_REF != ''
74+
with:
75+
repository: dapr/dapr
76+
ref: ${{ env.DAPR_REF }}
77+
path: dapr
78+
79+
- name: Build and override dapr cli with referenced commit
80+
if: env.DAPR_CLI_REF != ''
81+
run: |
82+
cd cli
83+
make
84+
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr
85+
cd ..
86+
87+
- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
88+
run: |
89+
dapr uninstall --all
90+
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}
91+
92+
- name: Build and override daprd with referenced commit.
93+
if: env.DAPR_REF != ''
94+
run: |
95+
cd dapr
96+
make
97+
mkdir -p $HOME/.dapr/bin/
98+
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd
99+
cd ..
100+
101+
- name: Override placement service.
102+
if: env.DAPR_REF != ''
103+
run: |
104+
docker stop dapr_placement
105+
cd dapr
106+
./dist/linux_amd64/release/placement &
107+
108+
- name: Checkout JS-SDK
109+
uses: actions/checkout@v2
50110

51111
# Setup .npmrc file to publish to npm
52112
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
@@ -56,17 +116,12 @@ jobs:
56116
node-version: ${{ env.NODE_VER }}
57117
registry-url: 'https://registry.npmjs.org'
58118

59-
- name: Dapr - Install CLI
60-
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
119+
- name: Install NPM Dependencies
120+
run: npm i
61121

62-
- name: Dapr - Initialize
63-
run: dapr init
122+
- name: Run E2E tests
123+
id: tests
124+
run: npm run test:e2e:all
64125

65-
- name: Install Dependencies
66-
run: npm i
67-
68-
- run: npm run test:unit:main
69-
- run: npm run test:unit:actors
70-
- run: npm run test:e2e:grpc:main
71-
- run: npm run test:e2e:http:main
72-
- run: npm run test:e2e:http:actors
126+
- name: Upload test coverage
127+
uses: codecov/codecov-action@v1

jest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ limitations under the License.
1515
module.exports = {
1616
preset: 'ts-jest',
1717
testEnvironment: 'node',
18+
collectCoverage: true,
19+
coverageReporters: ['lcov']
1820
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
"test:e2e:http:main": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test:e2e 'test/e2e/main.http.test.ts'",
1414
"test:e2e:http:actors": "dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components npm run test:e2e 'test/e2e/actors.http.test.ts'",
1515
"test:unit": "jest --runInBand --detectOpenHandles",
16-
"test:unit:all": "npm run test:unit:main && npm run test:unit:actors",
16+
"test:unit:all": "npm run test:unit:main && npm run test:unit:actors && npm run test:unit:utils",
1717
"test:unit:main": "NODE_ENV=test npm run test:unit 'test/unit/main/.*\\.test\\.ts'",
1818
"test:unit:actors": "NODE_ENV=test npm run test:unit 'test/unit/actor/.*\\.test\\.ts'",
19+
"test:unit:utils": "NODE_ENV=test npm run test:unit 'test/unit/utils/.*\\.test\\.ts'",
1920
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
2021
"build": "./scripts/build.sh",
2122
"start:dev": "npm run build && nodemon --ext \".ts,.js\" --watch \"./src\" --exec \"npm run build\""

0 commit comments

Comments
 (0)