From 98e75704a85bfe4a71dd5932c8a2e5f860a09d05 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 24 Jun 2024 11:15:00 -0700 Subject: [PATCH] Define JIT format jobs as GitHub Actions instead of AzDO jobs (#103846) --- .github/workflows/jit-format.yml | 55 ++++++++++++++++ .../common/evaluate-default-paths.yml | 3 - .../coreclr/templates/format-job.yml | 66 ------------------- eng/pipelines/runtime.yml | 21 ------ 4 files changed, 55 insertions(+), 90 deletions(-) create mode 100644 .github/workflows/jit-format.yml delete mode 100644 eng/pipelines/coreclr/templates/format-job.yml diff --git a/.github/workflows/jit-format.yml b/.github/workflows/jit-format.yml new file mode 100644 index 00000000000000..05af0126df0999 --- /dev/null +++ b/.github/workflows/jit-format.yml @@ -0,0 +1,55 @@ +on: + pull_request: + paths: + - 'src/coreclr/jit/**' + branches: [ main ] + +jobs: + format: + strategy: + matrix: + os: + - name: linux + image: ubuntu-latest + container: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-net9.0 + extension: '.sh' + cross: '--cross' + - name: windows + image: windows-latest + extension: '.cmd' + cross: '' + runs-on: ${{ matrix.os.image }} + container: ${{ matrix.os.container }} + steps: + - name: Checkout jitutils + uses: actions/checkout@v4 + with: + path: jitutils + repository: dotnet/jitutils + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + - name: Install .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '8.0.x' + - name: Build jitutils + run: | + cd jitutils + ./bootstrap${{ matrix.os.extension }} + - name: Checkout runtime + uses: actions/checkout@v4 + with: + path: runtime + - name: Install Python + uses: actions/setup-python@v5 + + - name: Run jitformat.py + run: | + python3 runtime/src/coreclr/scripts/jitformat.py --jitutils jitutils -r ${{ github.workspace }}/runtime -o ${{ matrix.os.name }} -a x64 ${{ matrix.os.cross }} + + - name: Publish format.patch + uses: actions/upload-artifact@v2 + with: + path: format.patch + name: format.${{matrix.os.name}}.patch + if: failure() \ No newline at end of file diff --git a/eng/pipelines/common/evaluate-default-paths.yml b/eng/pipelines/common/evaluate-default-paths.yml index 5d9373ea3cb07a..28991920c330d5 100644 --- a/eng/pipelines/common/evaluate-default-paths.yml +++ b/eng/pipelines/common/evaluate-default-paths.yml @@ -202,9 +202,6 @@ jobs: - src/coreclr/jit/* - src/coreclr/pal/* - src/coreclr/vm/* - - subset: coreclr_jit - include: - - src/coreclr/jit/* # # ** WASM ** diff --git a/eng/pipelines/coreclr/templates/format-job.yml b/eng/pipelines/coreclr/templates/format-job.yml deleted file mode 100644 index a4d5181fd6b5b0..00000000000000 --- a/eng/pipelines/coreclr/templates/format-job.yml +++ /dev/null @@ -1,66 +0,0 @@ -parameters: - buildConfig: '' - archType: '' - osGroup: '' - osSubgroup: '' - container: '' - crossBuild: false - timeoutInMinutes: '' - variables: {} - pool: '' - condition: true - -### Format job -jobs: -- template: /eng/pipelines/common/templates/runtimes/xplat-job.yml - parameters: - buildConfig: ${{ parameters.buildConfig }} - archType: ${{ parameters.archType }} - osGroup: ${{ parameters.osGroup }} - osSubgroup: ${{ parameters.osSubgroup }} - container: ${{ parameters.container }} - crossBuild: ${{ parameters.crossBuild }} - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - name: ${{ format('format_{0}{1}_{2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} - displayName: ${{ format('Formatting {0}{1} {2}', parameters.osGroup, parameters.osSubgroup, parameters.archType) }} - helixType: 'format' - pool: ${{ parameters.pool }} - variables: - - template: /eng/pipelines/coreclr/templates/jit-python-variables.yml - parameters: - osGroup: ${{ parameters.osGroup }} - - ${{ each variable in parameters.variables }}: - - ${{insert}}: ${{ variable }} - - - ${{ if eq(parameters.osGroup, 'linux') }}: - - name: LinuxCrossArg - value: '--cross' - - ${{ if ne(parameters.osGroup, 'linux') }}: - - name: LinuxCrossArg - value: '' - - condition: and(succeeded(), ${{ parameters.condition }}) - - steps: - - - task: UseDotNet@2 - # This should match what jitutils YML uses to build. - displayName: 'Install .NET SDK' - inputs: - packageType: 'sdk' - version: '8.x' - installationPath: $(Agent.ToolsDirectory)/dotnet - - - script: $(PythonSetupScript) - displayName: Enable python venv - - - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/jitformat.py -r $(Build.SourcesDirectory) -o $(osGroup) -a $(archType) $(LinuxCrossArg) - displayName: Run jitformat.py - - - task: PublishBuildArtifacts@1 - displayName: Publish format.patch - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/format.patch' - ArtifactName: format.$(osGroup).$(archType).patch - continueOnError: true - condition: failed() diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index cb7aadde9fab6d..0cdcd022a41029 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -442,27 +442,6 @@ extends: eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), eq(variables['isRollingBuild'], true)) - # - # Build CoreCLR Formatting Job - # Only when CoreCLR is changed, and only in the 'main' branch (no release branches; - # both Rolling and PR builds). - # - - template: /eng/pipelines/common/platform-matrix.yml - parameters: - jobTemplate: /eng/pipelines/coreclr/templates/format-job.yml - platforms: - - linux_x64 - - windows_x64 - jobParameters: - condition: >- - and( - or( - eq(variables['Build.SourceBranchName'], 'main'), - eq(variables['System.PullRequest.TargetBranch'], 'main')), - or( - eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr_jit.containsChange'], true), - eq(variables['isRollingBuild'], true))) - # # Build CoreCLR with no R2R #