Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 121 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: "release"
name: "Release"
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
build-ubuntu:
name: Build ubuntu-20.04
runs-on: ubuntu-20.04
build-ubuntu-extension:
name: Build ubuntu
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
Expand All @@ -29,7 +29,25 @@ jobs:
with:
name: sqlite-regex-ubuntu
path: dist/release/regex0.so
build-macos:
build-ubuntu-python:
runs-on: ubuntu-18.04
needs: [build-ubuntu-extension]
steps:
- uses: actions/checkout@v3
- name: Download workflow artifacts
uses: actions/download-artifact@v3
with:
name: sqlite-regex-ubuntu
path: dist/release/
- uses: actions/setup-python@v3
- run: pip install wheel
- run: make python-release
- run: make datasette-release
- uses: actions/upload-artifact@v3
with:
name: sqlite-regex-ubuntu-wheels
path: dist/release/wheels/*.whl
build-macos-extension:
name: Build macos-latest
runs-on: macos-latest
steps:
Expand All @@ -52,7 +70,25 @@ jobs:
with:
name: sqlite-regex-macos
path: dist/release/regex0.dylib
build-macos-arm:
build-macos-python:
runs-on: macos-latest
needs: [build-macos-extension]
steps:
- uses: actions/checkout@v3
- name: Download workflow artifacts
uses: actions/download-artifact@v3
with:
name: sqlite-regex-macos
path: dist/release/
- uses: actions/setup-python@v3
- run: pip install wheel
- run: make python-release
- run: make datasette-release
- uses: actions/upload-artifact@v3
with:
name: sqlite-regex-macos-wheels
path: dist/release/wheels/*.whl
build-macos-arm-extension:
name: Build macos-latest with arm
runs-on: macos-latest
steps:
Expand All @@ -70,14 +106,31 @@ jobs:
with:
toolchain: stable
- run: rustup target add aarch64-apple-darwin
- run: make target=aarch64-apple-darwin loadable
#- run: make test
- run: make loadable-release target=aarch64-apple-darwin
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: sqlite-regex-macos-arm
path: dist/debug/regex0.dylib
build-windows:
path: dist/release/regex0.dylib
build-macos-arm-python:
runs-on: macos-latest
needs: [build-macos-arm-extension]
steps:
- uses: actions/checkout@v3
- name: Download workflow artifacts
uses: actions/download-artifact@v3
with:
name: sqlite-regex-macos-arm
path: dist/release/
- uses: actions/setup-python@v3
- run: pip install wheel
- run: make python-release IS_MACOS_ARM=1
- run: make datasette-release
- uses: actions/upload-artifact@v3
with:
name: sqlite-regex-macos-arm-wheels
path: dist/release/wheels/*.whl
build-windows-extension:
name: Build windows-latest
runs-on: windows-latest
steps:
Expand All @@ -100,19 +153,74 @@ jobs:
with:
name: sqlite-regex-windows
path: dist/release/regex0.dll
upload:
name: upload
needs: [build-macos, build-macos-arm, build-ubuntu, build-windows]
build-windows-python:
runs-on: windows-latest
needs: [build-windows-extension]
steps:
- uses: actions/checkout@v3
- name: Download workflow artifacts
uses: actions/download-artifact@v3
with:
name: sqlite-regex-windows
path: dist/release/
- uses: actions/setup-python@v3
- run: pip install wheel
- run: make python-release
- run: make datasette-release
- uses: actions/upload-artifact@v3
with:
name: sqlite-regex-windows-wheels
path: dist/release/wheels/*.whl
upload-release-assets:
name: Upload release assets
needs:
[
build-macos-extension,
build-macos-arm-extension,
build-ubuntu-extension,
build-windows-extension,
]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download workflow artifacts
uses: actions/download-artifact@v2
- run: npm install tar-fs
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const script = require('.github/workflows/upload.js')
await script({github, context})
upload_pypi:
needs:
[
build-ubuntu-python,
build-macos-python,
build-macos-arm-python,
build-windows-python,
]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: sqlite-regex-windows-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: sqlite-regex-ubuntu-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: sqlite-regex-macos-wheels
path: dist
- uses: actions/download-artifact@v3
with:
name: sqlite-regex-macos-arm-wheels
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
36 changes: 36 additions & 0 deletions .github/workflows/rename-wheels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is a small utility that rename all .whl files in a given directory
# and "generalizes" them. The wheels made by python/sqlite_ulid contain the
# pre-compiled sqlite extension, but those aren't bound by a specfic Python
# runtime or version, that other wheels might be. So, this file will rename
# those wheels to be "generalized", like replacing "c37-cp37" to "py3-none".
import sys
import os
from pathlib import Path

wheel_dir = sys.argv[1]

is_macos_arm_build = '--is-macos-arm' in sys.argv

for filename in os.listdir(wheel_dir):
filename = Path(wheel_dir, filename)
if not filename.suffix == '.whl':
continue
new_filename = (filename.name
.replace('cp37-cp37', 'py3-none')
.replace('cp38-cp38', 'py3-none')
.replace('cp39-cp39', 'py3-none')
.replace('cp310-cp310', 'py3-none')
.replace('cp311-cp311', 'py3-none')
.replace('linux_x86_64', 'manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux1_x86_64')


)
if is_macos_arm_build:
new_filename = new_filename.replace('macosx_12_0_universal2', 'macosx_11_0_arm64')
else:
new_filename = (new_filename
.replace('macosx_12_0_universal2', 'macosx_10_6_x86_64')
.replace('macosx_12_0_x86_64', 'macosx_10_6_x86_64')
)

os.rename(filename, Path(wheel_dir, new_filename))
Loading