Skip to content

Commit

Permalink
ci: Run prettier in repo-policy-check pipeline (#14703)
Browse files Browse the repository at this point in the history
There's a gap in our prettier coverage in CI. If you edit a file in the
root, or, say, the `scripts` folder, it won't trigger a CI job that
includes prettier. The reason is that the client release group pipeline
is responsible for running prettier on the root files, but it's not
triggered by edits outside the client release group/pipeline.

There is a CI pipeline that runs on every PR: repo-policy-check. I fixed
this by adding a step to that pipeline that runs `npm run
prettier:root`. I also added pnpm store caching to the repo-policy-check
job and removed the layer-check and policy-check from the client
pipeline since those checks are repo-wide and done already in
repo-policy-check.
  • Loading branch information
tylerbutler authored Mar 22, 2023
1 parent 030265a commit 713cbc1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 0 additions & 2 deletions tools/pipelines/build-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ extends:
- ci:test:stress:tinylicious
- test:copyresults
checks:
- policy-check
- layer-check
- syncpack:deps
- syncpack:versions
- prettier
36 changes: 33 additions & 3 deletions tools/pipelines/repo-policy-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,39 @@ pool:
variables:
- name: skipComponentGovernanceDetection
value: true
- name: pnpmStorePath
value: $(Pipeline.Workspace)/.pnpm-store

steps:
- task: UseNode@1
displayName: Use Node 16.x
inputs:
version: 16.x

- task: Cache@2
displayName: Cache pnpm store
inputs:
# Caches are already scoped to individual pipelines, so no need to include the release group name or tag
# in the cache key
key: 'pnpm-store | "$(Agent.OS)" | pnpm-lock.yaml'
path: ${{ variables.pnpmStorePath }}
restoreKeys: |
pnpm-store | "$(Agent.OS)"
- task: Bash@3
displayName: Install root dependencies
displayName: Install and configure pnpm
inputs:
targetType: 'inline'
workingDirectory: .
script: |
# Install pnpm globally
npm i -g pnpm
pnpm config set store-dir $(pnpmStorePath)
- task: Bash@3
displayName: Install root dependencies
inputs:
targetType: 'inline'
workingDirectory: .
script: |
# We only want to install the root package deps, so we set recursive-install to false
pnpm config set recursive-install false
pnpm install --frozen-lockfile
Expand All @@ -52,3 +69,16 @@ steps:
inputs:
command: 'custom'
customCommand: 'run layer-check'

- task: Npm@1
displayName: npm run prettier:root
inputs:
command: 'custom'
customCommand: 'run prettier:root'

- task: Bash@3
displayName: Prune pnpm store
inputs:
targetType: 'inline'
script: |
pnpm store prune

0 comments on commit 713cbc1

Please sign in to comment.