-
Notifications
You must be signed in to change notification settings - Fork 1.1k
58 lines (56 loc) · 1.89 KB
/
dependency-check.yaml
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
name: MacawUI migration
on: [pull_request]
jobs:
current_state:
runs-on: ubuntu-latest
name: "Calculate current state"
outputs:
main_statistics: ${{ steps.store_import_stats.outputs.MAIN_STATISTICS }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install deps
run: |
npm ci
- name: Store import stats
id: store_import_stats
run: |
stats=$(npx depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info")
echo "Statistics on main branch: ${stats}"
echo "MAIN_STATISTICS=${stats}" >> $GITHUB_OUTPUT
check_migation_status:
runs-on: ubuntu-latest
name: "Migration check"
needs: current_state
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install deps
run: |
npm ci
- name: "Calculate stats"
env:
latest: ${{ needs.current_state.outputs.main_statistics }}
run: |
current=$(npx depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info")
difference=$(( $current - $latest ))
echo "Imports in main: ${latest}"
echo "Incomming imports: ${current}"
echo "Difference: ${difference}"
echo "IMPORT_DIFFERENCE=${difference}" >> $GITHUB_ENV
- name: "MacawUI regression reported"
if: ${{ env.IMPORT_DIFFERENCE > 0 }}
run: |
echo "Regression detected: +${{ env.IMPORT_DIFFERENCE }} imports"
exit 1
- name: "MacawUI migration progress"
if: ${{ env.IMPORT_DIFFERENCE <= 0 }}
run: |
echo "Progress by: ${{ env.IMPORT_DIFFERENCE }} imports"
exit 0