diff --git a/.github/workflows/screener-build.yml b/.github/workflows/screener-build.yml index 376ccc79b78f84..2a4ff5b747cd2e 100644 --- a/.github/workflows/screener-build.yml +++ b/.github/workflows/screener-build.yml @@ -1,20 +1,26 @@ name: Screener build -on: workflow_dispatch +on: + pull_request: + push: + branches: + - master + workflow_dispatch: + +env: + DEPLOYHOST: 'fluentuipr.z22.web.core.windows.net' jobs: environment-upload: 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 @@ -28,14 +34,13 @@ jobs: DEPLOYHOST='fluentuipr.z22.web.core.windows.net' BUILD_BUILDID=${{ github.run_id }} BUILD_SOURCEBRANCH=${{ github.ref }} + SCREENER_BUILD=1 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 @@ -47,22 +52,17 @@ jobs: 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 + DEPLOYBASEPATH=pull/${{github.event.pull_request.number}} + DEPLOYURL=https://${{env.DEPLOYHOST}}/pull/${{github.event.pull_request.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 + DEPLOYBASEPATH=heads/${{github.ref_name}} + DEPLOYURL=https://${{env.DEPLOYHOST}}/heads/${{github.ref_name}} BUILD_SOURCEBRANCHNAME=${{ github.ref_name }} EOT if: ${{!startsWith(github.ref, 'refs/pull/')}} @@ -75,19 +75,24 @@ jobs: screener-react-northstar: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react-northstar - steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Log environment variables (Linux) - if: runner.os == 'Linux' + - name: Download env variables artifact + uses: actions/download-artifact@v3 + with: + name: env-artifact + + - name: Define env variables run: | - printenv | sort ;\ - echo "SHELLOPTS $SHELLOPTS" ;\ + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" - uses: actions/setup-node@v3 with: @@ -97,31 +102,56 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + - run: | + echo "Is PR build? ${{startsWith(github.ref, 'refs/pull/')}}" + packageAffected=$(yarn --silent check:affected-package --packages @fluentui/docs --pr=${{startsWith(github.ref, 'refs/pull/')}}) + if [[ $packageAffected == false ]]; then + echo "Should skip screener" + echo "SKIP_SCREENER_BUILD=true" >> $GITHUB_ENV + else + echo "SKIP_SCREENER_BUILD=false" >> $GITHUB_ENV + echo "Should NOT skip screener" + fi + name: Check if northstar packages were affected + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: build FUI N* VR Test run: yarn workspace @fluentui/docs vr:build env: SCREENER_BUILD: 1 + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} - uses: actions/upload-artifact@v3 with: name: northstar-artifact path: packages/fluentui/docs/dist + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} screener-react: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react - steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Log environment variables (Linux) - if: runner.os == 'Linux' + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: env-artifact + + - name: Define env variables run: | - printenv | sort ;\ - echo "SHELLOPTS $SHELLOPTS" ;\ + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" - uses: actions/setup-node@v3 with: @@ -131,42 +161,86 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + - run: | + echo "Is PR build? ${{startsWith(github.ref, 'refs/pull/')}}" + packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests --pr=${{startsWith(github.ref, 'refs/pull/')}}) + if [[ $packageAffected == false ]]; then + echo "Should skip screener" + echo "SKIP_SCREENER_BUILD=true" >> $GITHUB_ENV + else + echo "SKIP_SCREENER_BUILD=false" >> $GITHUB_ENV + echo "Should NOT skip screener" + fi + name: Check if v8 packages were affected + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: build vr-tests storybook run: yarn workspace @fluentui/vr-tests screener:build + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} - uses: actions/upload-artifact@v3 with: name: screener-artifact path: apps/vr-tests/dist/storybook + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} screener-react-components: runs-on: 'ubuntu-latest' - name: Screener @fluentui/react-components - steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Log environment variables (Linux) - if: runner.os == 'Linux' + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: env-artifact + + - name: Define env variables run: | - printenv | sort ;\ - echo "SHELLOPTS $SHELLOPTS" ;\ + input_file="environment" + while read line + do + echo "$line" >> $GITHUB_ENV + done < "$input_file" - uses: actions/setup-node@v3 with: node-version: 14.18.1 cache: 'yarn' - - name: Install dependencies run: yarn install --frozen-lockfile + - run: | + echo "Is PR build? ${{startsWith(github.ref, 'refs/pull/')}}" + packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests-react-components --pr=${{startsWith(github.ref, 'refs/pull/')}}) + if [[ $packageAffected == false ]]; then + echo "Should skip screener" + echo "SKIP_SCREENER_BUILD=true" >> $GITHUB_ENV + else + echo "SKIP_SCREENER_BUILD=false" >> $GITHUB_ENV + echo "Should NOT skip screener" + fi + name: Check if v9 packages were affected + + - name: Log environment variables (Linux) + if: runner.os == 'Linux' + run: | + printenv | sort ;\ + echo "SHELLOPTS $SHELLOPTS" ;\ + - name: build vr-tests-react-components storybook run: yarn workspace @fluentui/vr-tests-react-components screener:build + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} - uses: actions/upload-artifact@v3 with: name: vnext-artifact path: apps/vr-tests-react-components/dist/storybook + if: ${{env.SKIP_SCREENER_BUILD == 'false'}} diff --git a/.github/workflows/screener-run.yml b/.github/workflows/screener-run.yml index b31c0c86d446c7..6f47b2a401770e 100644 --- a/.github/workflows/screener-run.yml +++ b/.github/workflows/screener-run.yml @@ -5,6 +5,7 @@ on: - Screener build types: - completed + env: AZURE_STORAGE_CONNECTION_STRING: ${{secrets.AZURE_STORAGE_CONNECTION_STRING}} jobs: @@ -30,6 +31,7 @@ jobs: 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" diff --git a/README.md b/README.md index 90f079d86eca7b..3c3ef4995ac908 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ The following table will help you navigate the 3 projects and understand their d [Fluent UI Insights](https://docs.microsoft.com/en-us/shows/fluent-ui-insights?utm_source=github) is a series that describes the design and decisions behind the Fluent UI design system. -| EP01: Positioning | EP02: Styling | -| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---: | +| EP01: Positioning | EP02: Styling | +| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | Watch EP01: Positioning | Watch EP02: Styling | ## Licenses diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7e48c0b8b53987..a68b0f019512df 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -109,198 +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: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/docs --pr) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffectedPR - displayName: Check if northstar packages were affected - condition: eq(variables['isPR'], 'true') - - - script: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/docs) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffected - displayName: Check if northstar packages were affected - condition: eq(variables['isPR'], 'false') - - - script: | - yarn workspace @fluentui/docs vr:build - displayName: build FUI N* VR Test - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - env: - SCREENER_BUILD: 1 - - - task: AzureUpload@2 - displayName: Upload N* VR test site - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - 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: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests --pr) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffectedPR - displayName: Check if v8 packages were affected - condition: eq(variables['isPR'], 'true') - - - script: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffected - displayName: Check if v8 packages were affected - condition: eq(variables['isPR'], 'false') - - - script: | - yarn workspace @fluentui/vr-tests screener:build - displayName: build vr-tests storybook - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - - - task: AzureUpload@2 - displayName: Upload @fluentui/react VR test site - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - 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: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests-react-components --pr) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffectedPR - displayName: Check if v9 packages were affected - condition: eq(variables['isPR'], 'true') - - - script: | - packageAffected=$(yarn --silent check:affected-package --packages @fluentui/vr-tests-react-components) - if [[ $packageAffected == false ]]; then - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]false" - echo "Should skip screener" - else - echo "##vso[task.setvariable variable=IS_ARTIFACT_PRESENT]true" - echo "Should NOT skip screener" - fi - name: PackagesAffected - displayName: Check if v9 packages were affected - condition: eq(variables['isPR'], 'false') - - - script: | - yarn workspace @fluentui/vr-tests-react-components screener:build - displayName: build vr-tests-react-components storybook - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - - - task: AzureUpload@2 - displayName: Upload @fluentui/react-components VR test site - condition: eq(variables['IS_ARTIFACT_PRESENT'], 'true') - 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 90e77ee13bb53e..d5b57a1c9515e7 100644 --- a/scripts/screener/screener.runner.ts +++ b/scripts/screener/screener.runner.ts @@ -68,7 +68,7 @@ async function scheduleScreenerBuild( if (response.status !== 201 && response.status !== 200) { throw new Error(`Call to proxy failed: ${response.status}`); } - //conclusion of the screener run + return response.json() as ScheduleScreenerBuildResponse; } @@ -111,4 +111,9 @@ export async function screenerRunner(screenerConfig: ScreenerRunnerConfig) { console.log('Screener test in progress.'); return; } + + if (screenerRun.conclusion === 'cancelled') { + console.log('Screener test cancelled.'); + return; + } }