|
| 1 | +name: Publish to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + id-token: write # required for Trusted Publisher (OIDC) |
| 11 | + |
| 12 | +jobs: |
| 13 | + lint: |
| 14 | + name: Lint |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v6 |
| 18 | + |
| 19 | + - uses: actions/setup-python@v6 |
| 20 | + with: |
| 21 | + python-version: "3.12" |
| 22 | + cache: pip |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: pip install -e ".[dev]" |
| 26 | + |
| 27 | + - name: Check lint |
| 28 | + run: ruff check . |
| 29 | + |
| 30 | + - name: Check format |
| 31 | + run: ruff format --check . |
| 32 | + |
| 33 | + typecheck: |
| 34 | + name: Type check |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v6 |
| 38 | + |
| 39 | + - uses: actions/setup-python@v6 |
| 40 | + with: |
| 41 | + python-version: "3.12" |
| 42 | + cache: pip |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: pip install -e ".[dev]" |
| 46 | + |
| 47 | + - name: Run pyright |
| 48 | + run: pyright src |
| 49 | + |
| 50 | + test: |
| 51 | + name: Test (Python ${{ matrix.python-version }}) |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: [lint, typecheck] |
| 54 | + strategy: |
| 55 | + fail-fast: false |
| 56 | + matrix: |
| 57 | + python-version: ["3.11", "3.12", "3.13", "3.14"] |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v6 |
| 61 | + |
| 62 | + - uses: actions/setup-python@v6 |
| 63 | + with: |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + cache: pip |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: pip install -e ".[dev]" |
| 69 | + |
| 70 | + - name: Core test suite |
| 71 | + run: python -m pytest tests --ignore=tests/test_validation.py |
| 72 | + |
| 73 | + - name: Validation tests |
| 74 | + run: python -m pytest tests/test_validation.py |
| 75 | + |
| 76 | + build: |
| 77 | + name: Build distribution |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: test |
| 80 | + |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v6 |
| 83 | + |
| 84 | + - uses: actions/setup-python@v6 |
| 85 | + with: |
| 86 | + python-version: "3.12" |
| 87 | + cache: pip |
| 88 | + |
| 89 | + - name: Install dependencies |
| 90 | + run: pip install -e ".[dev]" |
| 91 | + |
| 92 | + - name: Build sdist and wheel |
| 93 | + run: python -m build |
| 94 | + |
| 95 | + - name: Upload distribution artifacts |
| 96 | + uses: actions/upload-artifact@v7 |
| 97 | + with: |
| 98 | + name: dist |
| 99 | + path: dist/ |
| 100 | + |
| 101 | + publish: |
| 102 | + name: Publish to PyPI |
| 103 | + needs: build |
| 104 | + runs-on: ubuntu-latest |
| 105 | + environment: |
| 106 | + name: pypi |
| 107 | + url: https://pypi.org/p/cislunar-sim |
| 108 | + |
| 109 | + steps: |
| 110 | + - name: Download distribution artifacts |
| 111 | + uses: actions/download-artifact@v8 |
| 112 | + with: |
| 113 | + name: dist |
| 114 | + path: dist/ |
| 115 | + |
| 116 | + - name: Publish to PyPI |
| 117 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments