HajimeKawahara/exojax

View on GitHub
.github/workflows/main.yml

Summary

Maintainability
Test Coverage
name: Run pytest
on:
  # Triggers the workflow on push or pull request events but only for the "develop" and "master" branch
  push:
    branches: [ "develop" , "master"]
  pull_request:
    branches: [ "develop" , "master"]


jobs:
  pytest:
    runs-on: ubuntu-latest

    steps:
      # Checkout repository
      - name: Checkout
        uses: actions/checkout@v4

      # Setup Python
      - name: Set up Python 3.11
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      # install package      
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python setup.py install

      # install pytest
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest

      # pytest -> JUnit xml
      - name: PyTest
        run: |
          python -m pytest tests/unittests --junit-xml results/pytest.xml
        continue-on-error: true

      # show the results
      - name: Upload Unit Test Results
        if: ${{ always() }}
        uses: actions/upload-artifact@v4
        with:
          name: Unit Test Results (Python 3.10)
          path: results/*.xml

      - name: Download Artifacts
        if: success() || failure()
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: Publish Unit Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
          files: artifacts/**/*.xml