This repository has been archived by the owner on May 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (56 loc) · 2.27 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: ✏️ lint
on:
workflow_call:
jobs:
lint:
name: ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
matrix:
package: [server, staff, web, ui]
concurrency:
group: ${{ github.workflow }} - ${{ matrix.package }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Calculating Hash
run: |
echo "TURBO_VERSION=$( npm show turbo version )" >> $GITHUB_ENV
echo "NPM_GLOBAL_MODULES=$( npm root -g )" >> $GITHUB_ENV
echo "TURBO_HASH=$( npx --yes turbo run lint --dry --only --filter=@kenthackenough/${{ matrix.package }} | grep = | grep Hash | tail -1 | cut -f2- -d= | xargs )" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Cache - Turbo
id: turbo-cache
with:
path: |
.turbo
${{ github.workspace }}/projects/*/.next/cache
key: cache-turbo-lint-${{ matrix.package }}-${{ hashFiles('package-lock.json') }}-${{ env.TURBO_HASH }}
restore-keys: |
cache-turbo-lint-${{ matrix.package }}-${{ hashFiles('package-lock.json') }}-
- name: Validate Hash
run: |
echo "FULL_TURBO=$( $(find .turbo -iname "${{ env.TURBO_HASH }}-*" | grep ${{ env.TURBO_HASH }}) && echo 'yes' || echo 'no' )" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Cache - NPM
id: npm-cache
with:
path: |
~/.npm
${{ github.workspace }}/node_modules
${{ github.workspace }}/package.json
${{ github.workspace }}/github/scripts/*/node_modules
${{ github.workspace }}/*/*/node_modules
${{ github.workspace }}/*/*/dist
key: cache-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
cache-npm-
- name: Installing Dependencies ${{ env.FULL_TURBO }}
if: ${{ env.FULL_TURBO == 'no' }}
run: npm install --no-audit --no-fund && git restore package-lock.json
- name: Linting
run: npm run lint -- --cache-dir=.turbo --only --filter=@kenthackenough/${{ matrix.package }}