GitHub actions docker #334
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
name: Lint & Test | |
on: | |
push: | |
tags: [ 'v*' ] | |
release: | |
types: [released] | |
# Triggers the workflow only when merging pull request to the branches. | |
pull_request: | |
types: [closed] | |
branches: [ master, 'Release-*' ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: cache-npm-packages | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
- name: Install NPM dependencies | |
if: steps.cache-npm-packages.outputs.cache-hit != 'true' | |
run: npm ci --legacy-peer-deps | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: prepare | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: cache-npm-packages | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
- name: Install NPM dependencies | |
if: steps.cache-npm-packages.outputs.cache-hit != 'true' | |
run: npm ci --legacy-peer-deps | |
- name: Lint Src and Server | |
run: npm run lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: prepare | |
env: | |
CI: true | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18.x | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: cache-npm-packages | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} | |
- name: Install NPM dependencies | |
if: steps.cache-npm-packages.outputs.cache-hit != 'true' | |
run: npm ci --legacy-peer-deps | |
- name: Run tests | |
run: npm run test |