diff options
| author | Árni Dagur <arni@dagur.eu> | 2021-02-01 17:59:51 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-01 17:59:51 +0000 |
| commit | dc33223fcb1583bf31b89474ec299d45d8f80ef0 (patch) | |
| tree | f3c0e12505f3191c20e959fe3e81da445a28c59f /.github/workflows | |
| parent | d0dbf823b7ce627ee77067cd87188fa9995ad783 (diff) | |
Packaging improvements (#34)
* Use maturin for PEP 517 compliancy
* Removing relative import in __init__.py
* Bump version to 0.4.2
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ci.yml | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68e1a10..806059d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml | |||
| @@ -4,6 +4,8 @@ on: | |||
| 4 | release: | 4 | release: |
| 5 | types: [created] | 5 | types: [created] |
| 6 | push: | 6 | push: |
| 7 | branches: | ||
| 8 | - master | ||
| 7 | pull_request: | 9 | pull_request: |
| 8 | schedule: | 10 | schedule: |
| 9 | # Runs every Thursday at 20:23 GMT to avoid bit rot | 11 | # Runs every Thursday at 20:23 GMT to avoid bit rot |
| @@ -69,7 +71,7 @@ jobs: | |||
| 69 | - name: Install dependencies | 71 | - name: Install dependencies |
| 70 | run: | | 72 | run: | |
| 71 | python -m pip install --upgrade pip | 73 | python -m pip install --upgrade pip |
| 72 | pip install poetry | 74 | pip install poetry twine |
| 73 | poetry install | 75 | poetry install |
| 74 | 76 | ||
| 75 | - name: Set Rust target environment variable | 77 | - name: Set Rust target environment variable |
| @@ -84,15 +86,17 @@ jobs: | |||
| 84 | override: true | 86 | override: true |
| 85 | 87 | ||
| 86 | - name: Build Python package | 88 | - name: Build Python package |
| 87 | if: matrix.architecture == 'x86' | 89 | run: poetry run maturin build --interpreter python${{matrix.python_version}} --target ${{ env.ACTIONS_RUST_TARGET }} |
| 88 | run: poetry run maturin build --target ${{ env.ACTIONS_RUST_TARGET }} | ||
| 89 | 90 | ||
| 90 | - name: Build Python package | 91 | - name: Check wheels with Twine |
| 91 | if: matrix.architecture != 'x86' | 92 | run: twine check target/wheels/* |
| 92 | run: poetry run maturin develop | 93 | shell: bash |
| 94 | |||
| 95 | - name: Install Python package | ||
| 96 | run: poetry run pip install target/wheels/adblock*.whl | ||
| 97 | shell: bash | ||
| 93 | 98 | ||
| 94 | - name: Run Python tests | 99 | - name: Run Python tests |
| 95 | if: matrix.architecture != 'x86' | ||
| 96 | run: poetry run pytest -vv --color=yes | 100 | run: poetry run pytest -vv --color=yes |
| 97 | 101 | ||
| 98 | python-publish: | 102 | python-publish: |
| @@ -133,10 +137,10 @@ jobs: | |||
| 133 | - name: Install dependencies | 137 | - name: Install dependencies |
| 134 | run: | | 138 | run: | |
| 135 | python -m pip install --upgrade pip | 139 | python -m pip install --upgrade pip |
| 136 | pip install poetry | 140 | pip install poetry twine |
| 137 | poetry install | 141 | poetry install |
| 138 | - name: Build Python package | 142 | - name: Build Python package |
| 139 | run: poetry run maturin build --release --no-sdist --strip --interpreter python${{matrix.python_version}} --target ${{ env.ACTIONS_RUST_TARGET }} | 143 | run: poetry run maturin build --release --strip --interpreter python${{matrix.python_version}} --target ${{ env.ACTIONS_RUST_TARGET }} |
| 140 | 144 | ||
| 141 | - name: List wheels | 145 | - name: List wheels |
| 142 | if: matrix.os == 'windows-latest' | 146 | if: matrix.os == 'windows-latest' |
| @@ -146,15 +150,9 @@ jobs: | |||
| 146 | if: matrix.os != 'windows-latest' | 150 | if: matrix.os != 'windows-latest' |
| 147 | run: find ./target/wheels/ | 151 | run: find ./target/wheels/ |
| 148 | 152 | ||
| 149 | # Note: Windows doesn't support glob | ||
| 150 | # https://stackoverflow.com/a/52481267/270334 | ||
| 151 | - name: Install wheels | 153 | - name: Install wheels |
| 152 | if: matrix.os == 'windows-latest' | ||
| 153 | run: pip install --find-links=target\wheels adblock | ||
| 154 | |||
| 155 | - name: Install wheels | ||
| 156 | if: matrix.os != 'windows-latest' | ||
| 157 | run: pip install target/wheels/adblock*.whl | 154 | run: pip install target/wheels/adblock*.whl |
| 155 | shell: bash | ||
| 158 | 156 | ||
| 159 | - name: Release | 157 | - name: Release |
| 160 | uses: softprops/action-gh-release@v1 | 158 | uses: softprops/action-gh-release@v1 |
| @@ -167,8 +165,9 @@ jobs: | |||
| 167 | - name: PyPi publish | 165 | - name: PyPi publish |
| 168 | if: github.event_name == 'release' && github.event.action == 'created' | 166 | if: github.event_name == 'release' && github.event.action == 'created' |
| 169 | env: | 167 | env: |
| 170 | MATURIN_PASSWORD: ${{ secrets.PYPI }} | 168 | TWINE_PASSWORD: ${{ secrets.PYPI }} |
| 171 | run: poetry run maturin publish --interpreter python${{matrix.python_version}} --username __token__ | 169 | run: twine upload --non-interactive --skip-existing --username __token__ target/wheels/* |
| 170 | shell: bash | ||
| 172 | 171 | ||
| 173 | docs-publish: | 172 | docs-publish: |
| 174 | runs-on: ubuntu-latest | 173 | runs-on: ubuntu-latest |
