Run Unit Tests CI #1233
This file contains hidden or 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: Run Unit Tests CI | |
| on: | |
| schedule: | |
| # Runs at 09Z (2am CDT) | |
| - cron: "0 9 * * *" | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| # Cancel concurrent runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| ARM_USERNAME: ${{ secrets.ARM_USERNAME }} | |
| ARM_PASSWORD: ${{ secrets.ARM_PASSWORD }} | |
| AIRNOW_API: ${{ secrets.AIRNOW_API }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COVERALLS_TOKEN: ${{ secrets.COVERLALLS_REPO_TOKEN }} | |
| AMERIFLUX_EMAIL: ${{ secrets.AMERIFLUX_EMAIL }} | |
| AMERIFLUX_USERNAME: ${{ secrets.AMERIFLUX_USERNAME }} | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }}-${{ matrix.python-version }} | |
| if: github.repository == 'ARM-DOE/ACT' | |
| runs-on: ${{ matrix.os }}-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| os: [macOS, ubuntu, Windows] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Conda Environment | |
| uses: mamba-org/[email protected] | |
| with: | |
| create-args: python=${{ matrix.python-version }} | |
| environment-file: ./continuous_integration/environment_actions.yml | |
| init-shell: >- | |
| bash | |
| cache-downloads: true | |
| post-cleanup: "all" | |
| - name: Fetch all history for all tags and branches | |
| run: | | |
| git fetch --prune --unshallow | |
| - name: Install ACT | |
| run: | | |
| python -m pip install -e . --no-deps --force-reinstall | |
| - name: Run Linting | |
| shell: bash -l {0} | |
| run: | | |
| ruff check . | |
| - name: Test with pytest | |
| run: | | |
| python -m pytest -v --mpl --cov=./ --cov-report=xml | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| env_vars: OS,PYTHON | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |