Skip to content

Commit

Permalink
Extract mock server start from SDK CI
Browse files Browse the repository at this point in the history
  • Loading branch information
asein-sinch committed Mar 27, 2024
1 parent 11fdcaf commit c35a6b5
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions .github/workflows/run_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,50 @@ on:
branches: [main]

jobs:
start-mock-server:
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
# Start the mock server
- name: Start the mock server
run: |
git clone https://asein_sinch:${{ secrets.PAT_CI }}@github.com/sinch/doppelganger.git sinch-sdk-mockserver
cd sinch-sdk-mockserver
git checkout upgrade-to-typescript
yarn install
yarn run compile
AUTH_PORT=8020 NUMBERS_PORT=8021 SMS_PORT=8022 CONVERSATION_PORT=8023 VERIFICATION_PORT=8024 VOICE_PORT=8025 FAX_PORT=8026 node --experimental-specifier-resolution=node dist/index.js
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
needs: start-mock-server
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

# Install dependencies
- run: yarn install

# Run linter for SDK source files
- run: npx eslint "packages/**/src/**/*.ts"

# Run linter for SDK test files
- run: npx eslint "packages/**/tests/**/*.ts"

# Transpile TS code for SDK and examples
- run: yarn run build
- run: yarn run test

# Start the mock server
- name: Start the mock server
run: |
git clone https://asein_sinch:${{ secrets.PAT_CI }}@github.com/sinch/doppelganger.git sinch-sdk-mockserver
cd sinch-sdk-mockserver
git checkout upgrade-to-typescript
yarn install
yarn run compile
AUTH_PORT=8020 NUMBERS_PORT=8021 SMS_PORT=8022 CONVERSATION_PORT=8023 VERIFICATION_PORT=8024 VOICE_PORT=8025 FAX_PORT=8026 node --experimental-specifier-resolution=node dist/index.js
# Run unit tests
- run: yarn run test

# Run tests
# Run e2e tests
- run: yarn run e2e

# Stop mock server after tests
- name: Stop Mock Server
run: |
cd mockserver
pkill -f "node --experimental-specifier-resolution=node dist/index.js"

0 comments on commit c35a6b5

Please sign in to comment.