Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ecotag) : repair sonar #295

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 51 additions & 19 deletions .github/workflows/ecotag-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,66 @@ on:

jobs:

build-windows:
environment: ml-cli
build_windows:
runs-on: windows-latest
environment: ml-cli
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
fetch-depth: 0

java-version: 11
distribution: 'zulu' # Alternative distribution options are available.
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: npm install
run: npm install
working-directory: src/Ecotag/ClientApp

- name: npm test
run: npm test -- --runInBand --coverage --watchAll=false
working-directory: src/Ecotag/ClientApp

- name: npm run build-storybook
run: npm run build-storybook
working-directory: src/Ecotag/ClientApp

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- uses: actions/setup-dotnet@v1
- run: dotnet test
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"AxaGuilDEv_ml-cli" /o:"axaguildev" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

build-linux:
environment: ml-cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v2
Expand All @@ -46,21 +90,9 @@ jobs:
working-directory: src/Ecotag/ClientApp

- uses: actions/setup-dotnet@v1

#- name: Sonarqube Begin
# if: ${{ github.actor != 'dependabot[bot]' }}
# run: |
# dotnet tool install --global dotnet-sonarscanner
# dotnet test -p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./coverage/opencover.xml
# dotnet sonarscanner begin /d:sonar.login=${{ secrets.SONAR_TOKEN }} /o:AxaGuilDev /k:AxaGuilDev_ml-cli /s:$GITHUB_WORKSPACE/SonarQube.Analysis.xml

- run: dotnet test /p:CollectCoverage=true

#- name: Sonarqube end
# if: ${{ github.actor != 'dependabot[bot]' }}
# run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tags:
runs-on: ubuntu-latest
Expand Down
14 changes: 7 additions & 7 deletions src/Ecotag/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Ecotag/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@axa-fr/react-oidc": "6.15.9",
"@axa-fr/react-oidc": "6.20.0",
"@axa-fr/react-toolkit-all": "1.4.1",
"@microsoft/applicationinsights-web": "2.8.6",
"@monaco-editor/react": "4.2.1",
Expand Down
5 changes: 4 additions & 1 deletion src/Ecotag/ClientApp/public/OidcTrustedDomains.azure.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Add here trusted domains, access tokens will be send to
const trustedDomains = {default: ["https://axaguildev-ecotag.azurewebsites.net", "https://demo.duendesoftware.com"]};
const trustedDomains = {
default: ["https://axaguildev-ecotag.azurewebsites.net", "https://demo.duendesoftware.com"],
access_token: { domains : ["https://axaguildev-ecotag.azurewebsites.net", "https://demo.duendesoftware.com"], showAccessToken: true }
};
5 changes: 4 additions & 1 deletion src/Ecotag/ClientApp/public/OidcTrustedDomains.docker.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Add here trusted domains, access tokens will be send to
const trustedDomains = {default: ["http://localhost:5010", "https://demo.duendesoftware.com"]};
const trustedDomains = {
default: ["http://localhost:5010", "https://demo.duendesoftware.com"],
access_token: { domains : ["http://localhost:5010", "https://demo.duendesoftware.com"], showAccessToken: true }
};
3 changes: 2 additions & 1 deletion src/Ecotag/ClientApp/public/OidcTrustedDomains.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Add here trusted domains, access tokens will be send to
const trustedDomains = {
default: ["https://localhost:5001", "https://demo.duendesoftware.com"]
default: ["https://localhost:5001", "https://demo.duendesoftware.com"],
access_token: { domains : ["https://localhost:5001", "https://demo.duendesoftware.com"], showAccessToken: true }
};

5 changes: 4 additions & 1 deletion src/Ecotag/ClientApp/public/OidcTrustedDomains.production.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Add here trusted domains, access tokens will be send to
const trustedDomains = {default: [#{Spa:Oidc:ServiceWorkerTrustedDomain}#]}
const trustedDomains = {
default: [#{Spa:Oidc:ServiceWorkerTrustedDomain}#],
access_token: { domains : [#{Spa:Oidc:ServiceWorkerTrustedDomain}#], showAccessToken: true }
}
12 changes: 1 addition & 11 deletions src/Ecotag/ClientApp/src/Server/AccessToken.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {OidcProvider, OidcSecure, useOidcAccessToken} from "@axa-fr/react-oidc";
import React, {useEffect} from "react";
import React from "react";
import {withEnvironment} from "./EnvironmentProvider";
import Loading from "./shared/Oidc/Loading.component";
import AuthenticatingError from "./shared/Oidc/AuthenticateError.component";
Expand All @@ -15,14 +15,6 @@ const AccessTokenWithProvider = withEnvironment(({environment}) => {

let history = useHistory();

useEffect(() => {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.unregister();
}
})
}, []);

const withCustomHistory = () => {
return {
replaceState: (url, stateHistory) => {
Expand All @@ -37,8 +29,6 @@ const AccessTokenWithProvider = withEnvironment(({environment}) => {
const configuration = {
...config,
scope: config.scope.replace("offline_access", ""),
service_worker_relative_url: null,
service_worker_only: false,
redirect_uri: window.location.origin + '/access-token/authentication/callback'
};

Expand Down