From 8f600419e2ab90dd2c0c604732942a2998028130 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Fri, 26 Aug 2022 14:48:07 +0300 Subject: [PATCH] Update screener-run.yml workflow --- .github/workflows/screener-run.yml | 69 ++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 3eb31b69fae017..b31c0c86d446c7 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -1,25 +1,19 @@ name: Screener run - on: workflow_run: workflows: - Screener build types: - completed - env: AZURE_STORAGE_CONNECTION_STRING: ${{secrets.AZURE_STORAGE_CONNECTION_STRING}} - jobs: screener-react-northstar: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react-northstar - steps: - uses: actions/checkout@v3 with: - ref: ${{github.event.workflow_run.head_branch}} fetch-depth: 0 - uses: actions/setup-node@v3 @@ -27,6 +21,21 @@ jobs: node-version: 14.18.1 cache: 'yarn' + - name: Check if test app artifact deployed + uses: actions/github-script@v6 + id: skip-screener + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "northstar-artifact" + })[0]; + core.exportVariable('IS_ARTIFACT_PRESENT', (matchArtifact !== undefined).toString()); + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: @@ -42,6 +51,7 @@ jobs: name: northstar-artifact # downloads artifact to where it would be 'built' path: packages/fluentui/docs/dist + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} - name: Define env variables run: | @@ -50,6 +60,7 @@ jobs: do echo "$line" >> $GITHUB_ENV done < "$input_file" + - name: Log environment variables (Linux) if: runner.os == 'Linux' run: | @@ -64,6 +75,8 @@ jobs: with: inlineScript: | az storage blob upload-batch -d '$web/${{env.DEPLOYBASEPATH}}/react-northstar-screener' -s 'packages/fluentui/docs/dist' --overwrite + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} + - name: Start @fluentui/react-northstar VR Test run: yarn workspace @fluentui/docs vr:test env: @@ -73,13 +86,10 @@ jobs: screener-react: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react - steps: - uses: actions/checkout@v3 with: - ref: ${{github.event.workflow_run.head_branch}} fetch-depth: 0 - uses: actions/setup-node@v3 @@ -87,6 +97,21 @@ jobs: node-version: 14.18.1 cache: 'yarn' + - name: Check if test app artifact deployed + uses: actions/github-script@v6 + id: skip-screener + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "screener-artifact" + })[0]; + core.exportVariable('IS_ARTIFACT_PRESENT', (matchArtifact !== undefined).toString()); + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: @@ -101,6 +126,7 @@ jobs: workflow_conclusion: success name: screener-artifact path: apps/vr-tests/dist/storybook + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} - name: Define env variables run: | @@ -109,6 +135,7 @@ jobs: do echo "$line" >> $GITHUB_ENV done < "$input_file" + - name: Log environment variables (Linux) if: runner.os == 'Linux' run: | @@ -117,12 +144,13 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - - name: Upload @fluentui/react VR test site uses: azure/CLI@v1 with: inlineScript: | az storage blob upload-batch -d '$web/${{env.DEPLOYBASEPATH}}/react-screener' -s 'apps/vr-tests/dist/storybook' --overwrite + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} + - name: Start @fluentui/react VR Test run: yarn workspace @fluentui/vr-tests screener env: @@ -132,13 +160,10 @@ jobs: screener-react-components: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react-components - steps: - uses: actions/checkout@v3 with: - ref: ${{github.event.workflow_run.head_branch}} fetch-depth: 0 - uses: actions/setup-node@v3 @@ -146,6 +171,21 @@ jobs: node-version: 14.18.1 cache: 'yarn' + - name: Check if test app artifact deployed + uses: actions/github-script@v6 + id: skip-screener + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "vnext-artifact" + })[0]; + core.exportVariable('IS_ARTIFACT_PRESENT', (matchArtifact !== undefined).toString()); + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: @@ -160,6 +200,7 @@ jobs: workflow_conclusion: success name: vnext-artifact path: apps/vr-tests-react-components/dist/storybook + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} - name: Define env variables run: | @@ -183,6 +224,8 @@ jobs: with: inlineScript: | az storage blob upload-batch -d '$web/${{env.DEPLOYBASEPATH}}/react-components-screener' -s 'apps/vr-tests-react-components/dist/storybook' --overwrite + if: ${{ env.IS_ARTIFACT_PRESENT == 'true' }} + - name: Start @fluentui/react-components VR Test run: yarn workspace @fluentui/vr-tests-react-components screener env: