WenjieDu/TSDB

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:
            - run_daily_testing  # if in need, create such a temporary branch to run daily testing

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.7", "3.11"]

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

            - name: Set up Conda
              uses: conda-incubator/setup-miniconda@v2
              with:
                  activate-environment: tsdb-test
                  python-version: ${{ matrix.python-version }}
                  environment-file: tests/environment_for_conda_test.yml
                  auto-activate-base: false

            - name: Fetch the test environment details
              run: |
                  which python
                  conda info
                  conda list

            - name: Test with pytest
              run: |
                  python -m pytest -rA tests/test_tsdb.py -s --cov=tsdb

            - 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'