Merge pull request #66 from Global-Health-Engineering/dev #59
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: CI | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths: | |
| - 'src/ghe_transcribe/**' | |
| - '!src/ghe_transcribe/_version.py' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| - '.github/workflows/ci.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'src/ghe_transcribe/**' | |
| - '!src/ghe_transcribe/_version.py' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| - '.github/workflows/ci.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| test-dev: | |
| if: github.ref == 'refs/heads/dev' | |
| name: Test Python 3.11 on ubuntu-latest | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Run type checking | |
| run: mypy src/ | |
| continue-on-error: true | |
| - name: Run tests | |
| env: | |
| HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} | |
| run: python -m pytest tests/ -v --tb=short --junitxml=pytest.xml | |
| - name: Upload test results | |
| uses: mikepenz/action-junit-report@v4 | |
| if: always() | |
| with: | |
| report_paths: pytest.xml | |
| check_name: Test Results (Python 3.11, ubuntu-latest) | |
| test-full: | |
| if: github.ref != 'refs/heads/dev' | |
| name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Run type checking | |
| run: mypy src/ | |
| continue-on-error: true | |
| - name: Run tests | |
| env: | |
| HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} | |
| run: python -m pytest tests/ -v --tb=short --junitxml=pytest.xml | |
| - name: Upload test results | |
| uses: mikepenz/action-junit-report@v4 | |
| if: always() | |
| with: | |
| report_paths: pytest.xml | |
| check_name: Test Results (Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
| security: | |
| name: Security scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| - name: Upload Trivy scan results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-results.sarif' |