diff --git a/.github/workflows/QA.yml b/.github/workflows/QA.yml index f917e28..d324aff 100644 --- a/.github/workflows/QA.yml +++ b/.github/workflows/QA.yml @@ -26,24 +26,23 @@ jobs: with: category: /language:python - sonarqube: - name: SonarQube + codacy: + name: Codacy runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v8 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Run Codacy Analysis CLI + uses: codacy/codacy-analysis-cli-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + upload: true report-qa-status: name: Report QA Status runs-on: ubuntu-latest - needs: [ codeql, sonarqube ] + needs: [ codeql, codacy ] if: always() steps: diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 30938eb..960c595 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -4,40 +4,40 @@ on: workflow_call: jobs: - # function-tests: - # name: Function Tests - # runs-on: ubuntu-latest - # - # services: - # api: - # image: docker.cloudsmith.io/better-hpc/keystone/keystone-api - # ports: - # - 8000:8000 - # - # strategy: - # fail-fast: false - # matrix: - # python-version: ${{ fromJson(vars.PYTHON_VERSIONS) }} - # - # steps: - # - name: Checkout repository - # uses: actions/checkout@v6 - # - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v6 - # with: - # python-version: ${{ matrix.python-version }} - # - # - name: Install Poetry - # uses: snok/install-poetry@v1 - # with: - # virtualenvs-create: false - # - # - name: Install dependencies - # run: poetry install --with tests - # - # - name: Run tests - # run: poetry run python -m unittest discover -s tests/function_tests + function-tests: + name: Function Tests + runs-on: ubuntu-latest + + services: + api: + image: docker.cloudsmith.io/better-hpc/keystone/keystone-api + ports: + - 8000:8000 + + strategy: + fail-fast: false + matrix: + python-version: ${{ fromJson(vars.PYTHON_VERSIONS) }} + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: false + + - name: Install dependencies + run: poetry install --with tests + + - name: Run tests + run: poetry run python -m unittest discover -s tests/function_tests unit-tests: name: Unit Tests @@ -71,13 +71,26 @@ jobs: poetry run coverage report --omit="tests/*" poetry run coverage xml --omit="tests/*" -o coverage.xml + - name: Report partial coverage results + if: github.event_name != 'release' + shell: bash + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l Python -r coverage.xml + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + report-test-status: name: Report Test Status runs-on: ubuntu-latest - needs: [ unit-tests ] + needs: [ unit-tests, function-tests ] if: always() steps: + - name: Finish reporting coverage + shell: bash + run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + - name: Check test status if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled') }} run: exit 1 diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index c37021e..0000000 --- a/sonar-project.properties +++ /dev/null @@ -1,2 +0,0 @@ -sonar.projectKey=Better-HPC_keystone-python-client -sonar.organization=better-hpc