-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (146 loc) · 5.69 KB
/
node.js.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Node.js CI
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./mdm-explorer # Only applies to `run` steps
steps:
- uses: actions/checkout@v4
with:
path: ./mdm-explorer
- name: Install and configure
uses: actions/setup-node@v4
with:
node-version: '16.10.0'
- name: Install tools
run: |
npm i -g [email protected]
npm i -g @angular/cli@14
npm i -g symlinked
npm i -g npm-check
- name: Check tool versions
run: |
node --version
npm --version
- name: Clean install dependencies
run: |
npm config set registry https://registry.npmjs.org/
npm install
#########
# Link a local copy of mdm-resources
#########
- name: Checkout mdm-resources
if: success() && github.ref != 'refs/heads/main'
# working-directory: ./mdm-resources
uses: actions/checkout@v4
with:
repository: MauroDataMapper/mdm-resources
ref: refs/heads/develop # change this to test against another branch
path: ./mdm-resources
- name: Build mdm-resources
if: success() && github.ref != 'refs/heads/main'
working-directory: ./mdm-resources
run: |
npm install
npm run build
npm link
#########
# Link a local copy of sde-resources
#########
- name: Checkout sde-resources
if: success() && github.ref != 'refs/heads/main'
# working-directory: ./sde-resources
uses: actions/checkout@v4
with:
repository: MauroDataMapper/sde-resources
ref: refs/heads/develop # change this to test against another branch
path: ./sde-resources
# Add a token, since this is still a private repo
token: ${{ secrets.ACCESS_TOKEN }}
- name: Build sde-resources
if: success() && github.ref != 'refs/heads/main'
working-directory: ./sde-resources
run: |
npm install
ng build sde-resources
cd dist/sde-resources
npm link
# Back in the (default) mdm-explorer directory
- name: Link mdm-resources
if: success() && github.ref != 'refs/heads/main'
run: |
npm link @maurodatamapper/mdm-resources @maurodatamapper/sde-resources
- name: Report links
run: symlinked names
- name: License header check
run: npm run license-check check
- name: Run tests
run: npm run test-with-coverage-serial
- name: Report Test results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
working-directory: ./mdm-explorer
name: Test Results
path: 'test-report/junit.xml'
reporter: java-junit
# Can't successfully get Megalinter to run in another folder.
# Disable it and use the native eslint instead
#- name: MegaLinter
# uses: oxsecurity/megalinter/flavors/[email protected]
# env:
# # All available variables are described in documentation
# # https://megalinter.io/configuration/
# VALIDATE_ALL_CODEBASE: true
# ENABLE_LINTERS: TYPESCRIPT_ES
# LINTER_RULES_PATH: '.eslintrc.json' # This is the default anyway
# DISABLE_ERRORS: true #Flag to have the linter complete with exit code 0 even if errors were detected.
# SARIF_REPORTER: true
# GITHUB_STATUS_REPORTER: true
# GITHUB_COMMENT_REPORTER: true
# MARKDOWN_SUMMARY_REPORTER: true
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#- name: Upload MegaLinter scan results to GitHub Security tab
# if: ${{ success() }} || ${{ failure() }}
# uses: github/codeql-action/upload-sarif@v3
# with:
# checkout_path: ./mdm-explorer
# sarif_file: 'megalinter-reports/megalinter-report.sarif'
- name: Run ESLint
run: npm run eslint-junit || true # Always succeed, even with linting errors
- name: Report ESLint results
uses: dorny/test-reporter@v1
if: success() || failure()
with:
working-directory: ./mdm-explorer
name: ESLint Results
path: 'eslint/eslint-junit.xml'
reporter: java-junit
fail-on-error: false
- name: Build distribution with original theme
run: npm run dist
- name: Archive distribution artifacts
if: success() && ( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' )
run: |
cd dist ; \
for i in mdm-explorer-*.tgz; do \
echo Uploading $i... ; \
curl -X PUT -H "X-Generate-Checksums: true" -u ${{secrets.MAURO_SNAPSHOT_REPOSITORY_USERNAME}}:${{secrets.MAURO_SNAPSHOT_REPOSITORY_PASSWORD}} -T $i https://mauro-repository.com/artifacts-snapshots/mauroDataMapper/mdm-explorer/$i ; \
done
- name: Send a stream message
if: success() || failure()
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: "[email protected]"
organization-url: "https://maurodatamapper.zulipchat.com"
to: "build/github-actions"
type: "stream"
topic: "${{github.repository}}"
content: "${{ job.status == 'success' && ':check_mark:' || ':cross_mark:' }} ${{github.repository}} : **${{github.ref}}**\nGitHub Actions build result: **${{ job.status }}**\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"