Skip to content

[Custom Trainer] Refactor postprocessing #2391

[Custom Trainer] Refactor postprocessing

[Custom Trainer] Refactor postprocessing #2391

Workflow file for this run

name: Pre-Merge Checks
on:
push:
branches: [main]
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
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:
Code-Quality-Checks:
runs-on: [self-hosted, linux, x64]
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Tox
run: pip install tox
- name: Code quality checks
run: tox -e pre-commit
Pre-Merge-Checks:
runs-on: [self-hosted, linux, x64]
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@v3
- name: Install Python
uses: actions/setup-python@v4
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