Model Prediction Bug Fix #13
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: training-model-eval-unittests | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- assets/training/model_evaluation/** | |
- .github/workflows/training-model-eval-unittests.yaml | |
workflow_dispatch: | |
env: | |
conda_env_prefix: /opt/conda/envs/model_eval | |
model_eval_unittests_dir: assets/training/model_evaluation/tests | |
model_eval_conda_yaml: assets/training/model_evaluation/environment/context/conda.yaml | |
pytest_reports: pytest-reports | |
jobs: | |
run_unit_tests: | |
name: Run | |
runs-on: ubuntu-latest | |
permissions: | |
# Required for EnricoMi/publish-unit-test-result-action | |
checks: write | |
issues: read | |
pull-requests: write | |
steps: | |
- name: Clone branch | |
uses: actions/checkout@v3 | |
- name: Use Python 3.10 or newer | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '>=3.10' | |
- name: Create conda env | |
run: | | |
set -ex | |
apt-get update && apt-get upgrade && apt-get install -y build-essential | |
echo $conda_env_prefix | |
sed -i 's/- pip:/- pip:\n - --extra-index-url https:\/\/download.pytorch.org\/whl\/cpu/' $model_eval_conda_yaml | |
sed -i 's/=={{latest-pypi-version}}//g' $model_eval_conda_yaml | |
sed -i 's/=={{latest-pypi-version:pre}}//g' $model_eval_conda_yaml | |
echo " - pytest" >> $model_eval_conda_yaml | |
echo " - pytest-xdist" >> $model_eval_conda_yaml | |
cat $model_eval_conda_yaml | |
conda env create -p $conda_env_prefix -f $model_eval_conda_yaml | |
echo "conda env successfully created at $conda_env_prefix" | |
conda list -p $conda_env_prefix | |
- name: Execute tests | |
run: conda run -p $conda_env_prefix python -m pytest $model_eval_unittests_dir --tb=native --junitxml=$pytest_reports/test-result.xml -x -n 1 -ra --show-capture=no | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
check_name: Test Results for ${{ github.workflow }} | |
junit_files: ${{ env.pytest_reports }}/**/*.xml |