CD #43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
env: | |
CACHE_SUFFIX: a | |
on: | |
workflow_dispatch: | |
push: | |
tags: ["v*"] | |
jobs: | |
linux: | |
name: Release - ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
image: manylinux_2_28_x86_64 | |
- target: aarch64-unknown-linux-gnu | |
image: manylinux_2_28_aarch64 | |
env: | |
TARGET: ${{ matrix.target }} | |
TOOLCHAIN: stable-${{ matrix.target }} | |
IMAGE: ${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
if: matrix.image == 'manylinux_2_28_aarch64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Build | |
run: | | |
CID=$(docker create -t -w /tmp/libsql -v $PWD:/tmp/src:ro -e TARGET quay.io/pypa/$IMAGE bash -c "\ | |
cp -r /tmp/src/. . && \ | |
rm -rf ./dist && \ | |
export PATH=/root/.cargo/bin:\$PATH && \ | |
export USER=root && \ | |
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \ | |
rustup toolchain install --no-self-update $TOOLCHAIN && \ | |
rustup default $TOOLCHAIN && \ | |
dnf install jq zip -y && \ | |
./package.sh $TARGET ./Cargo.toml") | |
docker start -ai $CID | |
mkdir -p dist | |
docker cp $CID:/tmp/libsql/dist/. dist/. | |
docker rm $CID | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: ${{ matrix.TARGET }} | |
windows: | |
name: Release - ${{ matrix.target }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- target: x86_64-pc-windows-msvc | |
toolchain: stable-msvc | |
- target: aarch64-pc-windows-msvc | |
toolchain: stable-msvc | |
- target: x86_64-pc-windows-gnu | |
toolchain: stable-gnu | |
env: | |
TARGET: ${{ matrix.target }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
- name: Install zip | |
run: choco install zip --allow-empty-checksums | |
- name: Build | |
run: ./package.sh $TARGET ./Cargo.toml && ls | |
shell: bash | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: ${{ matrix.TARGET }} | |
macos: | |
name: Release - ${{ matrix.name }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- name: macos-x86_64 | |
target: x86_64-apple-darwin | |
- name: macos-aarch64 | |
target: aarch64-apple-darwin | |
- name: ios-aarch64 | |
target: aarch64-apple-ios | |
- name: ios-sim-aarch64 | |
target: aarch64-apple-ios-sim | |
env: | |
TARGET: ${{ matrix.target }} | |
MACOSX_DEPLOYMENT_TARGET: "10.13" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
- name: Build | |
run: ./package.sh $TARGET ./Cargo.toml | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: ${{ matrix.TARGET }} | |
publish: | |
name: Publish Github release | |
needs: | |
- linux | |
- windows | |
- macos | |
runs-on: ubuntu-latest | |
if: success() && contains(github.ref, 'tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set version (which gets used as release name) | |
run: | | |
echo "LIBSQLC_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Download assets | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.LIBSQLC_VERSION }} | |
name: ${{ env.LIBSQLC_VERSION }} | |
files: | | |
dist/**/*.zip | |
body: | | |
Autogenerated binary modules. | |
The Linux builds are built on AlmaLinux 8 [manylinux_2_28](https://github.com/pypa/manylinux#manylinux). | |
The MacOS builds target MacOS 10.13 High Sierra and up. | |
The Windows builds are built using MSVC on all architectures and GNU on x64. | |
draft: true | |
prerelease: false |