|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + branches: [main, master] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Test (Python ${{ matrix.python-version }}) |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + python-version: ['3.9', '3.10', '3.11', '3.12'] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up Python ${{ matrix.python-version }} |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install -e ".[dev]" |
| 30 | +
|
| 31 | + - name: Run tests with coverage |
| 32 | + run: | |
| 33 | + pytest tests/ -v --cov=gpuci --cov-report=xml --cov-report=term-missing |
| 34 | +
|
| 35 | + - name: Upload coverage to Codecov |
| 36 | + if: matrix.python-version == '3.11' |
| 37 | + uses: codecov/codecov-action@v4 |
| 38 | + with: |
| 39 | + files: ./coverage.xml |
| 40 | + fail_ci_if_error: false |
| 41 | + |
| 42 | + lint: |
| 43 | + name: Lint |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v5 |
| 50 | + with: |
| 51 | + python-version: '3.11' |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install -e ".[dev]" |
| 57 | +
|
| 58 | + - name: Run ruff |
| 59 | + run: ruff check gpuci/ tests/ |
| 60 | + |
| 61 | + - name: Run mypy |
| 62 | + run: mypy gpuci/ --ignore-missing-imports |
| 63 | + |
| 64 | + build: |
| 65 | + name: Build |
| 66 | + runs-on: ubuntu-latest |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Set up Python |
| 71 | + uses: actions/setup-python@v5 |
| 72 | + with: |
| 73 | + python-version: '3.11' |
| 74 | + |
| 75 | + - name: Install build tools |
| 76 | + run: pip install build |
| 77 | + |
| 78 | + - name: Build package |
| 79 | + run: python -m build |
| 80 | + |
| 81 | + - name: Check package |
| 82 | + run: | |
| 83 | + pip install twine |
| 84 | + twine check dist/* |
| 85 | +
|
| 86 | + - name: Upload artifacts |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: dist |
| 90 | + path: dist/ |
| 91 | + |
| 92 | + # Validates the GitHub Action itself |
| 93 | + action-test: |
| 94 | + name: Test Action |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Validate action.yml |
| 100 | + run: | |
| 101 | + python -c "import yaml; yaml.safe_load(open('action.yml'))" |
| 102 | + echo "action.yml is valid YAML" |
0 commit comments