Fix a Sourcery warning #42
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 CI Checks | |
| on: [push, pull_request] | |
| jobs: | |
| detect-source-changes: | |
| name: Detect Source Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| source_changed: ${{ steps.filter.outputs.source }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Detect Source Changes | |
| id: filter | |
| uses: dorny/paths-filter@v4.0.1 | |
| with: | |
| filters: | | |
| source: | |
| - 'seiscat/**' | |
| test: | |
| name: Run Tests | |
| needs: | |
| - detect-source-changes | |
| if: needs.detect-source-changes.outputs.source_changed == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Display Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip wheel | |
| python -m pip install "setuptools>=65" | |
| # install obspy from git master branch | |
| # to ensure compatibility with Python 3.12+ | |
| python -m pip install "git+https://github.com/obspy/obspy.git@master" | |
| python -m pip install . | |
| python -m pip install pytest pytest-cov | |
| - name: Run tests with coverage | |
| run: | | |
| pytest --cov --cov-branch --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| slug: SeismicSource/seiscat | |
| dist: | |
| name: Build Distribution Packages | |
| needs: | |
| - detect-source-changes | |
| - test | |
| if: >- | |
| always() && | |
| (needs.detect-source-changes.outputs.source_changed != 'true' || | |
| needs.test.result == 'success') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Build Wheel and Source Distribution | |
| run: pipx run build | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: dist/* | |
| - name: Validate Package Metadata | |
| run: pipx run twine check dist/* |