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

Feature/workflow #22

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
86 changes: 85 additions & 1 deletion .github/workflows/solar-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,94 @@ jobs:
run: npm install

- name: Unit Testing
continue-on-error: true
run: npm test

- name: Archive Test Result
uses: actions/upload-artifact@v3
with:
name: Mocha-Test-Result
path: test-results.xml
path: test-results.xml

code-coverage:
name: code-coverage
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup NodeJS Version
uses: actions/setup-node@v3
with:
node-version: 18

- name: install dependencies
run: npm install

- name: Code-coverage
continue-on-error: true
run: npm run code-coverage

- name: Archive Test Results
uses: actions/upload-artifact@v4
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/[email protected]
with:
registry: ghcr.io
username: '${{ github.repository_owner }}'
password: '${{ secrets.GITHUB_TOKEN }}'
- uses: docker/build-push-action@v4
with:
context: .
push: true
tags: >-
ghcr.io/${{ github.repository_owner }}/solar-system:${{ github.sha }}

dev-deploy:
name: dev-deploy
needs: docker
environment:
development
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: azure/setup-kubectl@v3
with:
version: v1.26.0
- uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: run kubectl
run: kubectl version --short -o yaml
- run: >
echo "INGRESS_IP=$(kubectl -n ingress-nginx get services
ingress-nginx-controller -o
jsonpath='{.status.loadBalancer.ingress[0].ip}')" >> $GITHUB_ENV
- uses: cschleiden/replace-tokens@v1
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