[Do Not Merge] Update workflows #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Merge Tests | ||
permissions: read-all | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
paths: | ||
- "**.py" | ||
- "**.ipynb" | ||
- "**.yaml" | ||
workflow_dispatch: # run on request (no need for PR) | ||
# This is what will cancel the workflow concurrency | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
Pre-Merge-Checks: | ||
Check failure on line 25 in .github/workflows/pre_merge_tests.yml GitHub Actions / Pre-Merge TestsInvalid workflow file
|
||
runs-on: [self-hosted, linux, x64, anomalib] | ||
needs: Code-Quality-Checks | ||
if: github.event.pull_request.draft == false | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
include: | ||
- python-version: "3.10" | ||
tox-env: "py310" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Tox | ||
run: pip install tox | ||
- name: Link the dataset path to the dataset directory in the repository root. | ||
run: | | ||
ln -s $ANOMALIB_DATASET_PATH ./datasets | ||
ln -s $ANOMALIB_DATASET_PATH ./notebooks/datasets | ||
- name: Coverage | ||
run: tox -e pre-merge-${{ matrix.tox-env }} | ||
- name: Upload coverage report | ||
run: | | ||
# If the workflow is triggered from PR then it gets the commit id from the PR. | ||
# else it uses the commit id of the latest commit. This is because the commit | ||
# of the checked-out branch/commit does not exist in the tree as it is grafted. | ||
if [ -n "${{ github.event.pull_request.head.sha }}" ] | ||
then | ||
COMMIT_ID=${{ github.event.pull_request.head.sha }} | ||
else | ||
COMMIT_ID=${{ github.sha }} | ||
fi | ||
# 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 -t "${CODECOV_TOKEN}" --sha $COMMIT_ID -U $HTTP_PROXY -f .tox/coverage.xml | ||
fi |