Skip to content

Commit

Permalink
refactor(all): clean sonar (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet authored Apr 17, 2024
1 parent 9ea96b8 commit 04ee5d4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,44 @@ on:
branches:
- main

env:
PNPM_VERSION: 8.5.1
NODE_VERSION: 18

jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: pnpm install
run: pnpm i --frozen-lockfile
- name: pnpm run build
run: pnpm run build
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WONDERFUL_FOREST_0A9F5B103 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
skip_app_build: true
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
app_location: "/storybook-static" # App source code path
api_location: "" # Api source code path - optional
output_location: "storybook-static" # Built app content directory - optional
#output_location: "" # Built app content directory - optional
###### End of Repository/Build Configurations ######

close_pull_request_job:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
with:
args: >
-Dsonar.organization=axaguildev
-Dsonar.projectKey=AxaGuilDEv_slight-capture
-Dsonar.projectKey=AxaFrance_slight-capture
-Dsonar.exclusions=**/*.spec.js,**/*.stories.js,Scripts/**,**/*.scss,**/__snapshots__/**,**/*[Tt]ests.cs,**/node_modules/**,**/ClientApp/build/**,**/ClientApp/.storybook/**,**/ClientApp/storybook-static/**,**/obj/**,**/__mocks__/**,**/ClientApp/src/serviceWorker.ts
-Dsonar.javascript.lcov.reportPaths=**/coverage/lcov.info
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Slight Capture

[![Continuous Integration](https://github.com/AxaFrance/slight-capture/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/AxaFrance/slight-capture/actions/workflows/npm-publish.yml)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=alert_status)](https://sonarcloud.io/dashboard?id=AxaFrance_slight-capture) [![Reliability](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=AxaFrance_slight-capture&metric=reliability_rating) [![Security](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=security_rating)](https://sonarcloud.io/component_measures?id=AxaFrance_slight-capture&metric=security_rating) [![Code Coverage](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=coverage)](https://sonarcloud.io/component_measures?id=AxaFrance_slight-capture&metric=Coverage)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=alert_status)](https://sonarcloud.io/dashboard?id=AxaFrance_slight-capture) [![Reliability](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=AxaFrance_slight-capture&metric=reliability_rating) [![Security](https://sonarcloud.io/api/project_badges/measure?project=AxaFrance_slight-capture&metric=security_rating)](https://sonarcloud.io/component_measures?id=AxaFrance_slight-capture&metric=security_rating)

- [About](#about)
- [Get Started](#get-started)
Expand Down
10 changes: 5 additions & 5 deletions src/SlightCapture/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ const startCaptureAsync = cv =>(constraints, iVideo) => {
stream.getTracks().forEach(function(track) {
track.enabled = true;
});

iVideo.onloadedmetadata = async function (e) {
await iVideo.play();
let stream_settings = stream.getVideoTracks()[0].getSettings();

let src = new cv.Mat(stream_settings.height, stream_settings.width, cv.CV_8UC4);
iVideo.height = iVideo.videoHeight;
iVideo.width = iVideo.videoWidth;
let videoCapture = new cv.VideoCapture(iVideo);

const stopStreamTracks = () => {
stream.getTracks().forEach(function(track) {
track.stop();
Expand All @@ -45,7 +45,7 @@ const startCaptureAsync = cv =>(constraints, iVideo) => {
resolve({ videoCapture, src, stopStreamTracks});

}
}) .catch(function(err) {
}).catch(function(err) {
console.error(err.name + ": " + err.message);
error(err);
});
Expand All @@ -66,7 +66,7 @@ const initTemplateAsync = (cv) => async (file) => {

let openCVPromise = null;

const loadOpenCVAsync = async (openCVScript = `https://docs.opencv.org/4.8.0/opencv.js` ) => {
const loadOpenCVAsync = async (openCVScript = `https://docs.opencv.org/4.9.0/opencv.js` ) => {
openCVPromise = loadScriptAsync(openCVScript);
return await openCVPromise;
}
Expand Down

0 comments on commit 04ee5d4

Please sign in to comment.