Merge branch 'master' of https://github.com/vmware/data-annotator-for… #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2019-2024 VMware, Inc. | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
name: smoke_test | |
#only trigger in master branch | |
on: | |
push: | |
branches: ["master"] | |
jobs: | |
smoke_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Pthon 3.7 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.7" | |
- name: Setup Node 16 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: set-up-mongodb | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: "4.4" | |
- name: build-and-run-al | |
working-directory: ./active-learning-service | |
run: | | |
pip install -r requirements.txt | |
python -m spacy download en_core_web_md | |
python manage.py runserver localhost:8000 & | |
- name: build-and-run-service | |
working-directory: ./annotation-service | |
run: | | |
npm install | |
npm run start & | |
- name: Test Connection | |
run: | | |
sleep 10 | |
echo Curl register | |
curl -X PUT -H "Content-Type: application/json" -d '{"email":"[email protected]","password":"password","uname":"Joe K Qiao"}' http://localhost:3000/api/v1.0/register | |
echo Curl End register | |
echo Curl Start login | |
resp="$(curl -X POST -H "Content-Type: application/json" -d '{"email":"[email protected]","password":"password"}' http://localhost:3000/api/v1.0/login)" | |
echo Curl End login | |
access_token=${resp:26:163} | |
echo container Start connect-active-learning-service | |
curl -X GET -H "Content-Type: application/json" -H "Authorization: ${access_token}" localhost:8000/health | |
echo container End connect-active-learning-service | |
- name: Checkout e2e-test branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: "e2e-test" | |
path: "e2e-test" | |
- name: Build Annotation App | |
working-directory: ./annotation-app | |
run: | | |
node --version | |
npm --version | |
CI=false npm install | |
CI=false npm run build --if-present | |
- name: Run Smoke Test | |
working-directory: ./e2e-test | |
run: | | |
echo $str Smoke Test Start $str | |
npm install | |
npm run e2e-smoke | |
sed -i 's/dist\/root\///g' coverage-output/lcov.info | |
echo $str Smoke Test End $str | |
- name: keep the coverage output folder | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-output | |
path: ./e2e-test/coverage-output/ | |
retention-days: 60 | |
- name: keep the allure results folder | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: allure-results | |
path: ./e2e-test/allure-results/ | |
retention-days: 60 | |
scan_annotation_app: | |
runs-on: ubuntu-latest | |
needs: smoke_test | |
#define variables to be used for SonarCloud scan | |
env: | |
SONAR_ORG: ${{ secrets.SONAR_ORG }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Checkout devops branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: "devops" | |
path: "devops" | |
- name: Download coverage-out artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: coverage-output | |
path: ./coverage-output | |
- name: copy e2e coverage report to the app | |
working-directory: ./annotation-app | |
run: | | |
pwd | |
cp ../coverage-output/lcov.info ./ | |
ls -l | |
- name: SonarCloud setup for annotation-app | |
working-directory: ./devops/sonar | |
run: python ./config_sonar_project.py -ProjectName ${{ env.SONAR_ORG }}-annotation-app -ProjectKey ${{ env.SONAR_ORG }}-annotation-app -OrgKey ${{ env.SONAR_ORG }} -QualityGateName angular-client-gate -QualityGateConditions ./quality_gates/angular-client.json -SonarToken ${{ secrets.SONAR_TOKEN }} | |
- name: SonarCloud Scan annotation-app | |
uses: sonarsource/sonarcloud-github-action@master | |
with: | |
projectBaseDir: ./annotation-app | |
args: > | |
-Dsonar.organization=${{ env.SONAR_ORG }} | |
-Dsonar.projectKey=${{ env.SONAR_ORG }}-annotation-app | |
-Dsonar.projectName=${{ env.SONAR_ORG }}-annotation-app | |
-Dsonar.sources=. | |
-Dsonar.sourceEncoding=UTF-8 | |
-Dsonar.language=javascript | |
-Dsonar.javascript.lcov.reportPaths=lcov.info | |
-Dsonar.test.exclusions=**/node_modules/**/*,*.md,*.txt,*.yml | |
-Dsonar.coverage.exclusions=**/node_modules/**/*,*.md,*.txt,*.yml,**/build-script.js,**/src/dev-platform/**/*,**/src/micro-frontend/*,**/src/app/shared/routeReuseStrategy.ts,**/src/main.ts,**/src/app/model,**/src/environments/*.ts,**/src/app/component/datasets/dnd.directive.ts,**/src/app/component/page-not-found,**/src/libs/modelChart.js,**/src/app/core.module.ts,**/src/app/services/user-auth.service.ts,**/src/app/services/web-analytics.service.ts,**/src/app/services/environments.service.ts,**/src/app/services/internal-api.service.ts,**/src/app/guards/auth.guard.ts,**/src/app/component/login/**/*,**/src/app/shared/form-validators/**/*,**/src/app/services/common/email.service.ts,**/src/app/services/common/s3.service.ts,**/src/app/services/common/tool.service.ts,**/src/app/services/environments.service.ts,**/src/app/services/feedback.service.ts,**/src/app/services/user-auth.service.ts,**/src/app/pipes/full-name.pipe.ts,**/src/app/model/**,**/src/app/component/permission/**/*,**/src/app/services/cds-icon.service.ts,**/src/app/app.module.ts | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.DATA_GITHUB_TOKEN }} |