Skip to content
Open
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
56 changes: 51 additions & 5 deletions .github/workflows/socketio_e2e.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Socket.IO E2E test
on:
push:
Expand All @@ -12,7 +10,8 @@ on:
paths:
- 'sdk/**'
env:
NODE_VERSION: '18.x' # set this to the node version to use
NODE_VERSION: '18.x'

jobs:
build:
name: Socket.IO E2E tests
Expand All @@ -21,17 +20,63 @@ jobs:
strategy:
matrix:
node-version: [18.x]

# Add permissions if needed
permissions:
contents: read
pull-requests: read

steps:
- uses: actions/checkout@v3
# Security check for PRs
- name: Check if PR is from a fork
if: github.event_name == 'pull_request_target'
run: |
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
echo "PR is from a fork - checking if author has write access"
if [ "${{ github.event.pull_request.author_association }}" != "CONTRIBUTOR" ] &&
[ "${{ github.event.pull_request.author_association }}" != "MEMBER" ] &&
[ "${{ github.event.pull_request.author_association }}" != "OWNER" ]; then
echo "PR author doesn't have required permissions"
exit 1
fi
echo "PR author have required permissions"
exit 0
fi
echo "PR is not from a fork"

# First checkout the base repo to get workflow files
- name: Checkout base repository
uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
ref: main
fetch-depth: 1

# Then checkout the PR code
- name: Checkout PR
uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 1

# For push events, just do normal checkout
- name: Checkout for push
uses: actions/checkout@v3
if: github.event_name == 'push'
with:
fetch-depth: 3
fetch-depth: 1

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm install -g yarn

- name: Install SocketIO SDK
id: socketio
run: |
Expand All @@ -43,6 +88,7 @@ jobs:
yarn build
popd
shell: bash

- name: Test
env:
WebPubSubConnectionString: ${{ secrets.SOCKETIO_E2E_CONNECTION_STRING }}
Expand Down
1 change: 1 addition & 0 deletions sdk/webpubsub-socketio-extension/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const wpsOptions = {
};
const optS = JSON.stringify(wpsOptions);
console.debug(`Test Config = ${optS.substring(0, 60)}***${optS.slice(-20)}`);
console.log("hiiiiiii");

if (wpsOptions.hub !== undefined || wpsOptions.connectionString !== undefined) {
describe("WebPubSub Socket.IO Extension", () => {
Expand Down
Loading