From 2c34eaeaf97d5998f802700ea0a8dd6834a3e904 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 19 Apr 2021 10:39:10 -0500 Subject: [PATCH] devops: better upload flakiness dashboard upload script (#6176) This patch moves some duplicated logic from YAML workflows to the dashboard uploading script. --- .github/workflows/tests.yml | 22 +++++++++++----------- utils/upload_flakiness_dashboard.sh | 10 ++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b1151a7f17..7f17ffb05a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -41,7 +41,7 @@ jobs: - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "ulimit -c unlimited && npm run test -- --tag=${{ matrix.browser }}" - run: node tests/config/checkCoverage.js ${{ matrix.browser }} - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: always() with: @@ -66,7 +66,7 @@ jobs: - run: node lib/cli/cli install-deps ${{ matrix.browser }} chromium - run: npm run test -- --tag=${{ matrix.browser }} - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -94,7 +94,7 @@ jobs: - run: npm run test -- --tag=${{ matrix.browser }} shell: bash - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() shell: bash - uses: actions/upload-artifact@v1 if: ${{ always() }} @@ -147,7 +147,7 @@ jobs: env: HEADFUL: 1 - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -179,7 +179,7 @@ jobs: env: PWTEST_MODE: "${{ matrix.mode }}" - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -211,7 +211,7 @@ jobs: env: PWTEST_VIDEO: 1 - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -240,7 +240,7 @@ jobs: - name: Run tests run: npm run atest -- --shard=${{ matrix.shard }}/2 - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -274,7 +274,7 @@ jobs: env: PWTEST_CHANNEL: "chrome" - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -303,7 +303,7 @@ jobs: env: PWTEST_CHANNEL: "chrome" - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() shell: bash - uses: actions/upload-artifact@v1 if: ${{ always() }} @@ -329,7 +329,7 @@ jobs: env: PWTEST_CHANNEL: "chrome" - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: @@ -383,7 +383,7 @@ jobs: - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- bash -c "ulimit -c unlimited && npm run etest" - run: node tests/config/checkCoverage.js electron - run: ./utils/upload_flakiness_dashboard.sh ./test-results/report.json - if: always() && github.repository == 'microsoft/playwright' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-')) + if: always() - uses: actions/upload-artifact@v1 if: ${{ always() }} with: diff --git a/utils/upload_flakiness_dashboard.sh b/utils/upload_flakiness_dashboard.sh index e522431c4b..caab4cfa37 100755 --- a/utils/upload_flakiness_dashboard.sh +++ b/utils/upload_flakiness_dashboard.sh @@ -27,6 +27,16 @@ if [[ ($1 == '--help') || ($1 == '-h') ]]; then exit 0 fi +if [[ ("${GITHUB_REPOSITORY}" != "microsoft/playwright") && ("${GITHUB_REPOSITORY}" != "microsoft/playwright-internal") ]]; then + echo "NOTE: skipping dashboard uploading from fork" + exit 0 +fi + +if [[ "${GITHUB_REF}" != "refs/heads/master" && "${GITHUB_REF}" != 'refs/heads/release-'* ]]; then + echo "NOTE: skipping dashboard uploading from Playwright branches" + exit 0 +fi + if [[ -z "${FLAKINESS_CONNECTION_STRING}" ]]; then echo "ERROR: \$FLAKINESS_CONNECTION_STRING environment variable is missing." echo " 'Azure Account Name' and 'Azure Account Key' secrets are required"