Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:

- name: Build Package
run: ./scripts/build.sh

- name: Run unit tests
id: tests
run: npm run test:unit:all

- name: Upload test coverage
uses: codecov/codecov-action@v1

- name: Is Release?
if: startswith(github.ref, 'refs/tags/v')
Expand Down
91 changes: 73 additions & 18 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,84 @@ jobs:
test-e2e:
runs-on: ubuntu-latest
env:
NODE_VER: 16.14.0
GOVER: 1.17
DAPR_CLI_VER: 1.6.0
DAPR_RUNTIME_VER: 1.6.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
DAPR_CLI_REF: '9472e6d977817243d6da28af3e3ca744414c54e6' # TODO, remove once DAPR CLI is upgraded to v1.7
DAPR_REF: ''
NODE_VER: 16.14.0
services:
emqx:
image: emqx/emqx
ports:
- 1883:1883
- 8081:8081
- 8083:8083
- 8883:8883
- 1883:1883
- 8081:8081
- 8083:8083
- 8883:8883
# - 8084:8084 // this port is already used?
- 18083:18083
mongodb:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@v2
- name: Set up Dapr CLI
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}

- name: Set up Go ${{ env.GOVER }}
if: env.DAPR_REF != '' || env.DAPR_CLI_REF != ''
uses: actions/setup-go@v2
with:
go-version: ${{ env.GOVER }}

- name: Checkout Dapr CLI repo to custom reference
uses: actions/checkout@v2
if: env.DAPR_CLI_REF != ''
with:
repository: dapr/cli
ref: ${{ env.DAPR_CLI_REF }}
path: cli

- name: Checkout Dapr runtime repo to custom reference
uses: actions/checkout@v2
if: env.DAPR_REF != ''
with:
repository: dapr/dapr
ref: ${{ env.DAPR_REF }}
path: dapr

- name: Build and override dapr cli with referenced commit
if: env.DAPR_CLI_REF != ''
run: |
cd cli
make
sudo cp dist/linux_amd64/release/dapr /usr/local/bin/dapr
cd ..

- name: Initialize Dapr runtime ${{ env.DAPR_RUNTIME_VER }}
run: |
dapr uninstall --all
dapr init --runtime-version ${{ env.DAPR_RUNTIME_VER }}

- name: Build and override daprd with referenced commit.
if: env.DAPR_REF != ''
run: |
cd dapr
make
mkdir -p $HOME/.dapr/bin/
cp dist/linux_amd64/release/daprd $HOME/.dapr/bin/daprd
cd ..

- name: Override placement service.
if: env.DAPR_REF != ''
run: |
docker stop dapr_placement
cd dapr
./dist/linux_amd64/release/placement &

- name: Checkout JS-SDK
uses: actions/checkout@v2

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

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

- name: Dapr - Initialize
run: dapr init
- name: Run E2E tests
id: tests
run: npm run test:e2e:all

- name: Install Dependencies
run: npm i

- run: npm run test:unit:main
- run: npm run test:unit:actors
- run: npm run test:e2e:grpc:main
- run: npm run test:e2e:http:main
- run: npm run test:e2e:http:actors
- name: Upload test coverage
uses: codecov/codecov-action@v1
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ limitations under the License.
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
coverageReporters: ['lcov']
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"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'",
"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'",
"test:unit": "jest --runInBand --detectOpenHandles",
"test:unit:all": "npm run test:unit:main && npm run test:unit:actors",
"test:unit:all": "npm run test:unit:main && npm run test:unit:actors && npm run test:unit:utils",
"test:unit:main": "NODE_ENV=test npm run test:unit 'test/unit/main/.*\\.test\\.ts'",
"test:unit:actors": "NODE_ENV=test npm run test:unit 'test/unit/actor/.*\\.test\\.ts'",
"test:unit:utils": "NODE_ENV=test npm run test:unit 'test/unit/utils/.*\\.test\\.ts'",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"build": "./scripts/build.sh",
"start:dev": "npm run build && nodemon --ext \".ts,.js\" --watch \"./src\" --exec \"npm run build\""
Expand Down