Skip to content

Commit

Permalink
build: use API extractor to track public API surface (zwave-js#4860)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Aug 4, 2022
1 parent 9122296 commit 458d962
Show file tree
Hide file tree
Showing 34 changed files with 25,706 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ specs/** linguist-vendored

# Use JSONC for syntax highlighting in config files
packages/config/config/**/*.json linguist-language=jsonc

# And API extractor configuration
api-extractor-*.json linguist-language=jsonc
api-extractor.json linguist-language=jsonc
52 changes: 52 additions & 0 deletions .github/workflows/api-surface.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check public API surface

# Run this workflow on all pull requests
on:
pull_request: {}

jobs:
# This job checks if a PR changes the public API surface
check-api-surface:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # This should be LTS

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

- name: Compile TypeScript code
run: yarn run build

- name: Generate API report
run: yarn run extract-api

- name: Show changes
if: failure()
run: |
cat packages/*/.tmp/api.md
- name: Comment on PR
if: failure()
run: |
echo "The public API surface has changed!" >> $GITHUB_STEP_SUMMARY
echo "Please run" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "yarn clean" >> $GITHUB_STEP_SUMMARY
echo "yarn build" >> $GITHUB_STEP_SUMMARY
echo "yarn extract-api --local" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "and review the changes, then commit them if desired." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
"(!test)/cache": true
},
"files.associations": {
"**/config/**/*.json": "jsonc"
"**/config/**/*.json": "jsonc",
"api-extractor-*.json": "jsonc",
"api-extractor.json": "jsonc"
},
"editor.rulers": [72, 80, 120],
"files.participants.timeout": 10000,
Expand Down
Loading

0 comments on commit 458d962

Please sign in to comment.