Add Huggingface Integration #3464
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI-PyTest | |
on: | |
push: | |
branches: [master] | |
pull_request: {} | |
jobs: | |
full-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free space | |
run: | | |
df -h | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
sudo rm -rf "$ANDROID_SDK_ROOT" | |
df -h | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Use changed-files-specific action to collect file changes. | |
# The following commented condition applied to a step will run that step only if non-docs files have changed. | |
# It should be applied to all functionality-related steps. | |
# if: steps.changed-files-specific.outputs.only_modified == 'false' | |
- name: Detect and screen file changes | |
id: changed-files-specific | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: | | |
.github/*.md | |
.github/ISSUE_TEMPLATE/*.md | |
.github/workflows/devcontainer.yml | |
.github/workflows/docker-image.yml | |
.devcontainer/** | |
docs/** | |
mlcube/** | |
*.md | |
LICENSE | |
Dockerfile-* | |
- name: Summarize docs and non-docs modifications | |
run: | | |
echo "List of docs files that have changed: ${{ steps.changed-files-specific.outputs.all_modified_files }}" | |
echo "Changed non-docs files: ${{ steps.changed-files-specific.outputs.other_modified_files }}" | |
# This second step is unnecessary but highly recommended because | |
# It will cache database and saves time re-downloading it if database isn't stale. | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Set up Python 3.9 | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies and package | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
sudo apt-get update | |
sudo apt-get install libvips libvips-tools -y | |
python -m pip install --upgrade pip==24.0 | |
python -m pip install wheel | |
python -m pip install openvino-dev==2023.0.1 mlcube_docker | |
pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cpu | |
pip install -e . | |
- name: Run generic unit tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml -k "generic" | |
- name: Run classification unit tests with histology | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "classification and histology" | |
- name: Run classification unit tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "classification and not histology" | |
- name: Run segmentation unit tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "segmentation and not transunet" | |
- name: Run regression unit tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "regression" | |
- name: Run transunet unit tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "transunet" | |
- name: Run entrypoints tests | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "entrypoints" | |
- name: Run test for update_version | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
run: | | |
pytest --cov=. --cov-report=xml --cov-append -k "update_version" | |
- name: Upload coverage to CodeCov | |
if: steps.changed-files-specific.outputs.only_modified == 'false' # Run on any non-docs change | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
- name: Upload coverage to Codacy | |
if: github.ref == 'refs/heads/master' # only run when on master | |
uses: codacy/[email protected] | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ./coverage.xml |