mirror of
https://github.com/roapi/roapi.git
synced 2026-06-05 21:04:02 +08:00
244 lines
8.9 KiB
YAML
244 lines
8.9 KiB
YAML
name: columnq-cli release
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '.github/workflows/columnq_cli_release.yml'
|
|
- 'columnq/**'
|
|
- 'columnq-cli/**'
|
|
- 'Cargo.lock'
|
|
branches: [ main ]
|
|
tags: [ 'columnq-cli-v*' ]
|
|
|
|
env:
|
|
# NOTE: the version is also defined in build.yml and Dockerfile
|
|
RUST_TC_NIGHTLY_VER: "2023-09-15"
|
|
|
|
jobs:
|
|
# skip tag version validation on non-release branch run
|
|
validate-release-tag:
|
|
name: Validate git tag
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
- name: compare git tag with cargo metadata
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
run: |
|
|
PUSHED_TAG=${GITHUB_REF##*/}
|
|
CURR_VER=$( grep version columnq-cli/Cargo.toml | head -n 1 | awk '{print $3}' | tr -d '"' )
|
|
if [[ "${PUSHED_TAG}" != "columnq-cli-v${CURR_VER}" ]]; then
|
|
echo "Cargo metadata has version set to ${CURR_VER}, but got pushed tag ${PUSHED_TAG}."
|
|
exit 1
|
|
fi
|
|
|
|
macos:
|
|
needs: validate-release-tag
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.6
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-${{ env.RUST_TC_NIGHTLY_VER }}
|
|
target: aarch64-apple-darwin
|
|
profile: minimal
|
|
default: true
|
|
- name: Install maturin
|
|
run: pip3 install 'maturin<0.12'
|
|
- name: Build wheels - x86_64
|
|
run: |
|
|
maturin build -m columnq-cli/Cargo.toml -b bin --target x86_64-apple-darwin --release --out dist --cargo-extra-args="--features=simd,database-sqlite"
|
|
pip install columnq-cli --no-index --find-links dist --force-reinstall
|
|
- name: Build wheels - universal2
|
|
env:
|
|
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
|
|
MACOSX_DEPLOYMENT_TARGET: '10.9'
|
|
run: |
|
|
# set SDKROOT for C dependencies
|
|
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
|
|
maturin build -m columnq-cli/Cargo.toml -b bin --release --universal2 --out dist --no-sdist --cargo-extra-args="--features=simd,database-sqlite"
|
|
pip install columnq-cli --no-index --find-links dist --force-reinstall
|
|
columnq --help
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: wheels
|
|
path: dist
|
|
- name: Archive binary
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
run: tar czvf target/release/columnq-cli.tar.gz -C target/release columnq
|
|
- name: Upload binary to GitHub Release
|
|
uses: svenstaro/upload-release-action@v2
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
with:
|
|
overwrite: true
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
asset_name: columnq-cli-apple-darwin.tar.gz
|
|
file: target/release/columnq-cli.tar.gz
|
|
tag: ${{ github.ref }}
|
|
|
|
windows:
|
|
needs: validate-release-tag
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- python-architecture: "x64"
|
|
target: "x86_64-pc-windows-msvc"
|
|
features: "simd,database-sqlite"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.6
|
|
architecture: ${{ matrix.platform.python-architecture }}
|
|
- name: Install Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly-${{ env.RUST_TC_NIGHTLY_VER }}
|
|
target: ${{ matrix.platform.target }}
|
|
profile: minimal
|
|
default: true
|
|
- name: Install maturin
|
|
run: pip3 install 'maturin<0.12'
|
|
- name: Build wheels
|
|
run: |
|
|
maturin build -m columnq-cli/Cargo.toml -b bin --release --out dist --no-sdist --target ${{ matrix.platform.target }} --cargo-extra-args="--features=${{ matrix.platform.features }}"
|
|
pip install columnq-cli --no-index --find-links dist --force-reinstall
|
|
columnq --help
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: wheels
|
|
path: dist
|
|
- name: Archive binary
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
run: tar czvf target/release/columnq-cli.tar.gz -C target/${{ matrix.platform.target }}/release columnq.exe
|
|
- name: Upload binary to GitHub Release
|
|
uses: svenstaro/upload-release-action@v2
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
with:
|
|
overwrite: true
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
asset_name: columnq-cli-windows.tar.gz
|
|
file: target/release/columnq-cli.tar.gz
|
|
tag: ${{ github.ref }}
|
|
|
|
linux:
|
|
needs: validate-release-tag
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- manylinux: "2010"
|
|
target: "x86_64-unknown-linux-musl"
|
|
image_tag: "x86_64-musl"
|
|
features: "simd,rustls,database-sqlite"
|
|
rustflags: "-C target-cpu=skylake"
|
|
name_suffix: ""
|
|
upload: "true"
|
|
# - manylinux: "2010"
|
|
# target: "x86_64-unknown-linux-musl"
|
|
# image_tag: "x86_64-musl"
|
|
# features: "simd,native-tls,database-sqlite"
|
|
# rustflags: "-C target-cpu=skylake"
|
|
# name_suffix: "-openssl"
|
|
# upload: "false"
|
|
- manylinux: '2014'
|
|
target: "aarch64-unknown-linux-musl"
|
|
image_tag: "aarch64-musl"
|
|
rustflags: ""
|
|
features: "rustls,database-sqlite"
|
|
name_suffix: ""
|
|
upload: "true"
|
|
# - manylinux: '2014'
|
|
# target: "aarch64-unknown-linux-musl"
|
|
# image_tag: "aarch64-musl"
|
|
# features: "native-tls,database-sqlite"
|
|
# name_suffix: "-openssl"
|
|
# rustflags: ""
|
|
# upload: "false"
|
|
# - manylinux: '2014'
|
|
# target: "armv7-unknown-linux-musleabihf"
|
|
# image_tag: "armv7-musleabihf"
|
|
# rustflags: ""
|
|
# features: "rustls,database-sqlite"
|
|
# name_suffix: ""
|
|
# upload: "true"
|
|
# - manylinux: '2014'
|
|
# target: "armv7-unknown-linux-musleabihf"
|
|
# image_tag: "armv7-musleabihf"
|
|
# rustflags: ""
|
|
# features: "native-tls,database-sqlite"
|
|
# name_suffix: "-openssl"
|
|
# upload: "false"
|
|
container:
|
|
image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }}
|
|
env:
|
|
RUSTUP_HOME: /root/.rustup
|
|
CARGO_HOME: /root/.cargo
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install Rust toolchain
|
|
run: |
|
|
rustup update nightly-${{ env.RUST_TC_NIGHTLY_VER }}
|
|
rustup target add \
|
|
--toolchain nightly-${{ env.RUST_TC_NIGHTLY_VER }} \
|
|
${{ matrix.platform.target }}
|
|
rustup default nightly-${{ env.RUST_TC_NIGHTLY_VER }}
|
|
- name: Install build deps
|
|
if: "contains(matrix.platform.name_suffix, 'openssl')"
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y libssl-dev
|
|
- name: Build Wheels
|
|
run: |
|
|
sudo python3 -m pip install 'maturin<0.12'
|
|
export RUSTFLAGS='${{ matrix.platform.rustflags }}'
|
|
maturin build -m columnq-cli/Cargo.toml -b bin --no-sdist --release -o dist \
|
|
--target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} \
|
|
--cargo-extra-args="--no-default-features --features=${{ matrix.platform.features }}"
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v2
|
|
if: "matrix.platform.upload == 'true'"
|
|
with:
|
|
name: wheels
|
|
path: dist
|
|
- name: Archive binary
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
run: tar czvf target/release/columnq-cli.tar.gz -C target/${{ matrix.platform.target }}/release columnq
|
|
- name: Upload binary to GitHub Release
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
overwrite: true
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
asset_name: columnq-cli-${{ matrix.platform.target }}${{ matrix.platform.name_suffix }}.tar.gz
|
|
file: target/release/columnq-cli.tar.gz
|
|
tag: ${{ github.ref }}
|
|
|
|
pypi_release:
|
|
needs: [ validate-release-tag, linux, macos, windows ]
|
|
name: PyPI Release
|
|
runs-on: ubuntu-latest
|
|
if: "startsWith(github.ref, 'refs/tags/')"
|
|
steps:
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: wheels
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
- name: Publish to PyPi
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.COLUMNQ_CLI_PYPI_TOKEN }}
|
|
run: |
|
|
pip install --upgrade twine
|
|
twine upload --skip-existing *
|