From d697bf7ee74e0e3dc476c176a392269530ff6c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Mon, 30 Mar 2020 02:21:32 -0400 Subject: Yoink Hyperjson's deployment code --- .github/workflows/ci.yml | 71 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24f06e1..8d01138 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,4 +69,73 @@ jobs: override: true - name: Build Python package - run: poetry run maturin develop --release \ No newline at end of file + run: poetry run maturin develop --release + + python-publish: + needs: build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + os: [ubuntu-latest, macos-latest, windows-latest] + exclude: + # There is a known issue where Python C extensions + # can not be built on Python 3.5 on Windows. + # https://github.com/actions/virtual-environments/issues/34 + # Therefore, ujson can't be compiled and the build would fail. + - os: windows-latest + python-version: 3.5 + steps: + - uses: actions/checkout@v1 + + - uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + - name: Build Python package + run: poetry run maturin build --release --no-sdist --strip --interpreter python${{matrix.python_version}} + + - name: List wheels + if: matrix.os == 'windows-latest' + run: dir target\wheels\ + + - name: List wheels + if: matrix.os != 'windows-latest' + run: find ./target/wheels/ + + # Note: Windows doesn't support glob + # https://stackoverflow.com/a/52481267/270334 + - name: Install wheels + if: matrix.os == 'windows-latest' + run: pip install --find-links=target\wheels adblock + + - name: Install wheels + if: matrix.os != 'windows-latest' + run: pip install target/wheels/adblock*.whl + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: target/wheels/adblock*.whl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: PyPi publish + if: github.event_name == 'release' && github.event.action == 'created' + env: + MATURIN_PASSWORD: ${{ secrets.PYPI }} + run: poetry run maturin publish --username __token__ + -- cgit v1.2.3