Skip to content

Commit

Permalink
[docs-infra] Add Danger
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Nov 1, 2024
1 parent 10dde48 commit d744b9e
Show file tree
Hide file tree
Showing 4 changed files with 463 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ commands:
type: boolean
default: false
description: 'Set to true if you intend to use any browser (for example with playwright).'

steps:
- when:
condition: << parameters.browsers >>
Expand All @@ -46,7 +45,6 @@ commands:
name: Install pnpm package manager
# See https://stackoverflow.com/a/73411601
command: corepack enable --install-directory ~/bin

- run:
name: View install environment
command: |
Expand Down Expand Up @@ -133,7 +131,6 @@ jobs:
test_unit:
<<: *default-job

steps:
- checkout
- install_js:
Expand All @@ -154,7 +151,6 @@ jobs:
- image: mcr.microsoft.com/playwright:v1.48.2-focal
environment:
NODE_ENV: test

steps:
- checkout
- install_js:
Expand All @@ -177,7 +173,6 @@ jobs:
environment:
NODE_ENV: test
TOOLPAD_TEST_RETRIES: 1

steps:
- checkout
- install_js:
Expand All @@ -199,6 +194,16 @@ jobs:
path: test/test-results
destination: playwright-test-results

test_bundle_size_monitor:
<<: *default-job
steps:
- checkout
- install_js
- run:
name: Run danger on PRs
command: pnpm danger ci --fail-on-errors
# TODO test bundle size, similar to https://github.com/mui/base-ui/issues/201

workflows:
pipeline:
jobs:
Expand Down Expand Up @@ -228,3 +233,7 @@ workflows:
<<: *default-context
requires:
- checkout
- test_bundle_size_monitor:
<<: *default-context
requires:
- checkout
21 changes: 21 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// danger has to be the first thing required!
import { danger, markdown } from 'danger';

function addDeployPreviewUrls() {
const netlifyPreview = `https://deploy-preview-${danger.github.pr.number}--mui-toolpad-docs.netlify.app/`;

markdown(`
## Netlify deploy preview
${netlifyPreview}
`);
}

async function run() {
addDeployPreviewUrls();
}

run().catch((error) => {
console.error(error);
process.exit(1);
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chalk": "5.3.0",
"concurrently": "9.0.1",
"danger": "^12.3.3",
"eslint": "8.57.1",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "18.0.0",
Expand Down
Loading

0 comments on commit d744b9e

Please sign in to comment.