|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + runs-on: ${{ matrix.os }} |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ ubuntu-latest, macos-latest ] |
| 14 | + python-version: [ '3.10', '3.11' ] |
| 15 | + steps: |
| 16 | + - name: Cleanup more disk space |
| 17 | + run: | |
| 18 | + sudo rm -rf /usr/share/dotnet || true |
| 19 | + sudo rm -rf /opt/ghc || true |
| 20 | + sudo rm -rf "/usr/local/share/boost" || true |
| 21 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" || true |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v5 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + cache: 'pip' |
| 28 | + - name: Install dependencies (Linux) |
| 29 | + if: runner.os == 'Linux' |
| 30 | + run: | |
| 31 | + python -m pip install --upgrade pip |
| 32 | + pip install flake8 |
| 33 | + pip install -e ".[dev,gpu]" --extra-index-url https://download.pytorch.org/whl/cu121 |
| 34 | + - name: Install dependencies (macOS) |
| 35 | + if: runner.os == 'macOS' |
| 36 | + run: | |
| 37 | + python -m pip install --upgrade pip |
| 38 | + pip install flake8 |
| 39 | + pip install -e ".[dev]" |
| 40 | + - name: Lint with flake8 |
| 41 | + run: | |
| 42 | + # stop the build if there are Python syntax errors or undefined names |
| 43 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 44 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 45 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 46 | + - name: Test with pytest |
| 47 | + run: | |
| 48 | + pytest |
| 49 | +
|
| 50 | + publish: |
| 51 | + needs: build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + permissions: |
| 54 | + id-token: write |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + - name: Set up Python |
| 58 | + uses: actions/setup-python@v5 |
| 59 | + with: |
| 60 | + python-version: '3.11' |
| 61 | + - name: Install build tools |
| 62 | + run: | |
| 63 | + python -m pip install --upgrade pip |
| 64 | + pip install build |
| 65 | + - name: Build package |
| 66 | + run: | |
| 67 | + python -m build |
| 68 | + - name: Publish to PyPI |
| 69 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments