Skip to content

rename

rename #25

Workflow file for this run

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: Setup NodeJS Version #commented
# uses: actions/setup-node@v3 #commented
# with: #commented
# node-version: 20 #commented
- 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: 20
- 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 }}'
dev-deploy:
runs-on: ubuntu-latest
needs: docker
environment:
name: development
steps:
- uses: actions/checkout@v4
- uses: azure/[email protected]
with:
version: 'v1.26.0' # default is latest stable
- uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: '${{ secrets.KUBECONFIG }}'
- run: kubectl version --short -o yaml
- run: echo "INGRESS_IP=$(kubectl -n ingress-nginx get servicesingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" >> $GITHUB_ENV
- uses: cschleiden/[email protected]
with:
tokenPrefix: '_{_'
tokenSuffix: '_}_'
files: '["kubernetes/development/*.yaml"]'
env:
NAMESPACE: '${{ vars.NAMESPACE }}'
REPLICAS: '${{ vars.REPLICAS }}'
IMAGE: >-
ghcr.io/${{ github.repository_owner }}/solar-system:${{ github.sha
}}
INGRESS_IP: '${{ env.INGRESS_IP }}'
- run: cat kubernetes/development/*.yaml