|
1 | 1 | name: CI
|
2 |
| -on: [push, pull_request] |
| 2 | +on: workflow_call |
| 3 | +permissions: {} |
3 | 4 | jobs:
|
4 | 5 | lint:
|
5 | 6 | name: Lint source files
|
6 | 7 | runs-on: ubuntu-latest
|
| 8 | + permissions: |
| 9 | + contents: read # for actions/checkout |
7 | 10 | steps:
|
8 | 11 | - name: Checkout repo
|
9 |
| - uses: actions/checkout@v2 |
| 12 | + uses: actions/checkout@v3 |
| 13 | + with: |
| 14 | + persist-credentials: false |
10 | 15 |
|
11 | 16 | - name: Setup Node.js
|
12 |
| - uses: actions/setup-node@v1 |
13 |
| - |
14 |
| - - name: Cache Node.js modules |
15 |
| - uses: actions/cache@v2 |
| 17 | + uses: actions/setup-node@v3 |
16 | 18 | with:
|
17 |
| - path: ~/.npm |
18 |
| - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} |
19 |
| - restore-keys: | |
20 |
| - ${{ runner.OS }}-node- |
| 19 | + cache: npm |
| 20 | + node-version-file: '.node-version' |
21 | 21 |
|
22 | 22 | - name: Install Dependencies
|
23 |
| - run: npm ci |
| 23 | + run: npm ci --ignore-scripts |
| 24 | + |
| 25 | + - name: Lint ESLint |
| 26 | + run: npm run lint |
24 | 27 |
|
25 | 28 | - name: Check Types
|
26 | 29 | run: npm run check
|
27 | 30 |
|
28 | 31 | - name: Lint Prettier
|
29 | 32 | run: npm run prettier:check
|
30 | 33 |
|
31 |
| - - name: Build package |
32 |
| - run: npm run build:all |
33 |
| - shell: bash |
| 34 | + - name: Spellcheck |
| 35 | + run: npm run check:spelling |
| 36 | + |
| 37 | + - name: Lint GitHub Actions |
| 38 | + uses: docker://rhysd/actionlint:latest |
| 39 | + with: |
| 40 | + args: -color |
| 41 | + |
| 42 | + checkForCommonlyIgnoredFiles: |
| 43 | + name: Check for commonly ignored files |
| 44 | + runs-on: ubuntu-latest |
| 45 | + permissions: |
| 46 | + contents: read # for actions/checkout |
| 47 | + steps: |
| 48 | + - name: Checkout repo |
| 49 | + uses: actions/checkout@v3 |
| 50 | + with: |
| 51 | + persist-credentials: false |
| 52 | + |
| 53 | + - name: Check if commit contains files that should be ignored |
| 54 | + run: | |
| 55 | + git clone --depth 1 https://github.com/github/gitignore.git |
| 56 | +
|
| 57 | + rm gitignore/Global/ModelSim.gitignore |
| 58 | + rm gitignore/Global/Images.gitignore |
| 59 | + rm gitignore/Global/VirtualEnv.gitignore |
| 60 | + cat gitignore/Node.gitignore gitignore/Global/*.gitignore > all.gitignore |
| 61 | +
|
| 62 | + IGNORED_FILES=$(git ls-files --cached --ignored --exclude-from=all.gitignore) |
| 63 | + if [[ "$IGNORED_FILES" != "" ]]; then |
| 64 | + echo -e "::error::Please remove these files:\n$IGNORED_FILES" | sed -z 's/\n/%0A/g' |
| 65 | + exit 1 |
| 66 | + fi |
| 67 | +
|
| 68 | + checkPackageLock: |
| 69 | + name: Check health of package-lock.json file |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + contents: read # for actions/checkout |
| 73 | + steps: |
| 74 | + - name: Checkout repo |
| 75 | + uses: actions/checkout@v3 |
| 76 | + with: |
| 77 | + persist-credentials: false |
| 78 | + |
| 79 | + - name: Setup Node.js |
| 80 | + uses: actions/setup-node@v3 |
| 81 | + with: |
| 82 | + cache: npm |
| 83 | + node-version-file: '.node-version' |
| 84 | + |
| 85 | + - name: Install Dependencies |
| 86 | + run: npm ci --ignore-scripts |
| 87 | + |
| 88 | + - name: Check that package-lock.json doesn't have conflicts |
| 89 | + run: npm ls --depth 999 |
| 90 | + |
| 91 | + - name: Run npm install |
| 92 | + run: npm install --ignore-scripts --force --package-lock-only --engine-strict --strict-peer-deps |
| 93 | + |
| 94 | + - name: Check that package-lock.json is in sync with package.json |
| 95 | + run: git diff --exit-code package-lock.json |
| 96 | + |
| 97 | + codeql: |
| 98 | + name: Run CodeQL security scan |
| 99 | + runs-on: ubuntu-latest |
| 100 | + permissions: |
| 101 | + contents: read # for actions/checkout |
| 102 | + security-events: write # for codeql-action |
| 103 | + steps: |
| 104 | + - name: Checkout repo |
| 105 | + uses: actions/checkout@v3 |
| 106 | + with: |
| 107 | + persist-credentials: false |
| 108 | + |
| 109 | + - name: Initialize CodeQL |
| 110 | + uses: github/codeql-action/init@v2 |
| 111 | + with: |
| 112 | + languages: 'javascript, typescript' |
| 113 | + |
| 114 | + - name: Perform CodeQL analysis |
| 115 | + uses: github/codeql-action/analyze@v2 |
| 116 | + |
| 117 | + buildRelease: |
| 118 | + name: Build release |
| 119 | + runs-on: ubuntu-latest |
| 120 | + permissions: |
| 121 | + contents: read # for actions/checkout |
| 122 | + steps: |
| 123 | + - name: Checkout repo |
| 124 | + uses: actions/checkout@v3 |
| 125 | + with: |
| 126 | + persist-credentials: false |
| 127 | + |
| 128 | + - name: Setup Node.js |
| 129 | + uses: actions/setup-node@v3 |
| 130 | + with: |
| 131 | + cache: npm |
| 132 | + node-version-file: '.node-version' |
| 133 | + |
| 134 | + - name: Install Dependencies |
| 135 | + run: npm ci --ignore-scripts |
| 136 | + |
| 137 | + - name: Build release |
| 138 | + run: npm run build |
0 commit comments