|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + types: [opened, edited, synchronize] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build wheels |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + python-version: ["3.11", "3.x"] |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Install CPython |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + |
| 28 | + - name: Install deps |
| 29 | + run: | |
| 30 | + pip install -U wheel setuptools pip Cython |
| 31 | + pip install -Ur requirements.txt |
| 32 | +
|
| 33 | + - name: Build wheels |
| 34 | + run: pip wheel -w ./wheelhouse/ . |
| 35 | + |
| 36 | + - uses: actions/upload-artifact@v4 |
| 37 | + with: |
| 38 | + name: artifact-wheels-${{ matrix.python-version }} |
| 39 | + path: ./wheelhouse/twitchio-ext-oauth-relay*.whl |
| 40 | + |
| 41 | + sdist: |
| 42 | + name: Make source distribution |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - run: pipx run build --sdist |
| 48 | + |
| 49 | + - uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: artifact-source-dist |
| 52 | + path: "./**/dist/*.tar.gz" |
| 53 | + |
| 54 | + lint: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + matrix: |
| 59 | + python-version: ["3.11", "3.x"] |
| 60 | + |
| 61 | + name: "Type Coverage and Linting @ ${{ matrix.python-version }}" |
| 62 | + steps: |
| 63 | + - name: "Checkout Repository" |
| 64 | + uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - name: "Setup Python @ ${{ matrix.python-version }}" |
| 69 | + id: setup-python |
| 70 | + uses: actions/setup-python@v5 |
| 71 | + with: |
| 72 | + python-version: "${{ matrix.python-version }}" |
| 73 | + cache: "pip" |
| 74 | + |
| 75 | + - name: "Install Python deps @ ${{ matrix.python-version }}" |
| 76 | + run: | |
| 77 | + pip install -Ur requirements.txt |
| 78 | +
|
| 79 | + - name: "Run Pyright @ ${{ matrix.python-version }}" |
| 80 | + uses: jakebailey/pyright-action@v2 |
| 81 | + with: |
| 82 | + version: 1.1.398 |
| 83 | + annotate: ${{ matrix.python-version != '3.x' }} |
| 84 | + warnings: false |
| 85 | + |
| 86 | + - name: Lint with Ruff |
| 87 | + uses: astral-sh/ruff-action@v3 |
| 88 | + with: |
| 89 | + version: "0.11.2" |
| 90 | + |
| 91 | + - name: Check formatting with Ruff |
| 92 | + run: | |
| 93 | + ruff format --check |
| 94 | +
|
| 95 | + upload_pypi: |
| 96 | + if: github.event_name == 'push' && github.ref_type == 'tag' |
| 97 | + name: Publish built wheels to Pypi |
| 98 | + runs-on: ubuntu-latest |
| 99 | + environment: release |
| 100 | + needs: [build, sdist] |
| 101 | + permissions: |
| 102 | + id-token: write |
| 103 | + |
| 104 | + steps: |
| 105 | + - uses: actions/download-artifact@v4 |
| 106 | + |
| 107 | + - name: Copy artifacts to dist/ folder |
| 108 | + run: | |
| 109 | + find . -name 'artifact-*' -exec unzip '{}' \; |
| 110 | + mkdir -p dist/ |
| 111 | + find . -name '*.tar.gz' -exec mv '{}' dist/ \; |
| 112 | + find . -name '*.whl' -exec mv '{}' dist/ \; |
| 113 | +
|
| 114 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 115 | + name: Publish to PyPI |
0 commit comments