Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 285acc7

Browse files
committed
Add npm.yml GitHub workflow
1 parent 3e374b5 commit 285acc7

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

.github/workflows/npm.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# DO NOT EDIT: BEGIN
2+
# This snippet has been inserted automatically by mobsuccessbot, do not edit!
3+
# If changes are needed, update the action npm in
4+
# https://github.com/mobsuccess-devops/github-mobsuccess-policy
5+
on:
6+
push:
7+
branches: [master, preprod, prod]
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
name: NPM
11+
jobs:
12+
packagejsonlint:
13+
name: PackageJsonLint
14+
runs-on: ubuntu-20.04
15+
timeout-minutes: 1
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
19+
prettier:
20+
name: Prettier
21+
runs-on: ubuntu-20.04
22+
timeout-minutes: 7
23+
steps:
24+
- uses: actions/checkout@v2
25+
- uses: actions/setup-node@v1
26+
with:
27+
node-version: 16.16.0
28+
- name: Cache Node Modules
29+
id: cache
30+
uses: actions/cache@v2
31+
env:
32+
cache-name: cache-node-modules
33+
with:
34+
path: ./node_modules
35+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
36+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
37+
name: Configure Credentials For GitHub Packages
38+
- run: npm ci
39+
if: steps.cache.outputs.cache-hit != 'true'
40+
working-directory: .
41+
- run: npm run prettier
42+
working-directory: .
43+
eslint:
44+
name: Eslint
45+
runs-on: ubuntu-20.04
46+
timeout-minutes: 7
47+
steps:
48+
- uses: actions/checkout@v2
49+
- uses: actions/setup-node@v1
50+
with:
51+
node-version: 16.16.0
52+
- name: Cache Node Modules
53+
id: cache
54+
uses: actions/cache@v2
55+
env:
56+
cache-name: cache-node-modules
57+
with:
58+
path: ./node_modules
59+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
60+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
61+
name: Configure Credentials For GitHub Packages
62+
- run: npm ci
63+
if: steps.cache.outputs.cache-hit != 'true'
64+
working-directory: .
65+
- run: npm run eslint
66+
working-directory: .
67+
test:
68+
name: Test
69+
runs-on: ubuntu-20.04
70+
timeout-minutes: 7
71+
steps:
72+
- uses: actions/checkout@v2
73+
- uses: actions/setup-node@v1
74+
with:
75+
node-version: 16.16.0
76+
- name: Cache Node Modules
77+
id: cache
78+
uses: actions/cache@v2
79+
env:
80+
cache-name: cache-node-modules
81+
with:
82+
path: ./node_modules
83+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-16.16.0
84+
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
85+
name: Configure Credentials For GitHub Packages
86+
- run: npm ci
87+
if: steps.cache.outputs.cache-hit != 'true'
88+
working-directory: .
89+
- run: npm run test
90+
working-directory: .
91+
# DO NOT EDIT: END

0 commit comments

Comments
 (0)