TestDriver - Self Hosted #3
This file contains hidden or 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: TestDriver - Self Hosted | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test_file: | |
| - testdriver/installation/programmatic_installation_existing_user.yaml | |
| - testdriver/installation/desktop_app_installation_new_user_exe.yaml | |
| - testdriver/installation/desktop_app_installation_new_user_msix.yaml | |
| - testdriver/installation/desktop_app_installation_new_user_winget.yaml | |
| steps: | |
| - name: Checkout the repo to access the test files | |
| uses: actions/checkout@v4 | |
| - name: Setup AWS Instance | |
| id: aws-setup | |
| run: | | |
| OUTPUT=$(./testdriver/setup/aws/spawn-runner.sh | tee /dev/stderr) # Capture and display output | |
| echo "$OUTPUT" | |
| PUBLIC_IP=$(echo "$OUTPUT" | grep "PUBLIC_IP=" | cut -d'=' -f2) | |
| INSTANCE_ID=$(echo "$OUTPUT" | grep "INSTANCE_ID=" | cut -d'=' -f2) | |
| AWS_REGION=$(echo "$OUTPUT" | grep "AWS_REGION=" | cut -d'=' -f2) | |
| echo "public-ip=$PUBLIC_IP" >> $GITHUB_OUTPUT | |
| echo "instance-id=$INSTANCE_ID" >> $GITHUB_OUTPUT | |
| echo "aws-region=$AWS_REGION" >> $GITHUB_OUTPUT | |
| env: | |
| FORCE_COLOR: 3 | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: us-east-2 | |
| AWS_LAUNCH_TEMPLATE_ID: lt-07668bebfe24120a1 | |
| AMI_ID: ami-0cfbe7384533fb8c4 | |
| RESOLUTION_WIDTH: 1920 | |
| RESOLUTION_HEIGHT: 1080 | |
| - name: Run TestDriver | |
| run: npx testdriverai@latest run ${{ matrix.test_file }} --ip="${{ steps.aws-setup.outputs.public-ip }}" | |
| env: | |
| TD_API_KEY: ${{ secrets.TD_API_KEY }} | |
| TD_WEBSITE: https://testdriver-sandbox.vercel.app | |
| TD_THIS_FILE: ${{ matrix.test_file }} | |
| - name: Upload TestDriver AI CLI logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: testdriverai-cli-logs-${{ matrix.test_file }} | |
| path: /tmp/testdriverai-cli-*.log | |
| if-no-files-found: warn | |
| retention-days: 30 | |
| - name: Upload test results as artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.test_file }} | |
| path: out.xml | |
| retention-days: 30 | |
| - name: Shutdown AWS Instance | |
| if: always() | |
| run: aws ec2 terminate-instances --region "$AWS_REGION" --instance-ids "$INSTANCE_ID" | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: ${{ steps.aws-setup.outputs.aws-region }} | |
| INSTANCE_ID: ${{ steps.aws-setup.outputs.instance-id }} |