Skip to content

Changing download-artifact from v2 to v4 #2444

Changing download-artifact from v2 to v4

Changing download-artifact from v2 to v4 #2444

name: Run pytest and SonarCloud Scan
on:
push:
branches:
- '**'
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- develop
- main
concurrency:
group: run-pytest-tests_${{ github.ref }}
cancel-in-progress: true
jobs:
run-pytest:
if: ${{ !github.event.repository.fork }}
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Fix Directory Structure
run: |
mkdir /home/runner/_work/claasp_backup
mv -f /home/runner/_work/claasp/claasp/* /home/runner/_work/claasp_backup
rm -rf /home/runner/_work/claasp/
mkdir /home/runner/_work/claasp
mv -f /home/runner/_work/claasp_backup/* /home/runner/_work/claasp
chmod g+w /home/runner/_work/claasp/ -R
rm -rf /home/runner/_work/claasp_backup
- name: Run remote-pytest
run: |
cd /home/runner/_work/claasp
make remote-pytest
- name: Upload Coverage.xml to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: /home/runner/_work/claasp/coverage.xml
run-code-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Download Latest Coverage.xml from Artifacts
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Override Coverage Source Path for Sonar
run: sed -i "s/<source>\/home\/runner\/_work\/claasp\/claasp<\/source>/<source>\/github\/workspace\/claasp<\/source>/g" coverage.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.branch.name=${{ env.GITHUB_HEAD_REF }}
-Dsonar.python.coverage.reportPaths=coverage.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
needs: run-pytest