2023-12-05 11:52:09 +00:00
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
2023-12-11 13:58:43 +00:00
|
|
|
environment:
|
|
|
|
required: true
|
2023-12-05 11:52:09 +00:00
|
|
|
type: string
|
2023-12-11 13:58:43 +00:00
|
|
|
description: "The name of this release environment. It can be a 'nightly', 'beta' or 'release'"
|
2023-12-05 11:52:09 +00:00
|
|
|
git-ref:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
description: "The git ref of this release version. All 'actions/checkout' steps will use it"
|
2023-12-12 12:45:17 +00:00
|
|
|
bump-version:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Bump the version of the current beta if this is not the initial one"
|
2023-12-05 11:52:09 +00:00
|
|
|
latest:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Consider this release as the latest one and update the Docker image tag and the binary pointer for the installers"
|
|
|
|
publish:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Whether to publish this release"
|
|
|
|
create-release:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
description: "Create a GitHub release"
|
2024-01-22 17:51:49 +00:00
|
|
|
rust_version:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: "1.75.0"
|
|
|
|
description: "The Rust version to use for building binaries"
|
|
|
|
onnx_version:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: "1.16.3"
|
|
|
|
description: "The ONNX library version"
|
2024-02-19 13:59:31 +00:00
|
|
|
extra-features:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: "ml"
|
|
|
|
description: "Extra features enabled in the binary"
|
2024-01-22 17:51:49 +00:00
|
|
|
secrets:
|
|
|
|
AWS_CI_ACCESS_KEY_ID:
|
|
|
|
description: "AWS access key ID"
|
|
|
|
AWS_CI_SECRET_ACCESS_KEY:
|
|
|
|
description: "AWS secret access key"
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
prepare-vars:
|
|
|
|
name: Prepare vars
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
git-ref: ${{ steps.outputs.outputs.git-ref }}
|
|
|
|
name: ${{ steps.outputs.outputs.name }}
|
2023-12-15 21:53:25 +00:00
|
|
|
build-metadata: ${{ steps.outputs.outputs.build-metadata }}
|
2023-12-05 11:52:09 +00:00
|
|
|
steps:
|
2023-12-11 13:58:43 +00:00
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
2024-01-22 17:51:49 +00:00
|
|
|
toolchain: ${{ inputs.rust_version }}
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-15 21:53:25 +00:00
|
|
|
ref: ${{ inputs.git-ref }}
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
- name: Install a TOML parser
|
2024-01-22 17:51:49 +00:00
|
|
|
run: |
|
|
|
|
curl -L https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-full-linux-x86_64.gz | gunzip - > taplo
|
|
|
|
chmod +x taplo
|
|
|
|
sudo mv taplo /usr/bin/taplo
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
- name: Configure git
|
|
|
|
run: |
|
|
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config user.name "github-actions[bot]"
|
|
|
|
git config --add --bool push.autoSetupRemote true
|
|
|
|
|
|
|
|
- name: Patch release version
|
2023-12-15 21:53:25 +00:00
|
|
|
if: ${{ inputs.environment == 'stable' }}
|
2023-12-11 13:58:43 +00:00
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
2024-02-19 15:38:13 +00:00
|
|
|
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
if [[ $currentVersion == *"-beta"* ]]; then
|
2023-12-12 12:45:17 +00:00
|
|
|
git push origin --delete releases/stable || true
|
|
|
|
git checkout -b releases/stable
|
2023-12-11 13:58:43 +00:00
|
|
|
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
2024-01-09 20:47:27 +00:00
|
|
|
version=${major}.${minor}.0
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
# Bump the crate version
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" Cargo.toml
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"2.0.0-${version}\"#" core/Cargo.toml
|
2023-12-11 13:58:43 +00:00
|
|
|
|
2024-02-13 10:00:21 +00:00
|
|
|
# Update dependency versions
|
|
|
|
sed -i "s#surrealdb = { version = \"=${currentVersion}\"#surrealdb = { version = \"${major}\"#" Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#surrealdb-core = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core = { version = \"=2.0.0-${version}\"#" lib/Cargo.toml
|
2024-02-13 10:00:21 +00:00
|
|
|
|
2023-12-11 13:58:43 +00:00
|
|
|
# Update Cargo.lock without updating dependency versions
|
|
|
|
cargo check --no-default-features --features storage-mem
|
|
|
|
|
|
|
|
# Commit changes
|
|
|
|
git commit -am "Prepare v${version} release"
|
|
|
|
else
|
|
|
|
version=${currentVersion}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create the tag
|
2023-12-12 12:45:17 +00:00
|
|
|
git tag -a v${version} -m "Release ${version}" || true
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
- name: Create or patch beta branch
|
|
|
|
if: ${{ inputs.environment == 'beta' }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
2024-02-19 15:38:13 +00:00
|
|
|
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
if [[ $currentVersion == *"-beta"* ]]; then
|
2023-12-12 12:45:17 +00:00
|
|
|
if [[ "${{ inputs.bump-version }}" == "true" ]]; then
|
|
|
|
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
|
|
|
patchAndMeta=$(echo $currentVersion | tr "." "\n" | sed -n 3p)
|
|
|
|
betaNum=$(echo $currentVersion | tr "." "\n" | sed -n 4p)
|
|
|
|
betaVersion=${major}.${minor}.${patchAndMeta}.$(($betaNum + 1))
|
|
|
|
else
|
|
|
|
betaVersion=$currentVersion
|
|
|
|
fi
|
2024-02-13 10:00:21 +00:00
|
|
|
|
|
|
|
# Update dependency versions
|
|
|
|
sed -i "s#surrealdb = { version = \"=${currentVersion}\"#surrealdb = { version = \"=${betaVersion}\"#" Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#surrealdb-core = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core = { version = \"=2.0.0-${betaVersion}\"#" lib/Cargo.toml
|
2023-12-11 13:58:43 +00:00
|
|
|
else
|
|
|
|
git checkout -b releases/beta
|
|
|
|
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
2024-02-06 08:41:27 +00:00
|
|
|
betaVersion=${major}.${minor}.0-beta.1
|
2024-02-13 10:00:21 +00:00
|
|
|
|
|
|
|
# Update dependency versions
|
|
|
|
sed -i "s#surrealdb = { version = \"${major}\"#surrealdb = { version = \"=${betaVersion}\"#" Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#surrealdb-core = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core = { version = \"=2.0.0-${betaVersion}\"#" lib/Cargo.toml
|
2023-12-11 13:58:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Bump the crate version
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${betaVersion}\"#" Cargo.toml
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${betaVersion}\"#" lib/Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"2.0.0-${betaVersion}\"#" core/Cargo.toml
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
# Update Cargo.lock without updating dependency versions
|
|
|
|
cargo check --no-default-features --features storage-mem
|
|
|
|
|
|
|
|
# Commit changes
|
2023-12-12 12:45:17 +00:00
|
|
|
git commit -am "Prepare v${betaVersion} release" || true
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
# Create the tag
|
2023-12-12 12:45:17 +00:00
|
|
|
git tag -a v${betaVersion} -m "Release ${betaVersion}" || true
|
2023-12-11 13:58:43 +00:00
|
|
|
|
|
|
|
- name: Push changes
|
2023-12-15 21:53:25 +00:00
|
|
|
if: ${{ inputs.publish && (inputs.environment == 'beta' || inputs.environment == 'stable') }}
|
2023-12-11 13:58:43 +00:00
|
|
|
run: git push
|
|
|
|
|
|
|
|
- name: Push tag
|
2023-12-15 21:53:25 +00:00
|
|
|
if: ${{ inputs.publish && (inputs.environment == 'beta' || inputs.environment == 'stable') }}
|
2023-12-12 12:45:17 +00:00
|
|
|
run: git push --tags || true
|
2023-12-11 13:58:43 +00:00
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
- name: Set outputs
|
|
|
|
id: outputs
|
|
|
|
run: |
|
2023-12-11 13:58:43 +00:00
|
|
|
set -x
|
|
|
|
|
2024-02-19 15:38:13 +00:00
|
|
|
version=$(taplo get -f Cargo.toml "package.version")
|
2023-12-13 08:05:18 +00:00
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
if [[ "${{ inputs.publish }}" == "true" && ("${{ inputs.environment }}" == "beta" || "${{ inputs.environment }}" == "stable") ]]; then
|
2023-12-13 08:05:18 +00:00
|
|
|
echo "git-ref=v${version}" >> $GITHUB_OUTPUT
|
2023-12-11 13:58:43 +00:00
|
|
|
else
|
2023-12-15 21:53:25 +00:00
|
|
|
echo "git-ref=${{ inputs.git-ref }}" >> $GITHUB_OUTPUT
|
2023-12-11 13:58:43 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${{ inputs.environment }}" == "nightly" ]]; then
|
|
|
|
echo "name=${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
date=$(git show --no-patch --format=%ad --date=format:%Y%m%d)
|
|
|
|
rev=$(git rev-parse --short HEAD)
|
2023-12-15 21:53:25 +00:00
|
|
|
echo "build-metadata=${date}.${rev}" >> $GITHUB_OUTPUT
|
2023-12-11 13:58:43 +00:00
|
|
|
else
|
|
|
|
echo "name=v${version}" >> $GITHUB_OUTPUT
|
2024-01-01 14:48:20 +00:00
|
|
|
echo "build-metadata=" >> $GITHUB_OUTPUT
|
2023-12-11 13:58:43 +00:00
|
|
|
fi
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
test:
|
|
|
|
name: Test
|
|
|
|
needs: [prepare-vars]
|
|
|
|
runs-on: ubuntu-latest-16-cores
|
|
|
|
steps:
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
2024-01-22 17:51:49 +00:00
|
|
|
toolchain: ${{ inputs.rust_version }}
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
|
|
|
|
|
|
|
- name: Setup cache
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
save-if: ${{ needs.prepare-vars.outputs.git-ref == 'main' }}
|
|
|
|
|
|
|
|
- name: Install cargo-llvm-cov
|
|
|
|
uses: taiki-e/install-action@cargo-llvm-cov
|
|
|
|
|
|
|
|
- name: Install cargo-make
|
|
|
|
run: cargo install --debug --locked cargo-make
|
|
|
|
|
|
|
|
- name: Test workspace + coverage
|
|
|
|
run: cargo make ci-workspace-coverage
|
|
|
|
|
|
|
|
- name: Debug info
|
|
|
|
if: always()
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
free -m
|
|
|
|
df -h
|
|
|
|
ps auxf
|
|
|
|
cat /tmp/surrealdb.log || true
|
|
|
|
|
|
|
|
- name: Upload coverage report
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: code-coverage-report
|
|
|
|
path: target/llvm-cov/html/
|
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
needs: [prepare-vars]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
2024-01-22 17:51:49 +00:00
|
|
|
toolchain: ${{ inputs.rust_version }}
|
2023-12-05 11:52:09 +00:00
|
|
|
targets: wasm32-unknown-unknown
|
|
|
|
components: rustfmt, clippy
|
|
|
|
|
|
|
|
- name: Install cargo-make
|
|
|
|
run: cargo install --debug --locked cargo-make
|
|
|
|
|
|
|
|
- name: Check workspace
|
|
|
|
run: cargo make ci-check
|
|
|
|
|
|
|
|
- name: Check format
|
|
|
|
run: cargo make ci-format
|
|
|
|
|
|
|
|
- name: Check wasm
|
|
|
|
run: cargo make ci-check-wasm
|
|
|
|
|
|
|
|
- name: Check clippy
|
|
|
|
run: cargo make ci-clippy
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
docker-builder:
|
|
|
|
name: Prepare docker builder
|
|
|
|
runs-on: ubuntu-latest
|
2023-12-05 11:52:09 +00:00
|
|
|
needs: [prepare-vars]
|
2024-01-22 17:51:49 +00:00
|
|
|
outputs:
|
|
|
|
name: ${{ steps.image.outputs.name }}
|
|
|
|
tag: ${{ steps.image.outputs.tag }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Configure AWS credentials
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
with:
|
|
|
|
aws-access-key-id: ${{ secrets.AWS_CI_ACCESS_KEY_ID }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AWS_CI_SECRET_ACCESS_KEY }}
|
|
|
|
aws-region: us-east-1
|
|
|
|
|
|
|
|
- name: Login to Amazon ECR
|
|
|
|
id: login-ecr
|
|
|
|
uses: aws-actions/amazon-ecr-login@v2
|
|
|
|
|
|
|
|
- name: Prepare docker image name
|
|
|
|
id: image
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Use the github branch name so we can use modified builders on custom branches
|
|
|
|
tag=$(echo ${{ github.ref_name }} | sed -e 's/[^a-zA-Z0-9]/-/g')
|
|
|
|
|
|
|
|
echo "name=${{ steps.login-ecr.outputs.registry }}/surrealdb-builder" >> $GITHUB_OUTPUT
|
|
|
|
echo "tag=${tag}" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Build & Push builder image
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
id: build
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
file: ./docker/Dockerfile
|
|
|
|
target: builder
|
|
|
|
cache-from: |
|
|
|
|
type=registry,ref=${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}
|
|
|
|
type=registry,ref=${{ steps.image.outputs.name }}:main
|
|
|
|
cache-to: type=inline
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}
|
|
|
|
build-args: |
|
|
|
|
RUST_VERSION=${{ inputs.rust_version }}
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build ${{ matrix.arch }} binary
|
2024-01-22 17:51:49 +00:00
|
|
|
needs: [prepare-vars, docker-builder]
|
2023-12-05 11:52:09 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# MacOS amd64
|
|
|
|
- arch: x86_64-apple-darwin
|
2024-01-22 17:51:49 +00:00
|
|
|
runner: macos-latest-large
|
2023-12-05 11:52:09 +00:00
|
|
|
file: surreal-${{ needs.prepare-vars.outputs.name }}.darwin-amd64
|
|
|
|
build-step: |
|
2023-12-15 21:53:25 +00:00
|
|
|
set -x
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Prepare deps
|
|
|
|
brew install protobuf
|
|
|
|
|
|
|
|
# Build
|
2024-02-19 13:59:31 +00:00
|
|
|
features=storage-tikv,http-compression,sql2,jwks,${{ inputs.extra-features }}
|
2024-01-22 17:51:49 +00:00
|
|
|
|
2024-02-19 13:59:31 +00:00
|
|
|
# Download libonnxruntime's static library and tell ORT crate to use it
|
|
|
|
mkdir /tmp/onnxruntime
|
|
|
|
curl -sSL https://github.com/surrealdb/onnxruntime-build/releases/download/v${{ inputs.onnx_version }}/onnxruntime-osx-x86_64-static_lib-${{ inputs.onnx_version }}.tgz | \
|
|
|
|
tar -xz -C /tmp/onnxruntime/
|
|
|
|
export ORT_STRATEGY=system ORT_LIB_LOCATION=/tmp/onnxruntime/lib
|
2024-01-22 17:51:49 +00:00
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
cargo build --features $features --release --locked --target x86_64-apple-darwin
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
# Package
|
|
|
|
cp target/x86_64-apple-darwin/release/surreal surreal
|
2024-01-01 14:48:20 +00:00
|
|
|
./surreal version
|
2023-12-05 11:52:09 +00:00
|
|
|
tar -zcvf surreal-${{ needs.prepare-vars.outputs.name }}.darwin-amd64.tgz surreal
|
|
|
|
echo $(shasum -a 256 surreal-${{ needs.prepare-vars.outputs.name }}.darwin-amd64.tgz | cut -f1 -d' ') > surreal-${{ needs.prepare-vars.outputs.name }}.darwin-amd64.txt
|
|
|
|
|
|
|
|
# MacOS arm64
|
|
|
|
- arch: aarch64-apple-darwin
|
2024-01-22 17:51:49 +00:00
|
|
|
runner: macos-latest-xlarge
|
2023-12-05 11:52:09 +00:00
|
|
|
file: surreal-${{ needs.prepare-vars.outputs.name }}.darwin-arm64
|
|
|
|
build-step: |
|
2023-12-15 21:53:25 +00:00
|
|
|
set -x
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Prepare deps
|
|
|
|
brew install protobuf
|
|
|
|
|
|
|
|
# Build
|
2024-02-19 13:59:31 +00:00
|
|
|
features=storage-tikv,http-compression,sql2,jwks,${{ inputs.extra-features }}
|
|
|
|
|
|
|
|
# Download libonnxruntime's static library and tell ORT crate to use it
|
|
|
|
mkdir /tmp/onnxruntime
|
|
|
|
curl -sSL https://github.com/surrealdb/onnxruntime-build/releases/download/v${{ inputs.onnx_version }}/onnxruntime-osx-arm64-static_lib-${{ inputs.onnx_version }}.tgz | \
|
|
|
|
tar -xz -C /tmp/onnxruntime/
|
|
|
|
export ORT_STRATEGY=system ORT_LIB_LOCATION=/tmp/onnxruntime/lib
|
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
cargo build --features $features --release --locked --target aarch64-apple-darwin
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
# Package
|
|
|
|
cp target/aarch64-apple-darwin/release/surreal surreal
|
2024-01-22 17:51:49 +00:00
|
|
|
./surreal version
|
2023-12-05 11:52:09 +00:00
|
|
|
tar -zcvf surreal-${{ needs.prepare-vars.outputs.name }}.darwin-arm64.tgz surreal
|
|
|
|
echo $(shasum -a 256 surreal-${{ needs.prepare-vars.outputs.name }}.darwin-arm64.tgz | cut -f1 -d' ') > surreal-${{ needs.prepare-vars.outputs.name }}.darwin-arm64.txt
|
|
|
|
|
|
|
|
# Linux amd64
|
|
|
|
- arch: x86_64-unknown-linux-gnu
|
2023-12-05 19:26:04 +00:00
|
|
|
runner: ["self-hosted", "amd64", "builder"]
|
2023-12-05 11:52:09 +00:00
|
|
|
file: surreal-${{ needs.prepare-vars.outputs.name }}.linux-amd64
|
|
|
|
build-step: |
|
|
|
|
# Build
|
2024-02-19 13:59:31 +00:00
|
|
|
features=storage-tikv,http-compression,sql2,jwks,${{ inputs.extra-features }}
|
2024-01-22 17:51:49 +00:00
|
|
|
|
2024-02-19 13:59:31 +00:00
|
|
|
# Download libonnxruntime's static library and tell ORT crate to use it
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
curl -sSL https://github.com/surrealdb/onnxruntime-build/releases/download/v${{ inputs.onnx_version }}/onnxruntime-linux-x64-static_lib-${{ inputs.onnx_version }}.tgz | \
|
|
|
|
tar -xz -C $tmpdir
|
|
|
|
export ORT_STRATEGY=system ORT_LIB_LOCATION=$tmpdir/lib
|
2024-01-22 17:51:49 +00:00
|
|
|
|
|
|
|
docker run \
|
|
|
|
--rm -t \
|
|
|
|
--pull always \
|
|
|
|
-v $(pwd):/surrealdb \
|
|
|
|
-e SURREAL_BUILD_METADATA=$SURREAL_BUILD_METADATA \
|
2024-02-06 08:41:27 +00:00
|
|
|
-e RUSTFLAGS="${RUSTFLAGS}" \
|
2024-01-22 17:51:49 +00:00
|
|
|
-e ORT_STRATEGY=$ORT_STRATEGY \
|
|
|
|
-e ORT_LIB_LOCATION=$ORT_LIB_LOCATION \
|
|
|
|
-v $ORT_LIB_LOCATION:$ORT_LIB_LOCATION \
|
|
|
|
${{ needs.docker-builder.outputs.name }}:${{ needs.docker-builder.outputs.tag }} \
|
|
|
|
--target x86_64-unknown-linux-gnu --features ${features} --release --locked
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Package
|
2024-01-22 17:51:49 +00:00
|
|
|
cp target/x86_64-unknown-linux-gnu/release/surreal surreal
|
2023-12-05 11:52:09 +00:00
|
|
|
tar -zcvf surreal-${{ needs.prepare-vars.outputs.name }}.linux-amd64.tgz surreal
|
|
|
|
echo $(shasum -a 256 surreal-${{ needs.prepare-vars.outputs.name }}.linux-amd64.tgz | cut -f1 -d' ') > surreal-${{ needs.prepare-vars.outputs.name }}.linux-amd64.txt
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
# Verify the binary is compatible with various Linux distributions
|
|
|
|
docker run --platform linux/amd64 --rm -t -v ./target/x86_64-unknown-linux-gnu/release/surreal:/surreal ubuntu:20.04 /surreal version
|
|
|
|
docker run --platform linux/amd64 --rm -t -v ./target/x86_64-unknown-linux-gnu/release/surreal:/surreal rockylinux:8 /surreal version
|
|
|
|
docker run --platform linux/amd64 --rm -t -v ./target/x86_64-unknown-linux-gnu/release/surreal:/surreal debian:11 /surreal version
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Linux arm64
|
|
|
|
- arch: aarch64-unknown-linux-gnu
|
2023-12-05 19:26:04 +00:00
|
|
|
runner: ["self-hosted", "arm64", "builder"]
|
2023-12-05 11:52:09 +00:00
|
|
|
file: surreal-${{ needs.prepare-vars.outputs.name }}.linux-arm64
|
|
|
|
build-step: |
|
2023-12-15 21:53:25 +00:00
|
|
|
set -x
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Build
|
2024-02-19 13:59:31 +00:00
|
|
|
features=storage-tikv,http-compression,sql2,jwks,${{ inputs.extra-features }}
|
2024-01-22 17:51:49 +00:00
|
|
|
|
2024-02-19 13:59:31 +00:00
|
|
|
# Download libonnxruntime's static library and tell ORT crate to use it
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
curl -sSL https://github.com/surrealdb/onnxruntime-build/releases/download/v${{ inputs.onnx_version }}/onnxruntime-linux-aarch64-static_lib-${{ inputs.onnx_version }}.tgz | \
|
|
|
|
tar -xz -C $tmpdir
|
|
|
|
export ORT_STRATEGY=system ORT_LIB_LOCATION=$tmpdir/lib
|
2024-01-22 17:51:49 +00:00
|
|
|
|
|
|
|
docker run \
|
|
|
|
--rm -t \
|
|
|
|
--pull always \
|
|
|
|
-v $(pwd):/surrealdb \
|
|
|
|
-e SURREAL_BUILD_METADATA=$SURREAL_BUILD_METADATA \
|
2024-02-06 08:41:27 +00:00
|
|
|
-e RUSTFLAGS="${RUSTFLAGS}" \
|
2024-01-22 17:51:49 +00:00
|
|
|
-e ORT_STRATEGY=$ORT_STRATEGY \
|
|
|
|
-e ORT_LIB_LOCATION=$ORT_LIB_LOCATION \
|
|
|
|
-v $ORT_LIB_LOCATION:$ORT_LIB_LOCATION \
|
|
|
|
${{ needs.docker-builder.outputs.name }}:${{ needs.docker-builder.outputs.tag }} \
|
|
|
|
--target aarch64-unknown-linux-gnu --features ${features} --release --locked
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
# Package
|
2024-01-22 17:51:49 +00:00
|
|
|
cp target/aarch64-unknown-linux-gnu/release/surreal surreal
|
2023-12-05 11:52:09 +00:00
|
|
|
tar -zcvf surreal-${{ needs.prepare-vars.outputs.name }}.linux-arm64.tgz surreal
|
|
|
|
echo $(shasum -a 256 surreal-${{ needs.prepare-vars.outputs.name }}.linux-arm64.tgz | cut -f1 -d' ') > surreal-${{ needs.prepare-vars.outputs.name }}.linux-arm64.txt
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
# Verify the binary is compatible with various Linux distributions
|
|
|
|
docker run --platform linux/arm64 --rm -t -v ./target/aarch64-unknown-linux-gnu/release/surreal:/surreal ubuntu:20.04 /surreal version
|
|
|
|
docker run --platform linux/arm64 --rm -t -v ./target/aarch64-unknown-linux-gnu/release/surreal:/surreal rockylinux:8 /surreal version
|
|
|
|
docker run --platform linux/arm64 --rm -t -v ./target/aarch64-unknown-linux-gnu/release/surreal:/surreal debian:11 /surreal version
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Windows amd64
|
|
|
|
- arch: x86_64-pc-windows-msvc
|
|
|
|
runner: windows-latest
|
|
|
|
file: surreal-${{ needs.prepare-vars.outputs.name }}.windows-amd64
|
|
|
|
build-step: |
|
2023-12-15 21:53:25 +00:00
|
|
|
set -x
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
# Prepare deps
|
|
|
|
vcpkg integrate install
|
|
|
|
|
|
|
|
# Build
|
2024-02-19 13:59:31 +00:00
|
|
|
features=storage-tikv,http-compression,sql2,jwks,${{ inputs.extra-features }}
|
|
|
|
|
|
|
|
# Download libonnxruntime's static library and tell ORT crate to use it
|
|
|
|
tmp_dir=$(mktemp -d)
|
|
|
|
curl -sSL https://github.com/surrealdb/onnxruntime-build/releases/download/v${{ inputs.onnx_version }}/onnxruntime-win-x64-static_lib-${{ inputs.onnx_version }}.zip -o $tmp_dir/onnxruntime.zip
|
|
|
|
unzip -d $tmp_dir $tmp_dir/onnxruntime.zip
|
|
|
|
export ORT_STRATEGY=system ORT_LIB_LOCATION=$tmp_dir/lib
|
2024-01-22 17:51:49 +00:00
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
cargo build --features $features --release --locked --target x86_64-pc-windows-msvc
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
# Package
|
2024-01-01 14:48:20 +00:00
|
|
|
./target/x86_64-pc-windows-msvc/release/surreal.exe version
|
2023-12-05 11:52:09 +00:00
|
|
|
cp target/x86_64-pc-windows-msvc/release/surreal.exe surreal-${{ needs.prepare-vars.outputs.name }}.windows-amd64.exe
|
|
|
|
echo $(shasum -a 256 surreal-${{ needs.prepare-vars.outputs.name }}.windows-amd64.exe | cut -f1 -d' ') > surreal-${{ needs.prepare-vars.outputs.name }}.windows-amd64.txt
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
2024-01-22 17:51:49 +00:00
|
|
|
toolchain: ${{ inputs.rust_version }}
|
2023-12-05 11:52:09 +00:00
|
|
|
targets: ${{ matrix.arch }}
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
- name: Configure AWS credentials
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
if: ${{ matrix.arch == 'x86_64-unknown-linux-gnu' || matrix.arch == 'aarch64-unknown-linux-gnu' }}
|
|
|
|
with:
|
|
|
|
aws-access-key-id: ${{ secrets.AWS_CI_ACCESS_KEY_ID }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AWS_CI_SECRET_ACCESS_KEY }}
|
|
|
|
aws-region: us-east-1
|
|
|
|
|
|
|
|
- name: Login to Amazon ECR
|
|
|
|
id: login-ecr
|
|
|
|
if: ${{ matrix.arch == 'x86_64-unknown-linux-gnu' || matrix.arch == 'aarch64-unknown-linux-gnu' }}
|
|
|
|
uses: aws-actions/amazon-ecr-login@v2
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
- name: Output package versions
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
set +e
|
|
|
|
go version ; cargo version ; rustc --version ; cmake --version ; gcc --version ; g++ --version ; perl -v
|
|
|
|
|
|
|
|
- name: Build step
|
2023-12-15 21:53:25 +00:00
|
|
|
env:
|
|
|
|
SURREAL_BUILD_METADATA: ${{ needs.prepare-vars.outputs.build-metadata }}
|
2024-02-06 08:41:27 +00:00
|
|
|
RUSTFLAGS: "--cfg surrealdb_unstable"
|
2023-12-05 11:52:09 +00:00
|
|
|
run: ${{ matrix.build-step }}
|
|
|
|
|
|
|
|
- name: Upload artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.file }}
|
|
|
|
path: |
|
|
|
|
surreal
|
|
|
|
${{ matrix.file }}.tgz
|
|
|
|
${{ matrix.file }}.txt
|
|
|
|
${{ matrix.file }}.exe
|
|
|
|
|
|
|
|
publish:
|
2023-12-15 21:53:25 +00:00
|
|
|
name: Publish crate and artifacts binaries
|
2024-01-22 17:51:49 +00:00
|
|
|
needs: [prepare-vars, test, lint, build]
|
2023-12-05 11:52:09 +00:00
|
|
|
if: ${{ inputs.publish }}
|
2023-12-11 13:58:43 +00:00
|
|
|
environment: ${{ inputs.environment }}
|
2023-12-05 11:52:09 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-12-13 08:05:18 +00:00
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
|
|
|
|
2023-12-15 21:53:25 +00:00
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
2024-01-22 17:51:49 +00:00
|
|
|
toolchain: ${{ inputs.rust_version }}
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
- name: Install release-plz
|
2024-01-23 14:49:03 +00:00
|
|
|
run: |
|
|
|
|
curl -L https://github.com/MarcoIeni/release-plz/releases/download/release-plz-v0.3.30/release-plz-x86_64-unknown-linux-gnu.tar.gz | sudo tar -xz -C /usr/bin
|
|
|
|
sudo chmod +x /usr/bin/release-plz
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
- name: Install a TOML parser
|
2024-02-06 08:41:27 +00:00
|
|
|
if: ${{ inputs.environment == 'nightly' || inputs.environment == 'beta' }}
|
2024-01-22 17:51:49 +00:00
|
|
|
run: |
|
|
|
|
curl -L https://github.com/tamasfe/taplo/releases/download/0.8.1/taplo-full-linux-x86_64.gz | gunzip - > taplo
|
|
|
|
chmod +x taplo
|
|
|
|
sudo mv taplo /usr/bin/taplo
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
- name: Create a temporary branch
|
|
|
|
run: git checkout -b crate
|
|
|
|
|
|
|
|
- name: Configure release-plz
|
|
|
|
run: |
|
|
|
|
cat << EOF > /tmp/release-plz.toml
|
|
|
|
[workspace]
|
|
|
|
changelog_update = false
|
|
|
|
git_release_enable = false
|
|
|
|
semver_check = false
|
|
|
|
git_tag_enable = false
|
|
|
|
EOF
|
|
|
|
|
|
|
|
- name: Patch beta crate version
|
|
|
|
if: ${{ inputs.environment == 'beta' }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Derive crate version
|
2024-02-19 15:38:13 +00:00
|
|
|
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
2023-12-15 21:53:25 +00:00
|
|
|
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
|
|
|
betaNum=$(echo $currentVersion | tr "." "\n" | sed -n 4p)
|
|
|
|
version=${major}.${minor}.$(($betaNum - 1))
|
|
|
|
|
|
|
|
# Update crate version
|
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"2.0.0-${version}\"#" core/Cargo.toml
|
|
|
|
sed -i "s#surrealdb-core = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core = { version = \"=2.0.0-${version}\"#" lib/Cargo.toml
|
2023-12-15 21:53:25 +00:00
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
- name: Patch nightly crate version
|
2023-12-15 21:53:25 +00:00
|
|
|
if: ${{ inputs.environment == 'nightly' }}
|
|
|
|
run: |
|
|
|
|
# Get the date and time of the last commit
|
|
|
|
date=$(git show --no-patch --format=%ad --date=format:%Y%m%d)
|
2024-02-05 12:01:39 +00:00
|
|
|
|
|
|
|
# Derive crate version
|
2024-02-19 15:38:13 +00:00
|
|
|
currentVersion=$(taplo get -f Cargo.toml "package.version")
|
2024-02-05 12:01:39 +00:00
|
|
|
major=$(echo $currentVersion | tr "." "\n" | sed -n 1p)
|
|
|
|
minor=$(echo $currentVersion | tr "." "\n" | sed -n 2p)
|
|
|
|
# This sets the nightly version to something like `1.3.20231117`
|
|
|
|
version=${major}.${minor}.${date}
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
# Update the version to a nightly one
|
2024-02-05 12:01:39 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"${version}\"#" lib/Cargo.toml
|
2024-03-15 16:58:51 +00:00
|
|
|
sed -i "s#^version = \".*\"#version = \"2.0.0-${version}\"#" core/Cargo.toml
|
|
|
|
sed -i "s#surrealdb-core = { version = \"=2.0.0-${currentVersion}\"#surrealdb-core = { version = \"=2.0.0-${version}\"#" lib/Cargo.toml
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
- name: Patch crate name and description
|
|
|
|
if: ${{ inputs.environment == 'nightly' || inputs.environment == 'beta' }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# Patch crate name
|
|
|
|
sed -i "0,/surrealdb/s//surrealdb-${{ inputs.environment }}/" lib/Cargo.toml
|
2024-02-05 12:01:39 +00:00
|
|
|
sed -i "0,/surrealdb-core/s//surrealdb-core-${{ inputs.environment }}/" core/Cargo.toml
|
|
|
|
|
|
|
|
# Patch lib dependency
|
|
|
|
sed -i "s#package = \"surrealdb-core\"#package = \"surrealdb-core-${{ inputs.environment }}\"#" lib/Cargo.toml
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
# Patch the description
|
|
|
|
sed -i "s#^description = \".*\"#description = \"A ${{ inputs.environment }} release of the surrealdb crate\"#" lib/Cargo.toml
|
2024-02-05 12:01:39 +00:00
|
|
|
sed -i "s#^description = \".*\"#description = \"A ${{ inputs.environment }} release of the surrealdb-core crate\"#" core/Cargo.toml
|
2023-12-15 21:53:25 +00:00
|
|
|
|
|
|
|
# Temporarily commit patches
|
|
|
|
# These should not be pushed back to the repo
|
|
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config user.name "github-actions[bot]"
|
|
|
|
git commit -am "Name and version patches"
|
|
|
|
|
|
|
|
- name: Publish the crate
|
|
|
|
env:
|
|
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
2024-01-23 14:49:03 +00:00
|
|
|
run: release-plz release --config /tmp/release-plz.toml
|
2023-12-15 21:53:25 +00:00
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
- name: Download artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
path: artifacts
|
|
|
|
|
|
|
|
- name: Publish release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: ${{ inputs.create-release }}
|
|
|
|
with:
|
2023-12-13 08:05:18 +00:00
|
|
|
name: "Release ${{ needs.prepare-vars.outputs.git-ref }}"
|
|
|
|
tag_name: ${{ needs.prepare-vars.outputs.git-ref }}
|
2023-12-15 21:53:25 +00:00
|
|
|
prerelease: ${{ inputs.environment == 'beta' || inputs.environment == 'nightly' }}
|
2023-12-13 08:05:18 +00:00
|
|
|
fail_on_unmatched_files: true
|
2023-12-05 11:52:09 +00:00
|
|
|
files: |
|
|
|
|
LICENSE
|
2023-12-13 08:05:18 +00:00
|
|
|
artifacts/surreal-${{ needs.prepare-vars.outputs.git-ref }}.*/*.tgz
|
|
|
|
artifacts/surreal-${{ needs.prepare-vars.outputs.git-ref }}.*/*.exe
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
- name: Configure AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
with:
|
|
|
|
aws-region: us-east-2
|
|
|
|
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
|
|
|
|
|
2023-12-13 08:05:18 +00:00
|
|
|
- name: Set latest release version
|
|
|
|
if: ${{ inputs.create-release && inputs.latest }}
|
|
|
|
run: |
|
|
|
|
echo ${{ needs.prepare-vars.outputs.git-ref }} > latest.txt
|
|
|
|
aws s3 cp --cache-control 'no-store' latest.txt s3://download.surrealdb.com/latest.txt
|
|
|
|
|
|
|
|
- name: Set latest beta version
|
|
|
|
if: ${{ inputs.publish && inputs.environment == 'beta' }}
|
|
|
|
run: |
|
2023-12-15 21:53:25 +00:00
|
|
|
echo ${{ needs.prepare-vars.outputs.git-ref }} > beta.txt
|
|
|
|
aws s3 cp --cache-control 'no-store' beta.txt s3://download.surrealdb.com/beta.txt
|
2023-12-13 08:05:18 +00:00
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
- name: Publish binaries
|
|
|
|
run: |
|
|
|
|
for file in artifacts/**/*.{tgz,txt,exe}; do
|
|
|
|
aws s3 cp --cache-control 'no-store' $file s3://download.surrealdb.com/${{ needs.prepare-vars.outputs.name }}/
|
|
|
|
done
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
docker:
|
|
|
|
name: Docker images
|
2023-12-05 11:52:09 +00:00
|
|
|
needs: [prepare-vars, publish]
|
|
|
|
uses: ./.github/workflows/reusable_docker.yml
|
|
|
|
with:
|
|
|
|
git-ref: ${{ needs.prepare-vars.outputs.git-ref }}
|
|
|
|
tag-prefix: ${{ needs.prepare-vars.outputs.name }}
|
|
|
|
latest: ${{ inputs.latest }}
|
2024-01-22 17:51:49 +00:00
|
|
|
build: true
|
2023-12-05 11:52:09 +00:00
|
|
|
push: true
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
package-macos:
|
|
|
|
name: Package and publish macOS universal binary
|
|
|
|
needs: [prepare-vars, publish]
|
|
|
|
runs-on: macos-latest
|
|
|
|
env:
|
|
|
|
FILE: surreal-${{ needs.prepare-vars.outputs.name }}.darwin-universal
|
|
|
|
steps:
|
|
|
|
- name: Download amd64 binary
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: surreal-${{ needs.prepare-vars.outputs.name }}.darwin-amd64
|
|
|
|
path: amd64
|
|
|
|
|
|
|
|
- name: Download arm64 binary
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: surreal-${{ needs.prepare-vars.outputs.name }}.darwin-arm64
|
|
|
|
path: arm64
|
|
|
|
|
|
|
|
- name: Configure AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
with:
|
|
|
|
aws-region: us-east-2
|
|
|
|
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
|
|
|
|
|
|
|
|
- name: Package universal MacOS binary
|
|
|
|
run: |
|
|
|
|
lipo -create -output surreal amd64/surreal arm64/surreal
|
|
|
|
chmod +x surreal
|
|
|
|
tar -zcvf $FILE.tgz surreal
|
|
|
|
echo $(shasum -a 256 $FILE.tgz | cut -f1 -d' ') > $FILE.txt
|
|
|
|
|
|
|
|
- name: Publish universal MacOS binary
|
|
|
|
if: ${{ inputs.publish }}
|
|
|
|
run: |
|
|
|
|
aws s3 cp --cache-control 'no-store' $FILE.tgz s3://download.surrealdb.com/${{ needs.prepare-vars.outputs.name }}/
|
|
|
|
aws s3 cp --cache-control 'no-store' $FILE.txt s3://download.surrealdb.com/${{ needs.prepare-vars.outputs.name }}/
|
|
|
|
|
|
|
|
propagate:
|
|
|
|
name: Propagate binaries to all regions
|
|
|
|
if: ${{ inputs.publish }}
|
|
|
|
needs: [publish, package-macos]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Configure AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
with:
|
|
|
|
aws-region: us-east-2
|
|
|
|
aws-access-key-id: ${{ secrets.AMAZON_ACCESS_KEY }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AMAZON_SECRET_KEY }}
|
|
|
|
|
|
|
|
- name: Distribute binaries
|
|
|
|
run: |
|
|
|
|
regions=("af-south-1" "ap-east-1" "ap-south-1" "ap-southeast-1" "ap-southeast-2" "ca-central-1" "eu-central-1" "eu-west-2" "me-south-1" "sa-east-1" "us-west-2")
|
|
|
|
for region in ${regions[@]}; do
|
|
|
|
aws s3 sync --delete --storage-class INTELLIGENT_TIERING --source-region eu-west-2 --region ${region} s3://download.surrealdb.com s3://download.${region}.surrealdb.com
|
|
|
|
done
|