-
Notifications
You must be signed in to change notification settings - Fork 16
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
[TS-711] Wrong commit UUID is discovered #78
Comments
Internal ticket created : TS-711 |
I believe this is linked to #67, although I can manually use the Codacy Coverage Reporter Cli to pass in the correct commit id, I would rather use a prebuild action which already supports this. |
So this is also linked to cobbler/cobbler#3379. I had to resort to the workaround that @milkshakeuk linked. I am still baffled how Codecov is able to do this without needing to resort to these workarounds directly from the fork. The workaround looks something like this:
name: Testing Cobbler
on:
push:
branches: [ main, release* ]
pull_request:
branches: [ main, release* ]
jobs:
run_tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Pull Docker Test Container
run: docker pull registry.opensuse.org/systemsmanagement/cobbler/github-ci/containers/cobbler-test-github:main
- name: Run previously built Docker Container
run: docker run --privileged -t -d -v $PWD:/code --name cobbler registry.opensuse.org/systemsmanagement/cobbler/github-ci/containers/cobbler-test-github:main
- name: Setup Cobbler in the Container
shell: 'script -q -e -c "bash {0}"'
run: |
docker exec -u 0 -it cobbler bash -c "./docker/develop/scripts/setup-supervisor.sh"
- name: Run the Tests inside the Docker Container
shell: 'script -q -e -c "bash {0}"'
run: |
docker exec -u 0 -it cobbler bash -c "pytest --cov=./cobbler --benchmark-skip && git config --global --add safe.directory /code && coverage xml && codecov --token=1064928c-6477-41be-9ac2-7ce5e6d1fd8b --commit=${GITHUB_SHA}"
- name: Stop and remove the container
run: docker stop cobbler && docker rm cobbler
# https://github.com/actions/upload-artifact
- name: Upload coverage report to GH artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
if-no-files-found: error
name: Coverage Upload
on:
workflow_run:
workflows: [Testing Cobbler]
types:
- completed
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
# https://github.com/dawidd6/action-download-artifact
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
name: coverage-report
workflow: testing.yml
allow_forks: true
workflow_conclusion: success
# https://github.com/codacy/codacy-coverage-reporter-action
# - name: Run codacy-coverage-reporter
# uses: codacy/codacy-coverage-reporter-action@v1
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# coverage-reports: coverage.xml
- name: Publish Code Coverage Results
run: |
auth="--project-token ${{ secrets.CODACY_PROJECT_TOKEN }}"
commit_uuid="--commit-uuid ${{ github.event.workflow_run.head_sha }}"
bash <(curl -Ls https://coverage.codacy.com/get.sh) report $auth $commit_uuid -r coverage.xml --partial &&\
bash <(curl -Ls https://coverage.codacy.com/get.sh) final $auth $commit_uuid |
Workaround proposal => #83 |
Hi @yoanm, |
Hi, your action doesn't allow a mechanism to specify the commit UUID and in my case its auto discovering the wrong commit id:
See my Action Run here:
https://github.com/nHapiNET/nHapi/actions/runs/7222494087/job/19679576963
it "should" discover
6371a8bfc534e7b9df7e724ab4e9d42fdf26ae23
(as seen in the checkout step) but is discovering50be0187277c901ced58db7ded7acc098f6420d3
and therefor associating the coverage reports with the wrong commit, I know the Codacy Coverage Reporter script has an option to pass--commit-uuid
but you aren't using this?Am I doing something wrong? or is could there be missing feature in this action?
The text was updated successfully, but these errors were encountered: