Skip to content

Commit

Permalink
🗝️ Pass codedov token from environment (openvinotoolkit#1102)
Browse files Browse the repository at this point in the history
* with secrets test

* Use action

* modify touch command

* Change proxy url

* Use token from env

* missing download

* Modify path

* Restore workflow

* Update README

---------

Co-authored-by: Ashwin Vaidya <[email protected]>
  • Loading branch information
ashwinvaidya17 and Ashwin Vaidya authored May 25, 2023
1 parent a400059 commit 0cd967b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@

1. Now the container is ready. Type `exit` to leave the container.

1. Start github actions runner in detached mode in the container and set the
the anomalib dataset environment variables.
1. Start github actions runner in detached mode in the container and set the anomalib dataset and codecov environment
variables. The codecov token in the environment variable allows coverage report uploading from the forks.

```bash
sudo docker exec -d anomalib-ci-container /bin/bash -c \
"export ANOMALIB_DATASET_PATH=/home/user/datasets && /home/user/actions-runner/run.sh"
"export ANOMALIB_DATASET_PATH=/home/user/datasets;export CODECOV_TOKEN=XXX && /home/user/actions-runner/run.sh"
```
6 changes: 2 additions & 4 deletions .github/workflows/pre_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ jobs:
else
COMMIT_ID=${{ github.sha }}
fi
# Only pass token if it exists
# current version of codecov-action does not support uploading reports through the proxy
# so we use the latest version of codecov uploader binary
# Pass token from secrets if available. Otherwise it takes it from the environment variable of the CI
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
if [ -n "${{ secrets.CODECOV_TOKEN }}" ]
then
./codecov -t ${{ secrets.CODECOV_TOKEN }} --sha $COMMIT_ID -U $HTTP_PROXY -f .tox/coverage.xml
else
./codecov --sha $COMMIT_ID -r openvinotoolkit/anomalib -U $HTTP_PROXY -f .tox/coverage.xml
./codecov -t "${CODECOV_TOKEN}" --sha $COMMIT_ID -U $HTTP_PROXY -f .tox/coverage.xml
fi

0 comments on commit 0cd967b

Please sign in to comment.