Skip to content

Commit

Permalink
Run formatting scripts during PR builds (#124)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the copilot-chat repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
brings in the renaming/consolidation changes from #60 and adds the
format scripts to run as part of PR builds.
hopefully one day we will have automated fixing of the formatting
errors, but for now they must be fixed by the developer manually.

### Description
- fixes all formatting errors.
- updates READMEs to use relative links where possible since absolute
links are not caught by `markdown-link-check`.
- github workflows: 
- adds `copilot-format-frontend` which runs `yarn format` to check if
formatting is correct.
- renames `node-pr` to `copilot-build-frontend` and removes the
`find-yarn-projects` job from the workflow.
- removes `copilot-chat-package` in favor of `copilot-build-backend`
since the two workflows seem identical.
also changes `copilot-build-backend` to run `dotnet format`, and also
run when PRs are created.
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [Contribution
Guidelines](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/copilot-chat/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
dehoward authored Aug 8, 2023
1 parent 4b408e8 commit 2913d1d
Show file tree
Hide file tree
Showing 43 changed files with 310 additions and 345 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: copilot-build
name: copilot-build-backend

on:
pull_request:
branches: ["main"]
merge_group:
branches: ["main"]
workflow_call:
outputs:
artifact:
description: "The name of the uploaded artifact."
value: ${{jobs.web-api.outputs.artifact}}
value: ${{jobs.webapi.outputs.artifact}}

permissions:
contents: read

jobs:
web-api:
webapi:
strategy:
fail-fast: false
matrix:
Expand All @@ -33,7 +37,12 @@ jobs:

- name: Package Copilot Chat WebAPI
run: |
deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\deploy
scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy
- name: Check formatting of Copilot Chat WebAPI
run: |
cd webapi/
dotnet format --verify-no-changes --verbosity diagnostic
- name: Set version tag
id: versiontag
Expand All @@ -46,7 +55,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: copilotchat-webapi-${{ steps.versiontag.outputs.versiontag }}
path: ${{ github.workspace }}\deploy\out\webapi.zip
path: ${{ github.workspace }}\scripts\deploy\out\webapi.zip

- name: "Set outputs"
id: artifactoutput
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/copilot-build-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: copilot-build-frontend

on:
workflow_dispatch:
pull_request:
branches: ["main"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
webapp:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: "webapp/yarn.lock"

- name: Run yarn install, yarn build, & yarn format
run: |
#!/bin/bash
set -e # exit with nonzero exit code if anything fails
echo "Running yarn install, yarn build, & yarn format"
yarn install --frozen-lockfile # install dependencies and ensure lockfile is unchanged.
yarn build # run build script
yarn format # run format script
working-directory: webapp
55 changes: 0 additions & 55 deletions .github/workflows/copilot-chat-package.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/copilot-deploy-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:
contents: read

jobs:
web-api:
webapi:
environment: ${{inputs.ENVIRONMENT}}
permissions:
id-token: write
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/copilot-deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: copilot-deploy-backend
name: copilot-deploy-frontend

on:
workflow_call:
Expand All @@ -23,7 +23,7 @@ permissions:
contents: read

jobs:
web-app:
webapp:
environment: ${{inputs.ENVIRONMENT}}
permissions:
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-deploy-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:

jobs:
build:
uses: ./.github/workflows/copilot-build.yml
uses: ./.github/workflows/copilot-build-backend.yml

int:
needs: build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: read

jobs:
test:
e2e:
defaults:
run:
working-directory: webapp
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/node-pr.yml

This file was deleted.

Loading

0 comments on commit 2913d1d

Please sign in to comment.