Skip to content

#Issue KS-0 fix:Updated right names in pom files #40

#Issue KS-0 fix:Updated right names in pom files

#Issue KS-0 fix:Updated right names in pom files #40

name: search job workflow
on:
push:
branches:
- '*'
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to docker hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image and push
run: |
cd search-job/
mvn clean install -DskipTests
docker build -t ${{ vars.DOCKERHUB_USERNAME }}/search-indexer:${{ github.ref_name }} .
docker images
docker push ${{ vars.DOCKERHUB_USERNAME }}/search-indexer:${{ github.ref_name }}
unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./search-job/
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 14
distribution: 'adopt'
architecture: x64
- name: Install imagemagick
run: |
sudo apt-get update --allow-releaseinfo-change || sudo apt-get update --allow-releaseinfo-change
sudo apt-get install -y imagemagick
- name: Execute coverage report
run: |
mvn clean scoverage:report
- name: Save test results
run: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
if: always()
- name: Save Maven cache
uses: actions/cache@v2
with:
path: ~/.m2
key: kp-jobs-dependency-cache-${{ hashFiles('pom.xml') }}
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: ~/test-results
- name: Run SonarQube analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn -X sonar:sonar -Dlog4j.configuration=./logs sonar:sonar -Dsonar.projectKey=Sunbird-Knowlg_knowlg-search -Dsonar.organization=sunbird-knowlg-1 -Dsonar.host.url=https://sonarcloud.io -Dsonar.exclusions=**/cert-processor/** -Dsonar.scala.coverage.reportPaths=/home/runner/work/knowlg-search/knowlg-search/search-job/target/scoverage.xml