-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(.github): migrate infra to GHA #33070
Changes from 14 commits
579eb54
fa133c1
2fa5f8f
67910c3
a4bc401
5d556e8
6111131
c12d782
73c01d3
aa99468
e74444e
32715ff
a4e38c7
b2c5856
d159e30
1d6c82b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: 'Run and Publish VR Screenshot' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this pipeline is disabled for now |
||
description: 'Runs and publishes visual regression screenshots' | ||
inputs: | ||
fluentVersion: | ||
description: 'Fluent version' | ||
required: true | ||
default: 'v8' | ||
vrTestPackageName: | ||
description: 'VR test package name' | ||
required: true | ||
default: 'vr-tests' | ||
vrTestPackagePath: | ||
description: 'VR test package path' | ||
required: true | ||
default: 'apps/vr-tests' | ||
locationPrefix: | ||
description: 'Location prefix' | ||
required: true | ||
default: 'fluentuiv8' | ||
locationPostfix: | ||
description: 'Location postfix' | ||
required: true | ||
default: 'vrscreenshotv8' | ||
clientName: | ||
description: 'Client name' | ||
required: true | ||
default: 'fluentuiv8' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: nrwl/nx-set-shas@v4 | ||
with: | ||
main-branch-name: 'master' | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'yarn' | ||
node-version: '20' | ||
|
||
- run: yarn install --frozen-lockfile | ||
shell: bash | ||
|
||
- run: yarn playwright install --with-deps | ||
shell: bash | ||
|
||
- name: Check if vrTests should be skipped | ||
shell: bash | ||
run: | | ||
isPR=${{ github.event_name == 'pull_request' }} | ||
echo "isPR=$isPR" >> $GITHUB_ENV | ||
if [[ $isPR == true ]]; then | ||
packageAffected=$(yarn --silent check:affected --project ${{ inputs.vrTestPackageName }}) | ||
if [[ $packageAffected == false ]]; then | ||
echo "In PR pipeline but NOT affecting test package. Skipping test run" | ||
echo "vrTestSkip=yes" >> $GITHUB_ENV | ||
else | ||
echo "In PR pipeline and affecting test package. NOT Skipping test run" | ||
echo "vrTestSkip=no" >> $GITHUB_ENV | ||
fi | ||
else | ||
echo "Not in PR pipeline. NOT Skipping test run" | ||
echo "vrTestSkip=no" >> $GITHUB_ENV | ||
fi | ||
|
||
- name: Run VR tests | ||
if: ${{ env.vrTestSkip == 'no' }} | ||
shell: bash | ||
run: yarn nx run ${{ inputs.vrTestPackageName }}:test-vr --nxBail | ||
|
||
- name: Collate Artifacts | ||
if: ${{ env.vrTestSkip == 'no' }} | ||
shell: bash | ||
run: | | ||
mkdir -p screenshots | ||
cp -rf ${{ inputs.vrTestPackagePath }}/dist/screenshots/*.png screenshots/ | ||
|
||
- name: Upload VR screenshots | ||
if: ${{ env.vrTestSkip == 'no' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: vrscreenshot${{ inputs.fluentVersion }} | ||
path: screenshots | ||
|
||
- name: VR App - Create Policy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this and next step will fail as vrt doesn't work on GHA yet |
||
if: ${{ env.isPR == 'true' }} | ||
shell: bash | ||
run: | | ||
set -exuo pipefail | ||
npx [email protected] create-policy --nonBlockingPipelines '{"${{ env.pipelineId }}":{"pipelineStatus": "PENDING","pipelineName": "${{ env.pipelineName }}"}}' --clientType 'FLUENTUI' | ||
# env: | ||
# VR_APP_API_URL: ${{ secrets.VR_APP_API_URL }} | ||
# TENANT_ID: ${{ secrets.TenantId }} | ||
# PRINCIPAL_CLIENT_ID: ${{ secrets.PrincipalClientId }} | ||
# SERVICE_CONNECTION_ID: ${{ secrets.ServiceConnectionId }} | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run screenshotdiff | ||
if: ${{ env.isPR == 'true' && env.vrTestSkip == 'no' }} | ||
uses: azure/cli@v2 | ||
env: | ||
# ciDefinitionId is set to 205 because that is the ID of the baseline pipeline (https://uifabric.visualstudio.com/fabricpublic/_build?definitionId=205) used by the master branch | ||
CI_DEFINITION_ID: 205 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. im not sure how this would be actually used in GHA context this is what is availabe: Note: I didn't create separate workflow for baseline as we had on ADO (https://github.com/microsoft/fluentui/blob/master/azure-pipelines.vrt-baseline.yml) to mitigate duplication. |
||
# API_TOKEN: ${{ secrets.fabric-public-pipeline-access-PAT }} | ||
# GITHUB_API_TOKEN: ${{ secrets.githubRepoStatusPAT }} | ||
# VR_APP_API_URL: ${{ secrets.VR_APP_API_URL }} | ||
# STORAGE_ACCOUNT_ID: ${{ secrets.StorageAccountId }} | ||
# TENANT_ID: ${{ secrets.TenantId }} | ||
# PRINCIPAL_CLIENT_ID: ${{ secrets.PrincipalClientId }} | ||
# SERVICE_CONNECTION_ID: ${{ secrets.ServiceConnectionId }} | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
npx [email protected] run-diff --screenshotsDirectory ./screenshots --buildType pr --clientType "FLUENTUI" --ciDefinitionId ${{ env.CI_DEFINITION_ID }} --groupName ${{ env.pipelineName }} --locationPrefix ${{ inputs.locationPrefix }} --locationPostfix ${{ inputs.locationPostfix }} --pipelineId ${{ env.pipelineId }} --clientName ${{ inputs.clientName }} --threshold '0.04' --cumThreshold '1' | ||
|
||
- name: Run screenshotdiff - update baseline (non PR) | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: azure/cli@v2 | ||
# env: | ||
# API_TOKEN: ${{ secrets.fabric-public-pipeline-access-PAT }} | ||
# GITHUB_API_TOKEN: ${{ secrets.githubRepoStatusPAT }} | ||
# VR_APP_API_URL: ${{ secrets.VR_APP_API_URL }} | ||
# STORAGE_ACCOUNT_ID: ${{ secrets.StorageAccountId }} | ||
# TENANT_ID: ${{ secrets.TenantId }} | ||
# PRINCIPAL_CLIENT_ID: ${{ secrets.PrincipalClientId }} | ||
# SERVICE_CONNECTION_ID: ${{ secrets.ServiceConnectionId }} | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
npx [email protected] run-diff --buildType release --screenshotsDirectory ./screenshots --clientType "FLUENTUI" --locationPrefix ${{ inputs.locationPrefix }} --locationPostfix ${{ inputs.locationPostfix }} --pipelineId ${{ env.pipelineId }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Bundle size | Comment on PR | ||
on: | ||
workflow_run: | ||
workflows: ['Bundle size'] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: monosize-report | ||
path: ./results | ||
run_id: ${{ github.event.workflow_run.id }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Load PR number | ||
id: pr_number | ||
run: echo "::set-output name=id::$(cat pr.txt)" | ||
working-directory: ./results | ||
|
||
- name: 'Comment on PR' | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
number: ${{ steps.pr_number.outputs.id }} | ||
path: ./results/monosize-report.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Bundle size | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
concurrency: | ||
# see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
env: | ||
NX_PARALLEL: 6 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM | ||
NX_PREFER_TS_NODE: true | ||
NX_VERBOSE_LOGGING: true | ||
|
||
BROWSERSLIST_IGNORE_OLD_DATA: true | ||
|
||
jobs: | ||
bundle-size: | ||
runs-on: macos-14-xlarge | ||
permissions: | ||
contents: 'read' | ||
actions: 'read' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Derive appropriate SHAs for base and head for `nx affected` commands | ||
uses: nrwl/nx-set-shas@v4 | ||
with: | ||
main-branch-name: 'master' | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
cache: 'yarn' | ||
node-version: '20' | ||
|
||
- run: echo number of CPUs "$(getconf _NPROCESSORS_ONLN)" | ||
|
||
- run: yarn install --frozen-lockfile | ||
|
||
- name: Build packages & create reports (PR only) | ||
if: github.event_name == 'pull_request' | ||
run: yarn nx affected -t bundle-size --nxBail | ||
|
||
- name: Compare bundle size with base (PR only) | ||
if: github.event_name == 'pull_request' | ||
run: npx monosize compare-reports --branch=${{ github.event.pull_request.base.ref }} --output=markdown --quiet > ./monosize-report.md | ||
|
||
- name: Save PR number | ||
run: echo ${{ github.event.number }} > pr.txt | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: ${{ github.event_name == 'pull_request' }} | ||
with: | ||
name: monosize-report | ||
if-no-files-found: error | ||
path: | | ||
monosize-report.md | ||
pr.txt | ||
|
||
# =================================== | ||
# NON PR (MASTER) WORKFLOW STEPS | ||
# =================================== | ||
|
||
- name: Build all packages & create reports (non-PR) | ||
if: github.event_name != 'pull_request' | ||
run: yarn nx run-many -t bundle-size --nxBail | ||
|
||
- name: Login via Azure CLI (non-PR) | ||
if: github.event_name != 'pull_request' | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
||
- name: Upload a report (non-PR) | ||
if: github.event_name != 'pull_request' | ||
uses: azure/cli@v2 | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
yarn monosize upload-report --branch=${{ github.ref }} --commit-sha ${{ github.sha }} | ||
env: | ||
AZCOPY_AUTO_LOGIN_TYPE: 'AZCLI' | ||
SYSTEM_ACCESSTOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BUNDLESIZE_ACCOUNT_NAME: ${{ secrets.BUNDLESIZE_ACCOUNT_NAME }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: VRT CI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this pipeline is disabled for now |
||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
concurrency: | ||
# see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
NX_PARALLEL: 4 # ubuntu-latest = 4-core CPU / 16 GB of RAM | macos-14-xlarge (arm) = 6-core CPU / 14 GB of RAM | ||
NX_PREFER_TS_NODE: true | ||
NX_VERBOSE_LOGGING: true | ||
|
||
permissions: | ||
contents: 'read' | ||
actions: 'read' | ||
|
||
jobs: | ||
web_components: | ||
runs-on: ubuntu-latest | ||
env: | ||
pipelineId: '315' | ||
pipelineName: 'fluent-ui_VRT_Pipeline_web-components' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run and publish VR screenshot | ||
uses: ./.github/actions/run-publish-vr-screenshot | ||
with: | ||
fluentVersion: webcomponents | ||
vrTestPackageName: 'vr-tests-web-components' | ||
vrTestPackagePath: 'apps/vr-tests-web-components' | ||
locationPrefix: 'FluentUI-web-components' | ||
locationPostfix: 'vrscreenshotwebcomponents' | ||
clientName: 'fluentui-web-components-v3' | ||
|
||
react_components: | ||
runs-on: ubuntu-latest | ||
env: | ||
pipelineId: '311' | ||
pipelineName: 'fluent-ui_VRT_Pipeline_v9' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run and publish VR screenshot | ||
uses: ./.github/actions/run-publish-vr-screenshot | ||
with: | ||
fluentVersion: v9 | ||
vrTestPackageName: 'vr-tests-react-components' | ||
vrTestPackagePath: 'apps/vr-tests-react-components' | ||
locationPrefix: 'fluentuiv9' | ||
locationPostfix: 'vrscreenshotv9' | ||
clientName: 'fluentuiv9' | ||
|
||
react: | ||
runs-on: ubuntu-latest | ||
env: | ||
pipelineId: '312' | ||
pipelineName: 'fluent-ui_VRT_Pipeline_v8' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run and publish VR screenshot | ||
uses: ./.github/actions/run-publish-vr-screenshot | ||
with: | ||
fluentVersion: v8 | ||
vrTestPackageName: 'vr-tests' | ||
vrTestPackagePath: 'apps/vr-tests' | ||
locationPrefix: 'fluentuiv8' | ||
locationPostfix: 'vrscreenshotv8' | ||
clientName: 'fluentuiv8' | ||
|
||
react_northstar: | ||
runs-on: ubuntu-latest | ||
env: | ||
pipelineId: '313' | ||
pipelineName: 'fluent-ui_VRT_Pipeline_v0' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run and publish VR screenshot | ||
uses: ./.github/actions/run-publish-vr-screenshot | ||
with: | ||
fluentVersion: v0 | ||
vrTestPackageName: 'docs' | ||
vrTestPackagePath: 'packages/fluentui/docs' | ||
locationPrefix: 'FluentUI-v0' | ||
locationPostfix: 'vrscreenshotv0' | ||
clientName: 'FluentUIV0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
migration of https://github.com/microsoft/fluentui/blob/master/.devops/templates/runpublishvrscreenshot.yml which also mitigates duplication - no need to have separate baseline pipeline https://github.com/microsoft/fluentui/blob/master/azure-pipelines.vrt-baseline.yml