-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (52 loc) · 1.77 KB
/
npm.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
name: NPM
on: [push, pull_request]
jobs:
matrix:
name: Determine modified packages
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.modified-packages.outputs.packages }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 300
- name: Commit Range
id: commit-range
uses: tue-robotics/tue-env/ci/commit-range@master
- name: Modified packages
id: modified-packages
uses: tue-robotics/tue-env/ci/modified-packages@master
with:
commit-range: ${{ steps.commit-range.outputs.commit-range }}
ignored-packages: launch old
npm:
name: NPM - ${{ matrix.package }}
runs-on: ubuntu-latest
needs: matrix
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.matrix.outputs.packages) }}
steps:
- uses: actions/checkout@v2
- name: Install
run: |
npm ci --prefix ${{ matrix.package }}
- name: Build
run: |
npm run build --prefix ${{ matrix.package }}
- name: Test
run: |
npm test --prefix ${{ matrix.package }}
- name: Build is up-to-date
run: |
echo -e "\e[1m\e[35mChecking the build folder(dist) is up-to-date with the library\e[0m"
changed_build_files=$(git -C "$(git rev-parse --show-toplevel)" diff --name-only HEAD -- ${{ matrix.package }}/dist)
if [ -n "$changed_build_files" ]
then
echo -e "\e[1m\e[31mBuild folder is out-of-sync with library. Build library, npm run build, and (ammend) commit\e[0m"
echo -e "\e[1m\e[31mChanged files: $changed_build_files"
exit 1
else
echo -e "\e[1m\e[32mBuild folder is up-to-date with library\e[0m"
fi