mirror of
https://github.com/valeriansaliou/sonic.git
synced 2022-10-24 19:50:51 +03:00
Pull out cross-compilation capabilities, as MUSL will not work
This commit is contained in:
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@@ -13,44 +13,16 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache build artifacts
|
||||
id: cache-cargo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: build-${{ runner.os }}-cargo-any
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: rustfmt
|
||||
override: true
|
||||
|
||||
- name: Install cross-compilation tools (if needed)
|
||||
run: which cross >/dev/null || cargo install cross
|
||||
|
||||
- name: Verify versions
|
||||
run: rustc --version && rustup --version && cargo --version && cross --version
|
||||
|
||||
- name: Get current tag
|
||||
id: current_tag
|
||||
uses: WyriHaximus/github-action-get-previous-tag@v1
|
||||
|
||||
- name: Release binaries
|
||||
run: ./scripts/release_binaries.sh --version=${{ steps.current_tag.outputs.tag }}
|
||||
|
||||
- name: Release new version
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ steps.current_tag.outputs.tag }}
|
||||
name: Sonic ${{ steps.current_tag.outputs.tag }}
|
||||
body: "⚠️ Changelog not yet provided."
|
||||
files: ./${{ steps.current_tag.outputs.tag }}-*.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
image = "valeriansaliou/sonic:cross-x86_64-unknown-linux-gnu-0.2.0"
|
||||
@@ -15,5 +15,4 @@ We consider here the packaging flow of Sonic version `1.0.0` for Linux.
|
||||
3. **How to build Sonic, package it and release it on GitHub and Docker Hub (multiple architectures):**
|
||||
1. Tag the latest Git commit corresponding to the release with tag `v1.0.0`, and push the tag
|
||||
2. Wait for all release jobs to complete on the [actions](https://github.com/valeriansaliou/sonic/actions) page on GitHub
|
||||
3. Download all release archives, and sign them locally using: `./scripts/sign_binaries.sh --version=1.0.0`
|
||||
4. Publish a changelog and upload all the built archives, as well as their signatures on the [releases](https://github.com/valeriansaliou/sonic/releases) page on GitHub
|
||||
3. Publish a changelog on the [releases](https://github.com/valeriansaliou/sonic/releases) page on GitHub
|
||||
|
||||
@@ -59,9 +59,7 @@ Sonic is integrated in all Crisp search products on the [Crisp](https://crisp.ch
|
||||
|
||||
### Installation
|
||||
|
||||
Vigil is built in Rust. To install it, either download a version from the [Sonic releases](https://github.com/valeriansaliou/sonic/releases) page (if any), use `cargo install` or pull the source code from `master`.
|
||||
|
||||
👉 _Each release binary comes with an `.asc` signature file, which can be verified using [@valeriansaliou](https://github.com/valeriansaliou) GPG public key: [:key:valeriansaliou.gpg.pub.asc](https://valeriansaliou.name/files/keys/valeriansaliou.gpg.pub.asc)._
|
||||
Vigil is built in Rust. To install it, use `cargo install` or pull the source code from `master`.
|
||||
|
||||
**👉 Install from source:**
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Sonic
|
||||
#
|
||||
# Fast, lightweight and schema-less search backend
|
||||
# Copyright: 2020, Valerian Saliou <valerian@valeriansaliou.name>
|
||||
# License: Mozilla Public License v2.0 (MPL v2.0)
|
||||
##
|
||||
|
||||
# Read arguments
|
||||
while [ "$1" != "" ]; do
|
||||
argument_key=`echo $1 | awk -F= '{print $1}'`
|
||||
argument_value=`echo $1 | awk -F= '{print $2}'`
|
||||
|
||||
case $argument_key in
|
||||
-v | --version)
|
||||
# Notice: strip any leading 'v' to the version number
|
||||
SONIC_VERSION="${argument_value/v}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument received: '$argument_key'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
# Ensure release version is provided
|
||||
if [ -z "$SONIC_VERSION" ]; then
|
||||
echo "No Sonic release version was provided, please provide it using '--version'"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Define release pipeline
|
||||
function release_for_architecture {
|
||||
final_tar="v$SONIC_VERSION-$1.tar.gz"
|
||||
|
||||
rm -rf ./sonic/ && \
|
||||
cross build --target "$2" --release && \
|
||||
mkdir ./sonic && \
|
||||
cp -p "target/$2/release/sonic" ./sonic/ && \
|
||||
cp -r ./config.cfg sonic/ && \
|
||||
tar --owner=0 --group=0 -czvf "$final_tar" ./sonic && \
|
||||
rm -r ./sonic/
|
||||
release_result=$?
|
||||
|
||||
if [ $release_result -eq 0 ]; then
|
||||
echo "Result: Packed architecture: $1 to file: $final_tar"
|
||||
fi
|
||||
|
||||
return $release_result
|
||||
}
|
||||
|
||||
# Run release tasks
|
||||
ABSPATH=$(cd "$(dirname "$0")"; pwd)
|
||||
BASE_DIR="$ABSPATH/../"
|
||||
|
||||
rc=0
|
||||
|
||||
pushd "$BASE_DIR" > /dev/null
|
||||
echo "Executing release steps for Sonic v$SONIC_VERSION..."
|
||||
|
||||
release_for_architecture "x86_64" "x86_64-unknown-linux-gnu"
|
||||
rc=$?
|
||||
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo "Success: Done executing release steps for Sonic v$SONIC_VERSION"
|
||||
else
|
||||
echo "Error: Failed executing release steps for Sonic v$SONIC_VERSION"
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
exit $rc
|
||||
@@ -1,71 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Sonic
|
||||
#
|
||||
# Fast, lightweight and schema-less search backend
|
||||
# Copyright: 2020, Valerian Saliou <valerian@valeriansaliou.name>
|
||||
# License: Mozilla Public License v2.0 (MPL v2.0)
|
||||
##
|
||||
|
||||
# Read arguments
|
||||
while [ "$1" != "" ]; do
|
||||
argument_key=`echo $1 | awk -F= '{print $1}'`
|
||||
argument_value=`echo $1 | awk -F= '{print $2}'`
|
||||
|
||||
case $argument_key in
|
||||
-v | --version)
|
||||
# Notice: strip any leading 'v' to the version number
|
||||
SONIC_VERSION="${argument_value/v}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument received: '$argument_key'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
# Ensure release version is provided
|
||||
if [ -z "$SONIC_VERSION" ]; then
|
||||
echo "No Sonic release version was provided, please provide it using '--version'"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Define sign pipeline
|
||||
function sign_for_architecture {
|
||||
final_tar="v$SONIC_VERSION-$1.tar.gz"
|
||||
gpg_signer="valerian@valeriansaliou.name"
|
||||
|
||||
gpg -u "$gpg_signer" --armor --detach-sign "$final_tar"
|
||||
sign_result=$?
|
||||
|
||||
if [ $sign_result -eq 0 ]; then
|
||||
echo "Result: Signed architecture: $1 for file: $final_tar"
|
||||
fi
|
||||
|
||||
return $sign_result
|
||||
}
|
||||
|
||||
# Run sign tasks
|
||||
ABSPATH=$(cd "$(dirname "$0")"; pwd)
|
||||
BASE_DIR="$ABSPATH/../"
|
||||
|
||||
rc=0
|
||||
|
||||
pushd "$BASE_DIR" > /dev/null
|
||||
echo "Executing sign steps for Sonic v$SONIC_VERSION..."
|
||||
|
||||
sign_for_architecture "x86_64"
|
||||
rc=$?
|
||||
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo "Success: Done executing sign steps for Sonic v$SONIC_VERSION"
|
||||
else
|
||||
echo "Error: Failed executing sign steps for Sonic v$SONIC_VERSION"
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
exit $rc
|
||||
@@ -1,5 +0,0 @@
|
||||
FROM rustembedded/cross:x86_64-unknown-linux-gnu-0.2.0
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y clang libclang-dev libc6-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
Reference in New Issue
Block a user