removed some tests for now #106
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 PICA JOSS Tests | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ------------------------------------------------------------------------ | |
| # PHASE 1: SETUP | |
| # ------------------------------------------------------------------------ | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Cache pip dependencies | |
| id: cache-pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| # The key invalidates the cache if requirements change | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install Dependencies | |
| # Use a dedicated step for installing dependencies. | |
| # The 'if' condition prevents re-installing if the cache was restored. | |
| if: steps.cache-pip.outputs.cache-hit != 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest flake8 pytest-cov | |
| # ------------------------------------------------------------------------ | |
| # PHASE 2: READYMADE TESTS (Standard Industry Checks) | |
| # ------------------------------------------------------------------------ | |
| - name: Run Style & Syntax Check (Flake8) | |
| run: | | |
| echo "STEP 1: Checking for critical syntax errors..." | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| echo "STEP 2: Checking for code style warnings..." | |
| flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics | |
| # ------------------------------------------------------------------------ | |
| # PHASE 3: COMBINED TESTS (Generates both coverage and test results) | |
| # ------------------------------------------------------------------------ | |
| - name: Run All Tests and Generate Reports | |
| run: | | |
| echo "--------------------------------------" | |
| echo "GOAL: Generate coverage.xml and junit.xml" | |
| # This command runs all tests, generates XML coverage, and JUnit XML. | |
| pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/ | |
| # ------------------------------------------------------------------------ | |
| # PHASE 4: CODECOV UPLOADS | |
| # ------------------------------------------------------------------------ | |
| - name: Upload Coverage Report (XML) | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: true # It's good practice to fail if coverage upload fails. | |
| - name: Upload Test Results to Codecov (JUnit) | |
| if: always() # This ensures test results are uploaded even if previous steps fail. | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./junit.xml | |
| # This step uploads test timing and failure data |