From 18a813dd4490efd31db249289b33c7101a3c55e9 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 6 May 2024 16:07:51 -0400 Subject: [PATCH] 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}}