From bbec3b547f85b2ece498285f09cce56c2e14ea6a Mon Sep 17 00:00:00 2001 From: Mnickii Date: Wed, 5 Jun 2024 16:59:32 +0300 Subject: [PATCH] test on own file --- .github/workflows/pr-reporting.yml | 2 - .github/workflows/pr.yml | 33 ------------ .github/workflows/sonarCloudAnalysis.yml | 67 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/sonarCloudAnalysis.yml diff --git a/.github/workflows/pr-reporting.yml b/.github/workflows/pr-reporting.yml index 6aa2e24788..faac0ede81 100644 --- a/.github/workflows/pr-reporting.yml +++ b/.github/workflows/pr-reporting.yml @@ -31,8 +31,6 @@ jobs: - name: Download coverage artifacts with cli run: | gh run download ${{ github.event.workflow_run.id }} -n coverage - - name: Display structure of downloaded files - run: ls -R - name: Code Coverage Summary Report uses: irongut/CodeCoverageSummary@v1.3.0 with: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index dbb4970d4e..b9493e24e6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,8 +6,6 @@ name: Build pr on: - push: - branches: [main] pull_request: branches: [main, release/**, next/**] @@ -17,8 +15,6 @@ permissions: jobs: build: runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ github.token }} strategy: matrix: @@ -51,12 +47,6 @@ jobs: with: name: coverage path: coverage/cobertura-coverage.xml - - name: Archive coverage lcov.info - uses: actions/upload-artifact@v2 # upload coverage lcov.info - if: always() # run this step even if previous step failed - with: - name: coverage - path: coverage/lcov.info - name: Code Coverage Summary Report uses: irongut/CodeCoverageSummary@v1.3.0 @@ -82,26 +72,3 @@ jobs: - name: One or more build matrix options failed if: ${{ contains(needs.*.result, 'failure') }} run: exit 1 - - # Configuration to run a SonarCloud analysis on main, release and next branches - sonarcloud: - name: SonarCloud Analysis - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ github.token }} - needs: build - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/download-artifact@v4 - - name: Display structure of downloaded files - run: ls -R - - - name: Run sonar cloud analysis - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/sonarCloudAnalysis.yml b/.github/workflows/sonarCloudAnalysis.yml new file mode 100644 index 0000000000..7f5fb1d9a1 --- /dev/null +++ b/.github/workflows/sonarCloudAnalysis.yml @@ -0,0 +1,67 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +# Tests are executed and coverage reports are emitted as to the action summary +# A dependent workflow which uses workflow_run as a trigger reads the archived outputs and emits comments to the PR triggering this build + +name: Sonar Cloud + +on: + push: + branches: [main, chore/**, release/**, next/**] + paths: + - 'packages/**' + pull_request: + branches: [main, release/**, next/**, chore/**] + paths: + - 'packages/**' + +permissions: + pull-requests: write + +jobs: + sonarcloud: + name: SonarCloud Analysis + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm install -g lerna + - name: Install node_modules + run: yarn + - name: Install Playwright Browsers + run: npx playwright install --with-deps chromium + - run: node scripts/setVersion.js --next + - run: yarn build + - run: yarn lint + - run: yarn test + - name: Archive coverage lcov.info + uses: actions/upload-artifact@v2 # upload coverage lcov.info + if: always() # run this step even if previous step failed + with: + name: coverage + path: coverage/lcov.info + + - uses: actions/download-artifact@v4 + with: + name: coverage + path: coverage/lcov.info + + - name: Display structure of downloaded files + run: ls -R + + - name: Run sonar cloud analysis + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}