test in the same job #29
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: TestDriver.ai | |
on: | |
push: | |
branches: ["main", "windows-testdriver"] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
start_container: | |
runs-on: ubuntu-latest | |
outputs: | |
app_url: ${{ steps.expose.outputs.app_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run Nginx Container | |
run: docker run -d -p 8080:80 nginx:latest | |
- name: Setup ngrok (or similar) | |
id: expose | |
run: | | |
curl -L https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz -o ngrok.tgz | |
tar xvzf ngrok.tgz | |
./ngrok authtoken ${{ secrets.NGROK_AUTH_TOKEN }} | |
./ngrok http 8080 > ngrok.log & | |
sleep 20 | |
APP_URL=$(curl --silent http://127.0.0.1:4040/api/tunnels | jq -r .tunnels[0].public_url) | |
echo "Generated URL: $APP_URL" | |
echo "app_url=$APP_URL" >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
- name: Debug ngrok logs | |
run: cat ngrok.log | |
- name: Test Against URL | |
run: | | |
# Since we are still in the same job, ngrok is still running | |
curl "$APP_URL/health-check" | |
# test_url: | |
# name: "Test URL" | |
# runs-on: ubuntu-latest | |
# needs: [start_container] | |
# steps: | |
# - run: | | |
# echo "Received URL: ${{needs.start_container.outputs.app_url}}" | |
# if [ -z "${{needs.start_container.outputs.app_url}}" ]; then | |
# echo "Error: URL is empty" | |
# exit 1 | |
# fi | |
# curl "${{needs.start_container.outputs.app_url}}/health-check" | |
# test: | |
# name: "TestDriver" | |
# runs-on: ubuntu-latest | |
# needs: [start_container] | |
# steps: | |
# - uses: testdriverai/action@main | |
# with: | |
# key: ${{secrets.TESTDRIVER_API_KEY}} | |
# prompt: | | |
# 1. check if the app is running. | |
# prerun: | | |
# Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "--load-extension=$(pwd)/node_modules/dashcam-chrome/build", "${{ needs.start_container.outputs.app_url }}" | |
# exit | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# FORCE_COLOR: "3" |