ci: preconfigure CI jobs #9
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check code format | |
| permissions: read-all | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| check-format: | |
| runs-on: ubuntu-latest # You can also use 'macos-latest' or 'windows-latest' | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| cache: npm | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run format check | |
| run: npm run check-format | |
| check-docs: | |
| runs-on: ubuntu-latest # You can also use 'macos-latest' or 'windows-latest' | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| cache: npm | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate documents | |
| run: npm run generate-docs | |
| - name: Check if autogenerated docs differ | |
| run: | | |
| diff_file=$(mktemp doc_diff_XXXXXX) | |
| git diff --color > $diff_file | |
| if [[ -s $diff_file ]]; then | |
| echo "Please update the documentation by running 'npm run docs'. The following was the diff" | |
| cat $diff_file | |
| rm $diff_file | |
| exit 1 | |
| fi | |
| rm $diff_file |