Skip to content

Commit

Permalink
build:test code-cov
Browse files Browse the repository at this point in the history
  • Loading branch information
NishaSharma14 committed Feb 8, 2024
1 parent f788f74 commit 6c3a9f5
Showing 1 changed file with 73 additions and 66 deletions.
139 changes: 73 additions & 66 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name : Setup, Build and Publish to Dev

on:
push:
branches: [development]
branches: [code-cov]

env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
Expand Down Expand Up @@ -67,68 +67,75 @@ jobs:
- name: Run Test
run: php artisan test --parallel

setup-build-publish-deploy:
name: Build & deploy to development
runs-on: ubuntu-latest
needs: php-unit-test
environment:
name: Dev
steps:
# Checkout code
- name: Checkout
uses: actions/checkout@v4

# Authenticate Github Actions to gcloud.
- name: Authenticate GitHub Actions
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GKE_SA_KEY }}'

# Setup gcloud CLI
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v2

# Get the GKE credentials
- name: Get GKE credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER }}
location: ${{ env.GKE_ZONE }}

# Login to Docker
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}

# Build and push the app Docker image
- name: Build and push App Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./resources/ops/docker/app/app.dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-app-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-app-latest

# Build and push the nginx Docker image
- name: Build and push Nginx Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./resources/ops/docker/nginx/nginx.dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-nginx-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-nginx-latest

# Deploy the latest Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
kubectl rollout restart deployment/$WORKER_DEPLOYMENT_NAME
kubectl rollout restart deployment/$SCHEDULER_DEPLOYMENT_NAME
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
kubectl get services -o wide
# Code coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
env:
token: ${{ secrets.CODECOV_TOKEN }}
slug: NFDI4Chem/nmrxiv

# setup-build-publish-deploy:
# name: Build & deploy to development
# runs-on: ubuntu-latest
# needs: php-unit-test
# environment:
# name: Dev
# steps:
# # Checkout code
# - name: Checkout
# uses: actions/checkout@v4

# # Authenticate Github Actions to gcloud.
# - name: Authenticate GitHub Actions
# uses: 'google-github-actions/auth@v2'
# with:
# credentials_json: '${{ secrets.GKE_SA_KEY }}'

# # Setup gcloud CLI
# - name: Setup gcloud CLI
# uses: google-github-actions/setup-gcloud@v2

# # Get the GKE credentials
# - name: Get GKE credentials
# uses: google-github-actions/get-gke-credentials@v2
# with:
# cluster_name: ${{ env.GKE_CLUSTER }}
# location: ${{ env.GKE_ZONE }}

# # Login to Docker
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ env.DOCKER_HUB_USERNAME }}
# password: ${{ env.DOCKER_HUB_PASSWORD }}

# # Build and push the app Docker image
# - name: Build and push App Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./resources/ops/docker/app/app.dockerfile
# push: true
# build-args: |
# RELEASE_VERSION=dev-app-latest
# tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-app-latest

# # Build and push the nginx Docker image
# - name: Build and push Nginx Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./resources/ops/docker/nginx/nginx.dockerfile
# push: true
# build-args: |
# RELEASE_VERSION=dev-nginx-latest
# tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-nginx-latest

# # Deploy the latest Docker image to the GKE cluster
# - name: Deploy
# run: |-
# kubectl rollout restart deployment/$DEPLOYMENT_NAME
# kubectl rollout restart deployment/$WORKER_DEPLOYMENT_NAME
# kubectl rollout restart deployment/$SCHEDULER_DEPLOYMENT_NAME
# kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
# kubectl get services -o wide

0 comments on commit 6c3a9f5

Please sign in to comment.