Skip to content

Commit

Permalink
Merge pull request #9308 from princegupta1131/8.0.0_github_action
Browse files Browse the repository at this point in the history
8.0.0 GitHub action -test
  • Loading branch information
rajeevsathish authored Jun 20, 2024
2 parents 44eaad3 + 49c50a2 commit cd524a1
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 218 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build-Test

on:
push:
branches:
- "*" # Trigger on push to any branch
pull_request:
branches:
- "*" # Trigger on pull request to any branch

jobs:
ci-cd-TestCases:
name: Build-Test
runs-on: ubuntu-latest

steps:
# Checkout the repository to the runner
- name: Checkout repository
uses: actions/checkout@v3

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18.20.2

# # Install client dependencies
# - name: Install client dependencies
# working-directory: src/app/client
# run: yarn install --no-progress --production=true

# # Build the client
# - name: Build client
# working-directory: src/app/client
# run: npm run build

# # List all files after the build
# - name: List all files after build
# working-directory: src/app/client
# run: find . -type f

# # Check if the dist directory exists and list its contents
# - name: Check if dist directory exists and list contents
# working-directory: src/app/client
# run: |
# if [ -d dist ]; then
# echo "dist directory exists. Listing contents:"
# ls -l dist
# else
# echo "dist directory does not exist"
# fi

# # Move index.html to index.ejs if it exists
# - name: Move index.html to index.ejs if it exists
# working-directory: src/app/client
# run: |
# if [ -f dist/index.html ]; then
# mv dist/index.html dist/index.ejs
# else
# echo "File dist/index.html does not exist"
# fi

# # Set up server directories
# - name: Set up server directories
# run: mkdir -p $GITHUB_WORKSPACE/app_dist

# # Copy server files to the destination directory
# - name: Copy server files
# run: |
# cp -r src/app/libs src/app/helpers src/app/proxy src/app/resourcebundles src/app/package.json src/app/framework.config.js src/app/sunbird-plugins src/app/routes src/app/constants src/app/controllers src/app/server.js $GITHUB_WORKSPACE/app_dist/
# shell: /usr/bin/bash -e {0}

# # Install server dependencies
# - name: Install server dependencies
# working-directory: ${{ github.workspace }}/app_dist
# run: yarn install --ignore-engines --no-progress --production=true

# # Run server build script
# - name: Run server build script
# working-directory: ${{ github.workspace }}/app_dist
# run: node helpers/resourceBundles/build.js -task="phraseAppPull"

# # Execute test cases using JEST
# - name: Execute test cases using JEST
# working-directory: src/app/client
# run: |
# yarn config set ignore-engines true
# yarn install
# npm run test:ci
151 changes: 0 additions & 151 deletions .github/workflows/build-test.yml

This file was deleted.

26 changes: 23 additions & 3 deletions .github/workflows/build-upload-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build and Upload Artifact
on:
push:
branches:
- "deploy" # Trigger on push to any branch
- "deploy" # Trigger on push to the "deploy" branch
pull_request:
branches:
- "deploy" # Trigger on pull request to any branch
- "deploy" # Trigger on pull request to the "deploy" branch

jobs:
build_and_deploy:
Expand All @@ -32,14 +32,34 @@ jobs:
WL_Customization: ${{ github.event.inputs.WL_Customization }} # Set environment variable WL_Customization

- name: Build and Create Docker Image
id: build_docker_image
run: |
commit_hash=$(git rev-parse --short HEAD) # Get commit hash
build_tag=$(echo "${{ github.ref }}" | rev | cut -d/ -f1 | rev)_${commit_hash}_${GITHUB_RUN_NUMBER} # Generate build tag
echo "build_tag: $build_tag" # Print build tag
echo "build_tag=$build_tag" >> $GITHUB_ENV # Save build tag to environment variable
bash ./build.sh "${build_tag}" "${{ env.NODE_NAME }}" "test" true false "" # Run build script with parameters
env:
NODE_NAME: "18.20.2" # Set environment variable NODE_NAME

# - name: Log in to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}

# - name: Push Docker Image
# run: |
# docker tag my-app:${{ env.build_tag }} ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }}
# docker push ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }}

# - name: Push Docker Image
# uses: docker/build-push-action@v4
# with:
# context: .
# # file: ./Dockerfile # Path to your Dockerfile
# push: true
# tags: ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }}

- name: Archive Artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: Use the data
name: Sonar

on:
workflow_run:
workflows: ["Build"]
workflows: [Build-Test] # Trigger when the Build-Test workflow completes
branches: "*"
types:
- completed
- completed # Trigger on completion of the Build-Test workflow

jobs:
download:
SonarScanner:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
if: github.event.workflow_run.conclusion == 'success' # Run job only if Build-Test workflow succeeded

steps:
# Checkout repository to ensure we have the latest code
- name: Checkout repository
uses: actions/checkout@v3

- name: Print SONAR_TOKEN
run: echo "SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}PWR****123"

# Install Sonar Scanner
- name: Install Sonar Scanner
run: |
sudo apt-get update && sudo apt-get install -y unzip
wget -O /tmp/sonar-scanner-cli.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
unzip /tmp/sonar-scanner-cli.zip -d /tmp
# Run SonarScanner for frontend (Angular)
- name: Run SonarScanner for frontend
# Run SonarScanner for SunbirdEd-Portal
- name: Run SonarScanner for SunbirdEd-Portal
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Inject the SonarQube token securely
run: |
/tmp/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
-Dsonar.login=$SONAR_TOKEN
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ Installing Sunbird requires two primary software components:
| [@project-sunbird/sb-content-section](https://www.npmjs.com/package/@project-sunbird/sb-content-section) | https://github.com/Sunbird-Ed/sb-content-module | 8.0.1 | NG 16 |
| [@project-sunbird/sb-notification](https://www.npmjs.com/package/@project-sunbird/sb-notification) | https://github.com/Sunbird-Ed/sb-notification | 8.0.1 | NG 16 |
| [@shikshalokam/sl-questionnaire](https://www.npmjs.com/package/@shikshalokam/sl-questionnaire) | https://github.com/shikshalokam/sl-questionnaire-components | 7.0.0 | NG 16 |
| [@shikshalokam/sl-reports-library](https://www.npmjs.com/package/@shikshalokam/sl-reports-library) | https://github.com/shikshalokam/sl-reports-library | 6.0.0 | NG 16 |
| [@shikshalokam/sl-reports-library](https://www.npmjs.com/package/@shikshalokam/sl-reports-library) | https://github.com/shikshalokam/sl-reports-library | 6.0.0 | NG 16 |
2 changes: 1 addition & 1 deletion local_setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export sunbird_environment='local';
export sunbird_instance='sunbird';
export sunbird_default_channel='sunbird';
export sunbird_default_tenant='sunbird';
export sunbird_default_tenant='sunbird';
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { CsCertificateService } from '@project-sunbird/client-services/services/

@Component({
selector: 'app-certificate-details',
templateUrl: './certificate-details.component.html',
styleUrls: ['./certificate-details.component.scss']
templateUrl: './certificate-details.component.html'
})
export class CertificateDetailsComponent implements OnInit , OnDestroy {
loader: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,3 @@ export class OrgDetailsService {
}
}


Loading

0 comments on commit cd524a1

Please sign in to comment.