Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm.yml GitHub workflow #5

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# DO NOT EDIT: BEGIN
# This snippet has been inserted automatically by mobsuccessbot, do not edit!
# If changes are needed, update the action npm in
# https://github.com/mobsuccess-devops/github-mobsuccess-policy
on:
merge_group:
types:
- checks_requested
push:
branches: [master, preprod, prod]
pull_request:
types: [opened, synchronize, reopened]
name: NPM
jobs:
packagejsonlint:
name: PackageJsonLint
runs-on: ubuntu-20.04
timeout-minutes: 1
steps:
- uses: actions/checkout@v4
- uses: mobsuccess-devops/github-actions-packagejsonlint@master
sortpackagejson:
name: Sort Package Json
runs-on: ubuntu-20.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Cache Node Modules
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: |
echo "💡 👉 Check not passing? see the doc at https://www.notion.so/mobsuccess/sort-package-json-de5cf4648e8545dbb5a2a5a910380535"
npx --yes sort-package-json@2.4.1 --check
working-directory: .
prettier:
name: Prettier
runs-on: ubuntu-20.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Cache Node Modules
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: npm run prettier
working-directory: .
eslint:
name: Eslint
runs-on: ubuntu-20.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Cache Node Modules
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: npm run eslint
working-directory: .
typecheck:
name: Typecheck
runs-on: ubuntu-20.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Cache Node Modules
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: npm run typecheck
working-directory: .
test:
name: Test
runs-on: ubuntu-20.04
timeout-minutes: 7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.12.0
- name: Cache Node Modules
id: cache
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}-node-20.12.0
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.MS_READ_PACKAGES_GITHUB_PAT }}" >> ~/.npmrc
name: Configure Credentials For GitHub Packages
- run: npm ci
if: steps.cache.outputs.cache-hit != 'true'
working-directory: .
- run: npm run test
working-directory: .
# DO NOT EDIT: END
Loading