OpenC3/cosmos

View on GitHub
.github/workflows/python_unit_tests.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

# Reference environment variables: https://docs.github.com/en/actions/reference/environment-variables

name: OpenC3 Python Unit Tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  OPENC3_CLOUD: local

jobs:
  unit-test:
    if: ${{ github.actor != 'dependabot[bot]' }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.10", "3.11"]

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install -r requirements-dev.txt
        working-directory: openc3/python
      - name: Lint with ruff
        run: |
          ruff --format=github openc3
        working-directory: openc3/python
      - name: Run unit tests
        run: |
          coverage run -m pytest ./test/
          coverage xml -i
        working-directory: openc3/python
      - uses: codecov/codecov-action@v4
        with:
          working-directory: openc3/python
          flags: python # See codecov.yml
          token: ${{ secrets.CODECOV_TOKEN }}