RSDK-7244: Expose data channel so TS SDK can listen for disconnect (#… #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request_target: | |
branches: [ main ] | |
types: [ labeled ] | |
jobs: | |
test_passing: | |
name: All Tests Passing | |
needs: [build_and_test] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Check Results | |
run: | | |
echo Main Tests: ${{ needs.build_and_test.result }} | |
[ "${{ needs.build_and_test.result }}" == "success" ] | |
build_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'push' || | |
(github.event_name == 'pull_request_target' && github.event.label.name == 'safe to test' && contains(github.event.pull_request.labels.*.name, 'safe to test')) | |
steps: | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
version: "21.x" | |
- name: Install protoc-gen-js and plugins | |
run: npm install -g protoc-gen-js protoc-gen-grpc-web | |
- name: Check out main branch code | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Check out PR branch code | |
if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 2 | |
- name: Set main env vars | |
if: github.event_name != 'pull_request_target' | |
run: | | |
echo "GITHUB_X_HEAD_SHA=${GITHUB_SHA}" >> $GITHUB_ENV | |
echo "GITHUB_X_HEAD_REF=${GITHUB_REF_NAME}" >> $GITHUB_ENV | |
- name: Set PR env vars | |
if: github.event_name == 'pull_request_target' | |
env: | |
GITHUB_HEAD_REF_SAN: ${{ github.event.pull_request.head.label }} | |
run: | | |
echo "GITHUB_X_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | |
echo "GITHUB_X_HEAD_REF=${GITHUB_HEAD_REF_SAN}" >> $GITHUB_ENV | |
echo "GITHUB_X_PR_BASE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV | |
echo "GITHUB_X_PR_BASE_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV | |
- name: Verify no uncommitted changes from "make build lint" | |
run: | | |
git init | |
git add . | |
make build lint | |
GEN_DIFF=$(git status -s) | |
if [ -n "$GEN_DIFF" ]; then | |
echo '"make build lint" resulted in changes not in git' 1>&2 | |
git status | |
exit 1 | |
fi | |
- name: Test js library | |
run: CI=true make test-web | |
- if: failure() | |
name: Upload js test report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: rpc/examples/echo/playwright-report | |
retention-days: 30 | |
- name: Test go library | |
env: | |
TEST_MONGODB_URI: ${{ secrets.TEST_MONGODB_URI }} | |
MONGODB_TEST_OUTPUT_URI: ${{ secrets.MONGODB_TEST_OUTPUT_URI }} | |
run: | | |
echo "${{ secrets.ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS }}" | base64 -d > artifact_google_creds.json | |
export ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS=`pwd`/artifact_google_creds.json | |
make cover | |
- name: Upload test.json | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test.json | |
path: json.log | |
retention-days: 30 | |
# this one runs as root for CAP_SETUID | |
- name: test run-as-user | |
env: | |
TEST_SUBPROC_USER: subproc_user | |
run: | | |
sudo useradd $TEST_SUBPROC_USER | |
sudo go test -v ./pexec -run TestManagedProcessStart | |
- name: Add Coverage PR Comment | |
uses: marocchino/[email protected] | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} |