update node to 20 #18
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: Solar System Workflow | |
'on': | |
workflow_dispatch: null | |
push: | |
branches: | |
- main | |
- feature/* | |
env: | |
MONGO_URI: 'mongodb+srv://supercluster.d83jj.mongodb.net/superData' | |
MONGO_USERNAME: superuser | |
MONGO_PASSWORD: '${{ secrets.MONGO_PASSWORD }}' | |
jobs: | |
unit-testing: | |
name: Unit Testing | |
runs-on: ubuntu-latest | |
container: | |
image: 'node:20' | |
env: | |
MONGO_URI: 'mongodb://mongo:27017/superData' | |
MONGO_USERNAME: non-prod-user | |
MONGO_PASSWORD: non-prod-password | |
services: | |
mongo: | |
image: 'siddharth67/mongo-db:non-prod' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Cache NPM dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: "${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}" | |
- name: Install Dependencies | |
run: npm install | |
- name: Unit Testing | |
run: npm test | |
- name: Archive Test Result | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Mocha-Test-Result | |
path: test-results.xml | |
code-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm install | |
- continue-on-error: true | |
run: npm run coverage | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Code-Coverage-Result | |
path: coverage | |
retention-days: 5 | |
docker: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
needs: | |
- code-coverage | |
- unit-testing | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: 'ghcr.io/${{ github.repository_owner }}/solar-system:${{ github.sha }}' |