WenjieDu/PyPOTS

View on GitHub
.github/workflows/testing_daily.yml

Summary

Maintainability
Test Coverage
name: Daily Testing

on:
    schedule:
        # https://crontab.guru. Run everyday at 0:00AM UTC, i.e. 08:00AM Beijing, i.e. 08:00PM Montreal (summer time)
        - cron: "0 0 * * *"
    push:
        branches:
            - temp_test_branch  # if in need, create such a temporary branch to test some functions

jobs:
    Daily-testing:
        runs-on: ${{ matrix.os }}
        defaults:
            run:
                shell: bash -l {0}
        strategy:
            fail-fast: false
            matrix:
                os: [ ubuntu-latest, windows-latest, macOS-latest ]
                python-version: [ "3.8" ]
                pytorch-version: ["2.3.0"]

        steps:
            - name: Check out the repo code
              uses: actions/checkout@v3


            - name: Set up Conda
              uses: conda-incubator/setup-miniconda@v2
              with:
                  miniconda-version: "latest"
                  activate-environment: pypots
                  python-version: ${{ matrix.python-version }}
                  environment-file: requirements/conda_dev_env.yml
                  auto-activate-base: false

            - name: Fetch the test environment details
              run: |
                  # many libs not compatible with numpy 2.0. Note 3.12 requests for numpy>=2.0. fix pandas version to avoid installing pandas 2.0, the same reason with numpy
                  conda install -c conda-forge numpy=1.24 pandas=1.5
                  which python
                  conda info
                  conda list

            - name: Replace with the latest PyPOTS code for testing
              run: |
                  python_site_path=`python -c "import site; print(site.getsitepackages()[0])"`
                  echo "python site-packages path: $python_site_path"
                  rm -rf $python_site_path/pypots
                  python -c "import shutil;import site;shutil.copytree('pypots',site.getsitepackages()[0]+'/pypots')"

            - name: Test with pytest
              run: |
                  rm -rf testing_results && rm -rf tests/__pycache__ && rm -rf tests/*/__pycache__
                  python tests/global_test_config.py
                  python -m pytest -rA tests/*/* -s -n auto --cov=pypots --dist=loadgroup --cov-config=.coveragerc

            - name: Generate the LCOV report
              run: |
                  python -m coverage lcov

            - name: Submit the report
              uses: coverallsapp/github-action@master
              continue-on-error: true
              with:
                  github-token: ${{ secrets.GITHUB_TOKEN }}
                  path-to-lcov: 'coverage.lcov'