Skip to content

Commit

Permalink
chore: send coverage to codacy (wip)
Browse files Browse the repository at this point in the history
use java version of reporter for mac and windows
  • Loading branch information
miurahr committed Dec 14, 2024
1 parent 43d4a93 commit 1bb6ff0
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/run-tox-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,23 @@ jobs:
env:
LIBARCHIVE: "${{ github.workspace }}\\libarchive\\bin\\archive.dll"
PYTEST_ADDOPTS: "--cov-config=pyproject.toml --cov --cov-append --benchmark-skip"
- name: Send coverage to coveralls and codacy
- name: Send coverage to coveralls
run: |
coveralls
curl -Ls -o codacy-coverage-reporter "$(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')"
chmod +x codacy-coverage-reporter
./codacy-coverage-reporter report -l Python -t ${PROJECT_TOKEN} --partial -r covertura.xml
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: py-${{ matrix.python-version }}-${{ matrix.os }}
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Send coverage to codacy
run: |
curl -LS -o codacy-coverage-reporter-assembly.jar "$(curl -LSs https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | endswith(".jar"))) | .[0].browser_download_url')"
java -jar codacy-coverage-reporter-assembly.jar report -l Python -t ${PROJECT_TOKEN} --partial -r covertura.xml
env:
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

test_slow_tests:
Expand Down Expand Up @@ -139,22 +145,17 @@ jobs:
apt-get update -q -y
apt-get install -q -y p7zip-full python3 python3-pip python3-cffi build-essential gcc git libffi-dev python3-dev libarchive-dev
python3 -m pip install -U pip tox setuptools setuptools_scm[toml] coverage[toml]
curl -Ls -o codacy-coverage-reporter "$(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')"
chmod +x codacy-coverage-reporter
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
python3 -c "import platform;print('Machine type:', platform.machine())"
python3 -m tox -e py310
coveralls
python3 -m coverage xml -o cobertura.xml
./codacy-coverage-reporter report -l Python -t ${PROJECT_TOKEN} --partial -r covertura.xml
env: |
PYTEST_ADDOPTS: "--cov-config=pyproject.toml --cov --cov-append --benchmark-skip"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: py-${{ matrix.python-version }}-${{ matrix.os }}
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
finish:
runs-on: ubuntu-latest
Expand All @@ -166,10 +167,16 @@ jobs:
curl -k \
https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN \
-d "payload[build_num]=$GITHUB_SHA&payload[status]=done"
curl -Ls -o codacy-coverage-reporter "$(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')"
chmod +x codacy-coverage-reporter
./codacy-coverage-reporter final -t ${PROJECT_TOKEN}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Send coverage to codacy
run: |
curl -LS -o codacy-coverage-reporter-assembly.jar "$(curl -LSs https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | endswith(".jar"))) | .[0].browser_download_url')"
java -jar codacy-coverage-reporter-assembly.jar report -l Python -t ${PROJECT_TOKEN} --partial -r covertura.xml
env:
PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

0 comments on commit 1bb6ff0

Please sign in to comment.