From 090e9f1dfa75d54807566edd3e3b03612d782722 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Wed, 27 Jul 2022 15:18:18 +0300 Subject: [PATCH 01/15] Add screener workflows --- .github/workflows/screener-build.yml | 162 ++++++++++++++++++++++++ .github/workflows/screener-run.yml | 177 +++++++++++++++++++++++++++ 2 files changed, 339 insertions(+) create mode 100644 .github/workflows/screener-build.yml create mode 100644 .github/workflows/screener-run.yml diff --git a/.github/workflows/screener-build.yml b/.github/workflows/screener-build.yml new file mode 100644 index 00000000000000..e3bafe22ce5054 --- /dev/null +++ b/.github/workflows/screener-build.yml @@ -0,0 +1,162 @@ +name: Screener build + +on: workflow_dispatch + +jobs: + TestJob: + runs-on: ubuntu-latest + steps: + - run: echo "Hello there" + + EnvironmentUpload: + runs-on: ubuntu-latest + steps: + - run: mkdir artifacts + + ########################################### + # BROWSERSLIST_IGNORE_OLD_DATA = Prevents failures on CI when "caniuse-lite" becomes outdated + # DEPLOYHOST = address of host for screener tests deployment + # BUILD_BUILDID = unique ID of the workflow run within the repo + # BUILD_SOURCEBRANCH = branch that triggered the workflow -> refs/pull//merge + ########################################### + + - name: Set base env variables + run: | + cat <> artifacts/environment + BROWSERSLIST_IGNORE_OLD_DATA=true + DEPLOYHOST='fluentuipr.z22.web.core.windows.net' + BUILD_BUILDID=${{ github.run_id }} + BUILD_SOURCEBRANCH=${{ github.ref }} + EOT + ########################################### + # SYSTEM_PULLREQUEST_TARGETBRANCH = target branch name + # SYSTEM_PULLREQUEST_SOURCEBRANCH = source branch name + # SYSTEM_PULLREQUEST_PULLREQUESTID = ID of the PR + # SYSTEM_PULLREQUEST_SOURCECOMMITID = commit SHA of PR + # ISPR = true if workflow triggered by PR + # DEPLOYBASEPATH = path for deploy URL -> pull/ for PRs + # DEPLOYURL= address for tests deployment, uses DEPLOYHOST and DEPLOYBASEPATH + # BUILD_SOURCEBRANCHNAME = 'merge' for PRs + ########################################### + + - name: Set env variables if there is a PR + run: | + cat <> artifacts/environment + SYSTEM_PULLREQUEST_TARGETBRANCH=${{ github.event.pull_request.base.ref }} + SYSTEM_PULLREQUEST_SOURCEBRANCH=${{ github.event.pull_request.head.ref }} + SYSTEM_PULLREQUEST_PULLREQUESTID=${{ github.event.pull_request.id }} + SYSTEM_PULLREQUEST_SOURCECOMMITID=${{ github.event.pull_request.head.sha }} + ISPR=true + DEPLOYBASEPATH=pull/$PR_NUMBER + DEPLOYURL=https://$DEPLOYHOST/pull/$PR_NUMBER + BUILD_SOURCEBRANCHNAME='merge' , + EOT + env: + DEPLOYHOST: 'fluentuipr.z22.web.core.windows.net' + PR_NUMBER: ${{ github.event.number }} + if: ${{startsWith(github.ref, 'refs/pull/')}} + + - name: Set env variables if there is not a PR + run: | + cat <> artifacts/environment + ISPR=false + DEPLOYBASEPATH=heads/$SYSTEM_PULLREQUEST_TARGETBRANCH + DEPLOYURL=https://$DEPLOYHOST/heads/$SYSTEM_PULLREQUEST_TARGETBRANCH + BUILD_SOURCEBRANCHNAME=${{ github.ref_name }} + EOT + if: ${{!startsWith(github.ref, 'refs/pull/')}} + + - name: Upload environment variables artifact + uses: actions/upload-artifact@v3 + with: + name: env-artifact + path: artifacts/environment + + ScreenerNorthStar: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react-northstar + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - name: build FUI N* VR Test + run: yarn workspace @fluentui/docs vr:build + env: + SCREENER_BUILD: 1 + + - uses: actions/upload-artifact@v3 + with: + name: northstar-artifact + path: packages/fluentui/docs/dist + + Screener: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - name: build vr-tests storybook + run: yarn workspace @fluentui/vr-tests screener:build + + - uses: actions/upload-artifact@v3 + with: + name: screener-artifact + path: apps/vr-tests/dist/storybook + + ScreenerVNext: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react-components + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - name: build vr-tests-react-components storybook + run: yarn workspace @fluentui/vr-tests-react-components screener:build + + - uses: actions/upload-artifact@v3 + with: + name: vnext-artifact + path: apps/vr-tests-react-components/dist/storybook diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml new file mode 100644 index 00000000000000..5ab061af1017b7 --- /dev/null +++ b/.github/workflows/screener-run.yml @@ -0,0 +1,177 @@ +name: Screeners workflow + +on: workflow_dispatch + +env: + AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING}} + +jobs: + TestJob: + runs-on: ubuntu-latest + steps: + - run: echo "Hello there" + + ScreenerNorthStar: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react-northstar + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: env-artifact + + - name: Define env variables + run: | + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: Download N* storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: northstar-artifact + # downloads artifact to where it would be 'built' + path: packages/fluentui/docs/dist + + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - name: Upload N* VR test site + uses: azure/CLI@v1 + with: + inlineScript: | + az storage blob upload-batch -d '$web/${{env.DEPLOYBASEPATH}}/react-northstar-screener' -s 'packages/fluentui/docs/dist' --overwrite + - name: Start @fluentui/react-northstar VR Test + run: yarn workspace @fluentui/docs vr:test + env: + SCREENER_ENDPOINT: ${{secrets.SCREENER_ENDPOINT}} + SCREENER_PROXY_ENDPOINT: ${{secrets.SCREENER_PROXY_ENDPOINT}} + SCREENER_API_KEY: ${{secrets.SCREENER_API_KEY}} + + Screener: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: env-artifact + + - name: Define env variables + run: | + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: Download screener storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: screener-artifact + path: apps/vr-tests/dist/storybook + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - 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 + - name: Start @fluentui/react VR Test + run: yarn workspace @fluentui/vr-tests screener + env: + SCREENER_ENDPOINT: ${{secrets.SCREENER_ENDPOINT}} + SCREENER_PROXY_ENDPOINT: ${{secrets.SCREENER_PROXY_ENDPOINT}} + SCREENER_API_KEY: ${{secrets.SCREENER_API_KEY}} + + ScreenerVNext: + runs-on: 'ubuntu-latest' + + name: Screener @fluentui/react-components + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + + - name: Download artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: env-artifact + + - name: Define env variables + run: | + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: Download VNext storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: vnext-artifact + path: apps/vr-tests-react-components/dist/storybook + + - name: yarn + run: ./yarn-ci.sh + shell: bash + + - name: Upload @fluentui/react-components VR test site + uses: azure/CLI@v1 + with: + inlineScript: | + az storage blob upload-batch -d '$web/${{env.DEPLOYBASEPATH}}/react-components-screener' -s 'apps/vr-tests-react-components/dist/storybook' --overwrite + - name: Start @fluentui/react-components VR Test + run: yarn workspace @fluentui/vr-tests-react-components screener + env: + SCREENER_ENDPOINT: ${{secrets.SCREENER_ENDPOINT}} + SCREENER_PROXY_ENDPOINT: ${{secrets.SCREENER_PROXY_ENDPOINT}} + SCREENER_API_KEY: ${{secrets.SCREENER_API_KEY}} From a9a8f47ce8386aa54a51183b2257dac9b27872aa Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Wed, 27 Jul 2022 15:51:07 +0300 Subject: [PATCH 02/15] Remove screener jobs from pipeline --- azure-pipelines.yml | 111 ---------------------------- scripts/screener/screener.runner.ts | 6 +- 2 files changed, 5 insertions(+), 112 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dfc6b50d7f678f..a68b0f019512df 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,114 +109,3 @@ jobs: displayName: Cypress E2E tests - template: .devops/templates/cleanup.yml - - - job: ScreenerNorthstar - displayName: Screener @fluentui/react-northstar - workspace: - clean: all - steps: - - template: .devops/templates/tools.yml - - - task: Bash@3 - inputs: - filePath: yarn-ci.sh - displayName: yarn - - - script: | - yarn workspace @fluentui/docs vr:build - displayName: build FUI N* VR Test - env: - SCREENER_BUILD: 1 - - - task: AzureUpload@2 - displayName: Upload N* VR test site - inputs: - azureSubscription: $(azureSubscription) - BlobPrefix: $(deployBasePath)/react-northstar-screener - CacheControl: 'public, max-age=600000' - ContainerName: '$web' - SourcePath: 'packages/fluentui/docs/dist' - storage: $(azureStorage) - - - script: yarn workspace @fluentui/docs vr:test - displayName: Start @fluentui/react-northstar VR Test - env: - SCREENER_ENDPOINT: $(screenerApiUri) - SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) - SCREENER_API_KEY: $(screener.key) - - - template: .devops/templates/cleanup.yml - - - job: Screener - displayName: Screener @fluentui/react - workspace: - clean: all - steps: - - template: .devops/templates/tools.yml - - - task: Bash@3 - inputs: - filePath: yarn-ci.sh - displayName: yarn - - - script: | - yarn workspace @fluentui/vr-tests screener:build - displayName: build vr-tests storybook - - - task: AzureUpload@2 - displayName: Upload @fluentui/react VR test site - inputs: - azureSubscription: $(azureSubscription) - BlobPrefix: $(deployBasePath)/react-screener - CacheControl: 'public, max-age=600000' - ContainerName: '$web' - SourcePath: 'apps/vr-tests/dist/storybook' - storage: $(azureStorage) - - # Don't use lage here because it eats long output for reasons that are hard to debug - - script: | - yarn workspace @fluentui/vr-tests screener - displayName: Start @fluentui/react VR Test - env: - SCREENER_ENDPOINT: $(screenerApiUri) - SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) - SCREENER_API_KEY: $(screener.key) - - - template: .devops/templates/cleanup.yml - - - job: ScreenerVNext - displayName: Screener @fluentui/react-components - workspace: - clean: all - steps: - - template: .devops/templates/tools.yml - - - task: Bash@3 - inputs: - filePath: yarn-ci.sh - displayName: yarn - - - script: | - yarn workspace @fluentui/vr-tests-react-components screener:build - displayName: build vr-tests-react-components storybook - - - task: AzureUpload@2 - displayName: Upload @fluentui/react-components VR test site - inputs: - azureSubscription: $(azureSubscription) - BlobPrefix: $(deployBasePath)/react-components-screener - CacheControl: 'public, max-age=600000' - ContainerName: '$web' - SourcePath: 'apps/vr-tests-react-components/dist/storybook' - storage: $(azureStorage) - - # Don't use lage here because it eats long output for reasons that are hard to debug - - script: | - yarn workspace @fluentui/vr-tests-react-components screener - displayName: Start @fluentui/react-components VR Test - env: - SCREENER_ENDPOINT: $(screenerApiUri) - SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) - SCREENER_API_KEY: $(screener.key) - - - template: .devops/templates/cleanup.yml diff --git a/scripts/screener/screener.runner.ts b/scripts/screener/screener.runner.ts index 4503003b34d800..ed4c3c0c6f9211 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -81,11 +81,15 @@ async function scheduleScreenerBuild( } async function notifyIntegration(payload: ScreenerProxyPayload) { - await fetch(environment.screener.proxyUri, { + const res = await fetch(`${environment.screener.proxyUri}/api/ci`, { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), }); + + if (res.status !== 200) { + throw new Error(`Notify integration failed: ${res.status}`); + } } export async function screenerRunner(screenerConfig: ScreenerRunnerConfig) { From 924bbd234fd189812b61dcc27c2fc73b2a34b9d4 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Wed, 27 Jul 2022 16:16:31 +0300 Subject: [PATCH 03/15] Additional documentation --- .github/workflows/screener-build.yml | 18 ++++++---- .github/workflows/screener-run.yml | 54 ++++++++++++++-------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/.github/workflows/screener-build.yml b/.github/workflows/screener-build.yml index e3bafe22ce5054..2e015938d94c57 100644 --- a/.github/workflows/screener-build.yml +++ b/.github/workflows/screener-build.yml @@ -3,23 +3,24 @@ name: Screener build on: workflow_dispatch jobs: - TestJob: - runs-on: ubuntu-latest - steps: - - run: echo "Hello there" - EnvironmentUpload: runs-on: ubuntu-latest steps: - run: mkdir artifacts + ########################################### + # Environment variables are passed as an artifact so that the run workflow + # can download and access them. There are two workflows used- `screener-build.yml` + # and `screener-run.yml` so that the screener checks can also be triggered by + # pull requests from forks. Note: This is a temporary change. + ########################################### + ########################################### # BROWSERSLIST_IGNORE_OLD_DATA = Prevents failures on CI when "caniuse-lite" becomes outdated # DEPLOYHOST = address of host for screener tests deployment # BUILD_BUILDID = unique ID of the workflow run within the repo # BUILD_SOURCEBRANCH = branch that triggered the workflow -> refs/pull//merge ########################################### - - name: Set base env variables run: | cat <> artifacts/environment @@ -28,6 +29,7 @@ jobs: BUILD_BUILDID=${{ github.run_id }} BUILD_SOURCEBRANCH=${{ github.ref }} EOT + ########################################### # SYSTEM_PULLREQUEST_TARGETBRANCH = target branch name # SYSTEM_PULLREQUEST_SOURCEBRANCH = source branch name @@ -38,7 +40,6 @@ jobs: # DEPLOYURL= address for tests deployment, uses DEPLOYHOST and DEPLOYBASEPATH # BUILD_SOURCEBRANCHNAME = 'merge' for PRs ########################################### - - name: Set env variables if there is a PR run: | cat <> artifacts/environment @@ -89,6 +90,7 @@ jobs: run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn run: ./yarn-ci.sh shell: bash @@ -120,6 +122,7 @@ jobs: run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn run: ./yarn-ci.sh shell: bash @@ -149,6 +152,7 @@ jobs: run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ + - name: yarn run: ./yarn-ci.sh shell: bash diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 5ab061af1017b7..4364296dac6e5f 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -6,11 +6,6 @@ env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING}} jobs: - TestJob: - runs-on: ubuntu-latest - steps: - - run: echo "Hello there" - ScreenerNorthStar: runs-on: 'ubuntu-latest' @@ -30,6 +25,15 @@ jobs: workflow_conclusion: success name: env-artifact + - name: Download N* storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: northstar-artifact + # downloads artifact to where it would be 'built' + path: packages/fluentui/docs/dist + - name: Define env variables run: | input_file="environment" @@ -42,14 +46,6 @@ jobs: run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: Download N* storybook artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: screener-build.yml - workflow_conclusion: success - name: northstar-artifact - # downloads artifact to where it would be 'built' - path: packages/fluentui/docs/dist - name: yarn run: ./yarn-ci.sh @@ -86,6 +82,14 @@ jobs: workflow_conclusion: success name: env-artifact + - name: Download screener storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: screener-artifact + path: apps/vr-tests/dist/storybook + - name: Define env variables run: | input_file="environment" @@ -98,13 +102,7 @@ jobs: run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: Download screener storybook artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: screener-build.yml - workflow_conclusion: success - name: screener-artifact - path: apps/vr-tests/dist/storybook + - name: yarn run: ./yarn-ci.sh shell: bash @@ -140,6 +138,14 @@ jobs: workflow_conclusion: success name: env-artifact + - name: Download VNext storybook artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: screener-build.yml + workflow_conclusion: success + name: vnext-artifact + path: apps/vr-tests-react-components/dist/storybook + - name: Define env variables run: | input_file="environment" @@ -147,18 +153,12 @@ jobs: do echo "$line" >> $GITHUB_ENV done < "$input_file" + - name: Log environment variables (Linux) if: runner.os == 'Linux' run: | printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: Download VNext storybook artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: screener-build.yml - workflow_conclusion: success - name: vnext-artifact - path: apps/vr-tests-react-components/dist/storybook - name: yarn run: ./yarn-ci.sh From 8974b1276b13b207cd73528342918caf52d50ce0 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Wed, 27 Jul 2022 17:19:53 +0300 Subject: [PATCH 04/15] Add checkout action option --- .github/workflows/screener-build.yml | 6 ++++++ .github/workflows/screener-run.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/screener-build.yml b/.github/workflows/screener-build.yml index 2e015938d94c57..ef0cbe0f0a60b5 100644 --- a/.github/workflows/screener-build.yml +++ b/.github/workflows/screener-build.yml @@ -80,6 +80,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: @@ -112,6 +114,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: @@ -142,6 +146,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 4364296dac6e5f..9ab6423c59cfde 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -13,6 +13,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: @@ -70,6 +72,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: @@ -126,6 +130,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: From 2a371d06307cc2a2302ae6b9c6507c55ef66bbaf Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Thu, 28 Jul 2022 09:53:14 +0300 Subject: [PATCH 05/15] Make changes suggested in PR review --- .github/workflows/screener-run.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 9ab6423c59cfde..b0f3d0aa26b27d 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -1,6 +1,11 @@ -name: Screeners workflow - -on: workflow_dispatch +name: Screeners run + +on: + workflow_run: + workflows: + - Screener build + types: + - completed env: AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING}} From 8ea283b82043472e809a41c268f48ddd186f152f Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Thu, 28 Jul 2022 10:58:06 +0300 Subject: [PATCH 06/15] Add change suggested by review --- .github/workflows/screener-run.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index b0f3d0aa26b27d..95361fdf7fa381 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -25,7 +25,7 @@ jobs: with: node-version: 14.18.1 - - name: Download artifact + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: workflow: screener-build.yml @@ -84,7 +84,7 @@ jobs: with: node-version: 14.18.1 - - name: Download artifact + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: workflow: screener-build.yml @@ -142,7 +142,7 @@ jobs: with: node-version: 14.18.1 - - name: Download artifact + - name: Download environment variables artifact uses: dawidd6/action-download-artifact@v2 with: workflow: screener-build.yml From 8cd922d2715ff9e9545df80f51c2fe14a10ad624 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Thu, 28 Jul 2022 11:18:34 +0300 Subject: [PATCH 07/15] Restore pipeline from master branch --- azure-pipelines.yml | 111 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a68b0f019512df..dfc6b50d7f678f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,3 +109,114 @@ jobs: displayName: Cypress E2E tests - template: .devops/templates/cleanup.yml + + - job: ScreenerNorthstar + displayName: Screener @fluentui/react-northstar + workspace: + clean: all + steps: + - template: .devops/templates/tools.yml + + - task: Bash@3 + inputs: + filePath: yarn-ci.sh + displayName: yarn + + - script: | + yarn workspace @fluentui/docs vr:build + displayName: build FUI N* VR Test + env: + SCREENER_BUILD: 1 + + - task: AzureUpload@2 + displayName: Upload N* VR test site + inputs: + azureSubscription: $(azureSubscription) + BlobPrefix: $(deployBasePath)/react-northstar-screener + CacheControl: 'public, max-age=600000' + ContainerName: '$web' + SourcePath: 'packages/fluentui/docs/dist' + storage: $(azureStorage) + + - script: yarn workspace @fluentui/docs vr:test + displayName: Start @fluentui/react-northstar VR Test + env: + SCREENER_ENDPOINT: $(screenerApiUri) + SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) + SCREENER_API_KEY: $(screener.key) + + - template: .devops/templates/cleanup.yml + + - job: Screener + displayName: Screener @fluentui/react + workspace: + clean: all + steps: + - template: .devops/templates/tools.yml + + - task: Bash@3 + inputs: + filePath: yarn-ci.sh + displayName: yarn + + - script: | + yarn workspace @fluentui/vr-tests screener:build + displayName: build vr-tests storybook + + - task: AzureUpload@2 + displayName: Upload @fluentui/react VR test site + inputs: + azureSubscription: $(azureSubscription) + BlobPrefix: $(deployBasePath)/react-screener + CacheControl: 'public, max-age=600000' + ContainerName: '$web' + SourcePath: 'apps/vr-tests/dist/storybook' + storage: $(azureStorage) + + # Don't use lage here because it eats long output for reasons that are hard to debug + - script: | + yarn workspace @fluentui/vr-tests screener + displayName: Start @fluentui/react VR Test + env: + SCREENER_ENDPOINT: $(screenerApiUri) + SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) + SCREENER_API_KEY: $(screener.key) + + - template: .devops/templates/cleanup.yml + + - job: ScreenerVNext + displayName: Screener @fluentui/react-components + workspace: + clean: all + steps: + - template: .devops/templates/tools.yml + + - task: Bash@3 + inputs: + filePath: yarn-ci.sh + displayName: yarn + + - script: | + yarn workspace @fluentui/vr-tests-react-components screener:build + displayName: build vr-tests-react-components storybook + + - task: AzureUpload@2 + displayName: Upload @fluentui/react-components VR test site + inputs: + azureSubscription: $(azureSubscription) + BlobPrefix: $(deployBasePath)/react-components-screener + CacheControl: 'public, max-age=600000' + ContainerName: '$web' + SourcePath: 'apps/vr-tests-react-components/dist/storybook' + storage: $(azureStorage) + + # Don't use lage here because it eats long output for reasons that are hard to debug + - script: | + yarn workspace @fluentui/vr-tests-react-components screener + displayName: Start @fluentui/react-components VR Test + env: + SCREENER_ENDPOINT: $(screenerApiUri) + SCREENER_PROXY_ENDPOINT: $(screenerProxyUri) + SCREENER_API_KEY: $(screener.key) + + - template: .devops/templates/cleanup.yml From 1cc92238612d66b6b204dd5f9eb7ca200dfc0d81 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Thu, 28 Jul 2022 11:19:54 +0300 Subject: [PATCH 08/15] Restore fetch path from master branch --- scripts/screener/screener.runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/screener/screener.runner.ts b/scripts/screener/screener.runner.ts index ed4c3c0c6f9211..2d15c909e99758 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -81,7 +81,7 @@ async function scheduleScreenerBuild( } async function notifyIntegration(payload: ScreenerProxyPayload) { - const res = await fetch(`${environment.screener.proxyUri}/api/ci`, { + const res = await fetch(environment.screener.proxyUri, { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), From 9304e1d2517cbb853fca7bc772415485b6f798ba Mon Sep 17 00:00:00 2001 From: Raluca Pelin <72383559+ralucapelin@users.noreply.github.com> Date: Thu, 28 Jul 2022 15:26:32 +0300 Subject: [PATCH 09/15] Update step name Co-authored-by: ling1726 --- .github/workflows/screener-run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 95361fdf7fa381..46da2bf6bab983 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -1,4 +1,4 @@ -name: Screeners run +name: Screener run on: workflow_run: From 05814f9c0b28974fa0055045fdc6d1b5ab1e58fe Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Thu, 28 Jul 2022 16:29:04 +0300 Subject: [PATCH 10/15] Make changes proposed in review --- .github/workflows/screener-build.yml | 14 +++++++------- .github/workflows/screener-run.yml | 14 +++++++------- scripts/screener/screener.runner.ts | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/screener-build.yml b/.github/workflows/screener-build.yml index ef0cbe0f0a60b5..3657fed5e5df93 100644 --- a/.github/workflows/screener-build.yml +++ b/.github/workflows/screener-build.yml @@ -3,7 +3,7 @@ name: Screener build on: workflow_dispatch jobs: - EnvironmentUpload: + environment-upload: runs-on: ubuntu-latest steps: - run: mkdir artifacts @@ -73,7 +73,7 @@ jobs: name: env-artifact path: artifacts/environment - ScreenerNorthStar: + screener-react-northstar: runs-on: 'ubuntu-latest' name: Screener @fluentui/react-northstar @@ -93,7 +93,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash @@ -107,7 +107,7 @@ jobs: name: northstar-artifact path: packages/fluentui/docs/dist - Screener: + screener-react: runs-on: 'ubuntu-latest' name: Screener @fluentui/react @@ -127,7 +127,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash @@ -139,7 +139,7 @@ jobs: name: screener-artifact path: apps/vr-tests/dist/storybook - ScreenerVNext: + screener-react-components: runs-on: 'ubuntu-latest' name: Screener @fluentui/react-components @@ -159,7 +159,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index 95361fdf7fa381..392de4336561a1 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -8,10 +8,10 @@ on: - completed env: - AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING}} + AZURE_STORAGE_CONNECTION_STRING: ${{secrets.AZURE_STORAGE_CONNECTION_STRING}} jobs: - ScreenerNorthStar: + screener-react-northstar: runs-on: 'ubuntu-latest' name: Screener @fluentui/react-northstar @@ -54,7 +54,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash @@ -70,7 +70,7 @@ jobs: SCREENER_PROXY_ENDPOINT: ${{secrets.SCREENER_PROXY_ENDPOINT}} SCREENER_API_KEY: ${{secrets.SCREENER_API_KEY}} - Screener: + screener-react: runs-on: 'ubuntu-latest' name: Screener @fluentui/react @@ -112,7 +112,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash @@ -128,7 +128,7 @@ jobs: SCREENER_PROXY_ENDPOINT: ${{secrets.SCREENER_PROXY_ENDPOINT}} SCREENER_API_KEY: ${{secrets.SCREENER_API_KEY}} - ScreenerVNext: + screener-react-components: runs-on: 'ubuntu-latest' name: Screener @fluentui/react-components @@ -171,7 +171,7 @@ jobs: printenv | sort ;\ echo "SHELLOPTS $SHELLOPTS" ;\ - - name: yarn + - name: yarn (install packages) run: ./yarn-ci.sh shell: bash diff --git a/scripts/screener/screener.runner.ts b/scripts/screener/screener.runner.ts index 2d15c909e99758..8303007dcbc039 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -81,14 +81,14 @@ async function scheduleScreenerBuild( } async function notifyIntegration(payload: ScreenerProxyPayload) { - const res = await fetch(environment.screener.proxyUri, { + const fetchResponse = await fetch(environment.screener.proxyUri, { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), }); - if (res.status !== 200) { - throw new Error(`Notify integration failed: ${res.status}`); + if (fetchResponse.status !== 200) { + throw new Error(`Notify integration failed: ${fetchResponse.status}`); } } From cf3001da20c66610ca383bf121975f62c1f8d003 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Mon, 1 Aug 2022 13:41:59 +0300 Subject: [PATCH 11/15] Add comments regarding possible changes --- apps/vr-tests/screener.config.js | 1 + scripts/screener/screener.config.js | 2 +- scripts/screener/screener.runner.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/vr-tests/screener.config.js b/apps/vr-tests/screener.config.js index e09461d0f3bfb3..ce19360cf662a4 100644 --- a/apps/vr-tests/screener.config.js +++ b/apps/vr-tests/screener.config.js @@ -41,6 +41,7 @@ const config = { baseBranch, failureExitCode: 0, alwaysAcceptBaseBranch: true, + //isPR ...(process.env.BUILD_SOURCEBRANCH && process.env.BUILD_SOURCEBRANCH.indexOf('refs/pull') > -1 ? { commit: getCurrentHash() } : null), diff --git a/scripts/screener/screener.config.js b/scripts/screener/screener.config.js index 599016792c851b..47ce034fd9f314 100644 --- a/scripts/screener/screener.config.js +++ b/scripts/screener/screener.config.js @@ -56,7 +56,7 @@ module.exports = { alwaysAcceptBaseBranch: true, baseBranch, failureExitCode: 0, - + //isPR ...(sourceBranch && sourceBranch.indexOf('refs/pull') > -1 ? { commit: getCurrentHash(), diff --git a/scripts/screener/screener.runner.ts b/scripts/screener/screener.runner.ts index 8303007dcbc039..cacd338784446e 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -98,6 +98,7 @@ export async function screenerRunner(screenerConfig: ScreenerRunnerConfig) { // https://github.com/screener-io/screener-runner/blob/2a8291fb1b0219c96c8428ea6644678b0763a1a1/src/ci.js#L101 let branchName = process.env.SYSTEM_PULLREQUEST_SOURCEBRANCH || process.env.BUILD_SOURCEBRANCHNAME; // remove prefix if exists + //when does the prefix exist? if (branchName.indexOf('refs/heads/') === 0) { branchName = branchName.replace('refs/heads/', ''); } From ced3938864f514a1f92dcdb7729f5f9b6cf44870 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Mon, 1 Aug 2022 14:23:30 +0300 Subject: [PATCH 12/15] Change config option condition --- apps/vr-tests/screener.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/vr-tests/screener.config.js b/apps/vr-tests/screener.config.js index ce19360cf662a4..e3a09ec42f23f1 100644 --- a/apps/vr-tests/screener.config.js +++ b/apps/vr-tests/screener.config.js @@ -42,9 +42,7 @@ const config = { failureExitCode: 0, alwaysAcceptBaseBranch: true, //isPR - ...(process.env.BUILD_SOURCEBRANCH && process.env.BUILD_SOURCEBRANCH.indexOf('refs/pull') > -1 - ? { commit: getCurrentHash() } - : null), + ...(process.env.BUILD_SOURCEBRANCHNAME === 'merge' ? { commit: getCurrentHash() } : null), baseUrl: `${process.env.DEPLOYURL}/react-screener/iframe.html`, }; console.log('Screener config: ' + JSON.stringify({ ...config, apiKey: '...' }, null, 2)); From 694a5427dceebd2a1217b7ab3663043047fff986 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Mon, 1 Aug 2022 16:00:12 +0300 Subject: [PATCH 13/15] Remove unnecessary check --- apps/vr-tests/screener.config.js | 1 - scripts/screener/screener.config.js | 5 ++--- scripts/screener/screener.runner.ts | 5 ----- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/vr-tests/screener.config.js b/apps/vr-tests/screener.config.js index e3a09ec42f23f1..685ad2801293a1 100644 --- a/apps/vr-tests/screener.config.js +++ b/apps/vr-tests/screener.config.js @@ -41,7 +41,6 @@ const config = { baseBranch, failureExitCode: 0, alwaysAcceptBaseBranch: true, - //isPR ...(process.env.BUILD_SOURCEBRANCHNAME === 'merge' ? { commit: getCurrentHash() } : null), baseUrl: `${process.env.DEPLOYURL}/react-screener/iframe.html`, }; diff --git a/scripts/screener/screener.config.js b/scripts/screener/screener.config.js index 47ce034fd9f314..541c74c085950b 100644 --- a/scripts/screener/screener.config.js +++ b/scripts/screener/screener.config.js @@ -32,7 +32,7 @@ require('tsconfig-paths').register({ }); const baseBranch = 'master'; -const sourceBranch = process.env.BUILD_SOURCEBRANCH; +const sourceBranchName = process.env.BUILD_SOURCEBRANCHNAME; // https://github.com/screener-io/screener-runner module.exports = { @@ -56,8 +56,7 @@ module.exports = { alwaysAcceptBaseBranch: true, baseBranch, failureExitCode: 0, - //isPR - ...(sourceBranch && sourceBranch.indexOf('refs/pull') > -1 + ...(sourceBranchName === 'merge' ? { commit: getCurrentHash(), } diff --git a/scripts/screener/screener.runner.ts b/scripts/screener/screener.runner.ts index cacd338784446e..509f746ec8cf09 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -97,11 +97,6 @@ export async function screenerRunner(screenerConfig: ScreenerRunnerConfig) { const commit = process.env.SYSTEM_PULLREQUEST_SOURCECOMMITID; // https://github.com/screener-io/screener-runner/blob/2a8291fb1b0219c96c8428ea6644678b0763a1a1/src/ci.js#L101 let branchName = process.env.SYSTEM_PULLREQUEST_SOURCEBRANCH || process.env.BUILD_SOURCEBRANCHNAME; - // remove prefix if exists - //when does the prefix exist? - if (branchName.indexOf('refs/heads/') === 0) { - branchName = branchName.replace('refs/heads/', ''); - } const checkUrl = await scheduleScreenerBuild(screenerConfig, { build: process.env.BUILD_BUILDID, From 8c84f3a569fca337153f738e3f30b3871f30dd09 Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Wed, 3 Aug 2022 10:54:06 +0300 Subject: [PATCH 14/15] Change isPrBuild conditions --- apps/vr-tests-react-components/screener.config.js | 4 +--- scripts/gulp/tasks/screener.ts | 2 +- scripts/tasks/screener.ts | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/vr-tests-react-components/screener.config.js b/apps/vr-tests-react-components/screener.config.js index 5908be77592792..b0b87ea558774c 100644 --- a/apps/vr-tests-react-components/screener.config.js +++ b/apps/vr-tests-react-components/screener.config.js @@ -41,9 +41,7 @@ const config = { baseBranch, failureExitCode: 0, alwaysAcceptBaseBranch: true, - ...(process.env.BUILD_SOURCEBRANCH && process.env.BUILD_SOURCEBRANCH.indexOf('refs/pull') > -1 - ? { commit: getCurrentHash() } - : null), + ...(process.env.BUILD_SOURCEBRANCHNAME === 'merge' ? { commit: getCurrentHash() } : null), baseUrl: `${process.env.DEPLOYURL}/react-components-screener/iframe.html`, }; console.log('Screener config: ' + JSON.stringify({ ...config, apiKey: '...' }, null, 2)); diff --git a/scripts/gulp/tasks/screener.ts b/scripts/gulp/tasks/screener.ts index 08f45429a46710..60635483369f03 100644 --- a/scripts/gulp/tasks/screener.ts +++ b/scripts/gulp/tasks/screener.ts @@ -38,7 +38,7 @@ task('screener:runner', cb => { const screenerConfig = require(screenerConfigPath); let affectedPackages = new Set(); - const isPrBuild = process.env.BUILD_SOURCEBRANCH && process.env.BUILD_SOURCEBRANCH.includes('refs/pull'); + const isPrBuild = process.env.BUILD_SOURCEBRANCHNAME === 'merge'; if (isPrBuild) { affectedPackages = getAffectedPackages(); diff --git a/scripts/tasks/screener.ts b/scripts/tasks/screener.ts index 1404f8fabd60fb..4c2407a6a1c02e 100644 --- a/scripts/tasks/screener.ts +++ b/scripts/tasks/screener.ts @@ -21,7 +21,7 @@ export async function screener() { const packagePath = path.relative(findGitRoot(), process.cwd()); const affectedPackageInfo = Object.values(packageInfos).find(x => x.packagePath === packagePath); let affectedPackages = new Set(); - const isPrBuild = process.env.BUILD_SOURCEBRANCH && process.env.BUILD_SOURCEBRANCH.includes('refs/pull'); + const isPrBuild = process.env.BUILD_SOURCEBRANCHNAME === 'merge'; if (isPrBuild) { affectedPackages = getAffectedPackages(); From 455e2d0275bfe929e289c65bab97d1eb578608df Mon Sep 17 00:00:00 2001 From: Raluca Pelin Date: Mon, 8 Aug 2022 11:38:18 +0300 Subject: [PATCH 15/15] Change branch variable definition --- apps/vr-tests-react-components/screener.config.js | 4 +--- apps/vr-tests/screener.config.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/vr-tests-react-components/screener.config.js b/apps/vr-tests-react-components/screener.config.js index b0b87ea558774c..d7a07eafdbcee4 100644 --- a/apps/vr-tests-react-components/screener.config.js +++ b/apps/vr-tests-react-components/screener.config.js @@ -27,9 +27,7 @@ function getCurrentHash() { return ''; } -const baseBranch = process.env.SYSTEM_PULLREQUEST_TARGETBRANCH - ? process.env.SYSTEM_PULLREQUEST_TARGETBRANCH.replace(/^refs\/heads\//, '') - : 'master'; +const baseBranch = process.env.SYSTEM_PULLREQUEST_TARGETBRANCH; // https://github.com/screener-io/screener-storybook#additional-configuration-options const config = { diff --git a/apps/vr-tests/screener.config.js b/apps/vr-tests/screener.config.js index 685ad2801293a1..8f5a357642ee69 100644 --- a/apps/vr-tests/screener.config.js +++ b/apps/vr-tests/screener.config.js @@ -27,9 +27,7 @@ function getCurrentHash() { return ''; } -const baseBranch = process.env.SYSTEM_PULLREQUEST_TARGETBRANCH - ? process.env.SYSTEM_PULLREQUEST_TARGETBRANCH.replace(/^refs\/heads\//, '') - : 'master'; +const baseBranch = process.env.SYSTEM_PULLREQUEST_TARGETBRANCH; // https://github.com/screener-io/screener-storybook#additional-configuration-options const config = {