name: Backend Integration Tests on: push: pull_request: workflow_dispatch: inputs: use-aws: description: 'Run recording tests in AWS EC2 runner' default: 'true' aws-instance-type: description: 'AWS EC2 instance type' default: 'c5.2xlarge' jobs: start-aws-runner: name: Prepare AWS runner runs-on: ov-actions-runner if: ${{ inputs.use-aws != 'false' }} outputs: label: ${{ steps.start-ec2-runner.outputs.label }} ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} steps: - name: Start AWS EC2 Runner id: start-ec2-runner uses: OpenVidu/actions/start-aws-runner@main with: aws-instance-type: ${{ inputs.aws-instance-type || 'c5.2xlarge' }} aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ vars.AWS_REGION }} github-token: ${{ secrets.OPENVIDU_GITHUB_TOKEN }} ec2-image-id: ${{ vars.AWS_GITHUB_ACTIONS_AMI }} subnet-id: ${{ vars.AWS_SUBNET_ID }} security-group-id: ${{ vars.AWS_SECURITY_GROUP_ID }} workflow-name: ${{ github.workflow }} repository-name: ${{ github.repository }} test-rooms: name: Rooms API Tests runs-on: ov-actions-runner strategy: fail-fast: false matrix: storage-provider: [s3, azure] steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main with: pre_startup_commands: | if [ "${{ matrix.storage-provider }}" == "azure" ]; then echo "Using Azure storage provider" # Update egress.yaml to use Azure storage sed -i ' /^[[:space:]]*s3:[[:space:]]*$/,/^[[:space:]]*#azure:[[:space:]]*$/ { /^[[:space:]]*#/!s/^[[:space:]]*/ #/ } /^[[:space:]]*#azure:[[:space:]]*$/,/^[[:space:]]*$/ { s/^[[:space:]]*#[[:space:]]*/ / } ' egress.yaml # Configure Azure storage settings sed -i " s/account_name: your_account_name/account_name: ${{ vars.MEET_AZURE_ACCOUNT_NAME }}/g s/account_key: your_account_key/account_key: ${{ secrets.MEET_AZURE_ACCOUNT_KEY }}/g " egress.yaml fi - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main env: MEET_WEBHOOK_ENABLED: true MEET_PREFERENCES_STORAGE_MODE: ${{ matrix.storage-provider }} MEET_AZURE_ACCOUNT_NAME: ${{ vars.MEET_AZURE_ACCOUNT_NAME }} MEET_AZURE_ACCOUNT_KEY: ${{ secrets.MEET_AZURE_ACCOUNT_KEY }} - name: Run tests run: | cd backend npm run test:integration-rooms env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-recordings: name: Recordings API Tests needs: start-aws-runner if: ${{ always() && (needs.start-aws-runner.result == 'success' || needs.start-aws-runner.result == 'skipped') }} runs-on: ${{ needs.start-aws-runner.outputs.label || 'ov-actions-runner' }} timeout-minutes: 30 steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-recordings env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-webhooks: name: Webhook Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-webhooks env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-security: name: Security API Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-security env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-global-preferences: name: Global Preferences API Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-global-preferences env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-participants: name: Participants API Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-participants env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-meetings: name: Meetings API Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-meetings env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main test-users: name: Users API Tests runs-on: ov-actions-runner steps: - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.13' - name: Install LK CLI run: curl -sSL https://get.livekit.io/cli | bash - name: Setup OpenVidu Local Deployment uses: OpenVidu/actions/start-openvidu-local-deployment@main - name: Setup OpenVidu Meet uses: OpenVidu/actions/start-openvidu-meet@main - name: Run tests run: | cd backend npm run test:integration-users env: JEST_JUNIT_OUTPUT_DIR: './reports/' - name: Publish Test Report uses: mikepenz/action-junit-report@v4 if: always() with: report_paths: '**/reports/junit.xml' fail_on_failure: true require_tests: true - name: Clean up if: always() uses: OpenVidu/actions/cleanup@main stop-runner: name: Stop EC2 runner needs: - start-aws-runner - test-recordings runs-on: ov-actions-runner if: ${{ always() && needs.start-aws-runner.outputs.label != '' }} steps: - name: Stop AWS EC2 Runner id: stop-ec2-runner uses: OpenVidu/actions/stop-aws-runner@main with: aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ vars.AWS_REGION }} github-token: ${{ secrets.OPENVIDU_GITHUB_TOKEN }} label: ${{ needs.start-aws-runner.outputs.label }} ec2-instance-id: ${{ needs.start-aws-runner.outputs.ec2-instance-id }}