chore: update package.json #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Frontend Application API Build | |
on: | |
push: | |
branches: [ "main", "release" ] | |
pull_request: | |
branches: [ "main", "release" ] | |
jobs: | |
initialize-app: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [ 18 ] | |
name: Cache Node dependencies | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install Packages | |
run: | | |
npm i | |
- name: Cache Node Modules | |
uses: actions/cache@v3.2.3 | |
with: | |
path: ./node_modules | |
key: node-modules-app-cache-key.${{ github.ref }}.${{ github.sha }} | |
- name: Cache package-lock.json | |
uses: actions/cache@v3.2.3 | |
with: | |
path: ./package-lock.json | |
key: package-lock-app-cache-key.${{ github.ref }}.${{ github.sha }} | |
test-and-lint: | |
runs-on: ubuntu-latest | |
needs: initialize-app | |
if: ${{ (github.ref == 'refs/heads/release' || github.ref == 'refs/heads/main') }} | |
strategy: | |
matrix: | |
node: [ 18 ] | |
name: Test And Linting NodeJS v${{ matrix.node }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Use Cached Node Modules | |
uses: actions/cache@v3.2.3 | |
with: | |
path: ./node_modules | |
key: node-modules-app-cache-key.${{ github.ref }}.${{ github.sha }} | |
- name: Use Cached package-lock.json | |
uses: actions/cache@v3.2.3 | |
with: | |
path: ./package-lock.json | |
key: package-lock-app-cache-key.${{ github.ref }}.${{ github.sha }} | |
- name: Linting | |
run: | | |
npm run linting | |
- name: Testing | |
run: | | |
npm run test |