From 7a0fa729e568d512d8465f2cc7d0f8a94532783f Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 17 Apr 2024 17:04:18 -0700 Subject: [PATCH 01/17] add changelog check --- eng/pipelines/ci-template.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index b25ad4ae2b6..a074cf135b4 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,6 +45,9 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) + - script: npx chronus verify + displayName: Check changelog + - script: pnpm install --no-frozen-lockfile displayName: Pnpm install workingDirectory: $(Build.SourcesDirectory)/autorest.python/ From 00647b864f86790abbeb92eb05715bdb0c583712 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 14:59:32 -0400 Subject: [PATCH 02/17] add chronus verify condition check --- eng/pipelines/ci-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index a074cf135b4..87ee5e67ffa 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -47,6 +47,7 @@ steps: - script: npx chronus verify displayName: Check changelog + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) - script: pnpm install --no-frozen-lockfile displayName: Pnpm install From 465d83baeb92e182219c6dc001bf654f165663ac Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:01:00 -0400 Subject: [PATCH 03/17] add print statement for logs --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 87ee5e67ffa..bb1effb6e8d 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify + - script: npx chronus verify 2>&1; cat /root/.npm/_logs/*-debug displayName: Check changelog condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From 794f48b24fe863df56b8809a168ca52ca27094ff Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:05:20 -0400 Subject: [PATCH 04/17] add working directory for chronus verify --- eng/pipelines/ci-template.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index bb1effb6e8d..2f75d9daed7 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,8 +45,9 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify 2>&1; cat /root/.npm/_logs/*-debug + - script: npx chronus verify displayName: Check changelog + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) - script: pnpm install --no-frozen-lockfile From f8c857865faa41bd3ede16638526588db59b62bf Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:18:45 -0400 Subject: [PATCH 05/17] add back debug log output --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 2f75d9daed7..89651c37bf9 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify + - script: npx chronus verify 2>&1; cat /root/.npm/_logs/*-debug displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From ad68a02405f61d3b9863d45b72198ab38afb8119 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:27:31 -0400 Subject: [PATCH 06/17] fix cat statement --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 89651c37bf9..8b82f1a5ecc 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify 2>&1; cat /root/.npm/_logs/*-debug + - script: npx chronus verify 2>&1; cat /home/cloudtest/.npm/_logs/*-debug displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From a63c48055d09efebb0f9c19a0566572349bab9c6 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:38:43 -0400 Subject: [PATCH 07/17] improve logging by using find --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 8b82f1a5ecc..43cb791baf9 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify 2>&1; cat /home/cloudtest/.npm/_logs/*-debug + - script: npx chronus verify 2>&1 find /home/cloudtest/.npm/_logs/ -type f -name '*debug*' -exec cat {} \; displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From 896968d5a3164af0190ea83383486eeef65518ea Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:43:09 -0400 Subject: [PATCH 08/17] chronus step without logging --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 43cb791baf9..2f75d9daed7 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify 2>&1 find /home/cloudtest/.npm/_logs/ -type f -name '*debug*' -exec cat {} \; + - script: npx chronus verify displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From 5380e686b2d4341e1df67dd16a97631b923b3f70 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:44:33 -0400 Subject: [PATCH 09/17] publish logs --- eng/pipelines/ci-template.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 2f75d9daed7..1a1f4bb121b 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -50,6 +50,9 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) + - publish: /home/cloudtest/.npm/_logs/ + artifact: Logs + - script: pnpm install --no-frozen-lockfile displayName: Pnpm install workingDirectory: $(Build.SourcesDirectory)/autorest.python/ From a47a0454ac883f85e906f2d436d6bfbca87cfe19 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:49:29 -0400 Subject: [PATCH 10/17] continueOnError for npx chronus verify --- eng/pipelines/ci-template.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index 1a1f4bb121b..d4cd019daac 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -49,6 +49,7 @@ steps: displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) + continueOnError: true - publish: /home/cloudtest/.npm/_logs/ artifact: Logs From c4144c3d3493841f197c8e87f340be6f6ad7e183 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:50:22 -0400 Subject: [PATCH 11/17] switch to pnpm chronus instead --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index d4cd019daac..d1d668d615e 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: npx chronus verify + - script: pnpm chronus verify displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From 947fc665a6d3744014d50e356b5f802faf93df26 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 15:59:57 -0400 Subject: [PATCH 12/17] switch to pnpm change --- eng/pipelines/ci-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index d1d668d615e..b8583722d17 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,7 +45,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: pnpm chronus verify + - script: pnpm change verify displayName: Check changelog workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) From 1af79ab5b77e1df956bb272621afa9d43db4b750 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:05:32 -0400 Subject: [PATCH 13/17] switch order until after pnpm install --- eng/pipelines/ci-template.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index b8583722d17..ab30a8842a4 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -45,15 +45,6 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - script: pnpm change verify - displayName: Check changelog - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) - continueOnError: true - - - publish: /home/cloudtest/.npm/_logs/ - artifact: Logs - - script: pnpm install --no-frozen-lockfile displayName: Pnpm install workingDirectory: $(Build.SourcesDirectory)/autorest.python/ @@ -64,6 +55,15 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), eq(${{ parameters.updateToLatestTypespec }}, false)) + - script: pnpm change verify + displayName: Check changelog + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) + continueOnError: true + + - publish: /home/cloudtest/.npm/_logs/ + artifact: Logs + - script: pnpm list displayName: Pnpm list workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python From 18a813dd4490efd31db249289b33c7101a3c55e9 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:07:51 -0400 Subject: [PATCH 14/17] move code checks to workflows --- .github/workflows/consistency.yml | 44 +++++++++++++++++++++++++++++++ eng/pipelines/ci-template.yml | 12 --------- 2 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/consistency.yml diff --git a/.github/workflows/consistency.yml b/.github/workflows/consistency.yml new file mode 100644 index 00000000000..93eff63678a --- /dev/null +++ b/.github/workflows/consistency.yml @@ -0,0 +1,44 @@ +name: Consistency + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: ["main"] + pull_request: + branches: ["main"] + merge_group: + workflow_dispatch: {} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + check-changes: + name: Check Changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 ## Needed for Changesets to find `main` branch + submodules: recursive + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - run: git pull --force --no-tags origin main:main + name: Get main ref + + - run: pnpm install + name: Install dependencies + + - run: pnpm change verify + name: Check changelog + if: ${{ !startsWith(github.head_ref, 'publish/') && !startsWith(github.head_ref, 'dependabot/') && !startsWith(github.head_ref, 'backmerge/') }} + + - run: pnpm check-version-mismatch + name: Check version mismatch + + - run: pnpm lint + name: Lint project + + - run: pnpm check-format + name: Check formatting diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index ab30a8842a4..c5600527837 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -72,18 +72,6 @@ steps: displayName: Build project workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - script: pnpm check-version-mismatch - displayName: Check version mismatch - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pnpm lint - displayName: Lint project - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pnpm check-format - displayName: Check formatting - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - script: pip install -r dev_requirements.txt displayName: Pip install dev requirements workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} From c2f488c7c2bb8c320729d07ba97608bb46e8f27b Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:08:35 -0400 Subject: [PATCH 15/17] add pnpm version --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 025b70a072b..3de735aeed1 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "workspaces": [ "packages/*" ], + "packageManager": "pnpm@8.13.1", "scripts": { "preinstall": "npx only-allow pnpm", "watch": "tsc --build ./tsconfig.ws.json --watch", From 1a1b9823dc6b849ba71d0f28b004dfe25501a4cc Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:13:15 -0400 Subject: [PATCH 16/17] use github token instead of custom github token --- .github/workflows/prepare-auto-release-branch.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/prepare-auto-release-branch.yml b/.github/workflows/prepare-auto-release-branch.yml index 541f17c7b15..8cba349335a 100644 --- a/.github/workflows/prepare-auto-release-branch.yml +++ b/.github/workflows/prepare-auto-release-branch.yml @@ -9,7 +9,6 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} permissions: - pull-requests: write contents: write jobs: @@ -34,4 +33,4 @@ jobs: - name: Create release branch run: node ./eng/publish.mjs env: - GITHUB_TOKEN: ${{secrets.CUSTOM_GITHUB_TOKEN}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From 8f7bcfab86b94b08062a0b21ef9ef82e481cd79d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:13:44 -0400 Subject: [PATCH 17/17] remove logs publish --- eng/pipelines/ci-template.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index c5600527837..962558713d3 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -61,9 +61,6 @@ steps: condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) continueOnError: true - - publish: /home/cloudtest/.npm/_logs/ - artifact: Logs - - script: pnpm list displayName: Pnpm list workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python