Merge pull request #410 from unum-cloud/main-dev #8
This file contains 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: Release | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
env: | |
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} | |
jobs: | |
versioning: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
- run: cp .github/workflows/package.json . && npm install && npx semantic-release | |
# Single deploy job since we're just deploying | |
deploy: | |
name: Deploy Docs | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: versioning | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@v2 | |
- name: Install dependencies | |
run: sudo apt update && sudo apt install -y doxygen graphviz dia git && pip install sphinx breathe m2r2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery | |
- name: Clone Theme | |
run: git clone https://github.com/unum-cloud/www.unum.cloud-furo && cd www.unum.cloud-furo && pip install . && cd ../ | |
- name: Install UKV from PyPi | |
run: pip install ukv | |
- name: Fetch GoLang repo | |
run: git submodule update --init --recursive --remote go-ustore/ | |
- name: Build documentation | |
run: cd docs && doxygen conf.dox && make html | |
- name: Copy assets | |
run: cp -r assets build/docs/html/ | |
- name: Upload artifacts | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "./build/docs/html/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
build_wheel: | |
name: Build python | |
runs-on: ubuntu-latest | |
needs: deploy | |
strategy: | |
matrix: | |
arch: ["x86_64", "aarch64"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: 'main' | |
- name: Prepare CMake, Conan and PyArrow | |
run: python -m pip install --force-reinstall numpy pyarrow cmake conan==1.60.1 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,amd64' | |
- name: Build wheel | |
run: | | |
pip install cibuildwheel twine | |
CIBW_BUILD="cp39-*" cibuildwheel --platform linux | |
CIBW_BUILD="cp310-*" cibuildwheel --platform linux | |
env: | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
publish_python: | |
name: Publish Python | |
needs: build_wheel | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/usearch | |
permissions: | |
id-token: write | |
steps: | |
- name: Download artifacts | |
uses: actions/[email protected] | |
with: | |
path: ./dist/ | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ./dist/artifact | |
verbose: true | |
print-hash: true | |
build_publish_java: | |
name: Build and publish Java | |
needs: versioning | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: 'main' | |
- name: Prepare CMake, Conan and PyArrow | |
run: python -m pip install --force-reinstall numpy pyarrow cmake conan==1.60.1 | |
- name: Install UStore dependencies using conan | |
run: | | |
last_tag=$(curl https://api.github.com/repos/unum-cloud/ustore-deps/releases/latest | grep -i 'tag_name' | awk -F '\"' '{print $4}') | |
wget -q https://github.com/unum-cloud/ustore-deps/releases/download/"$last_tag"/ustore_deps_x86_linux.tar.gz | |
conan profile new --detect default | |
conan profile update settings.compiler.libcxx=libstdc++11 default | |
tar -xzf ./ustore_deps_x86_linux.tar.gz -C ~/.conan | |
package_version=$(ls ~/.conan/data/ustore_deps/) | |
conan install ustore_deps/"$package_version"@unum/x86_linux -g cmake -s compiler.version=11 | |
rm -rf ./ustore_deps_x86_linux.tar.gz | |
- name: Install default jdk | |
run: | | |
sudo apt update | |
sudo apt install default-jdk -y | |
- name: Build and test java | |
run: | | |
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" | |
bash java/pack.sh | |
- name: Publish java | |
run: ./java/gradlew publish | |
build_publish_docker: | |
name: Build and publish docker | |
needs: versioning | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
ref: 'main' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,amd64' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64, linux/arm64 | |
- name: docker login | |
uses: azure/docker-login@v1 | |
with: | |
login-server: index.docker.io | |
username: ${{ secrets.DOCKERIO_USERNAME }} | |
password: ${{ secrets.DOCKERIO_PASSWORD }} | |
- name: Build Docker | |
run: | | |
export version=$(cat VERSION) | |
sed -i 's/make -j32/make -j4/' ./Dockerfile | |
docker buildx create --use | |
docker buildx build \ | |
--platform "linux/amd64,linux/arm64" \ | |
--build-arg version=$version \ | |
--build-arg TEST_USTORE="False" | |
--file ./Dockerfile \ | |
--tag unum/ustore:$version-jammy \ | |
--tag unum/ustore:latest \ | |
--push . |