mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Merge #2136
2136: Refactoring CI regarding ARM binary publish r=curquiza a=curquiza Fixes https://github.com/meilisearch/meilisearch/issues/1909 - Remove CI file to publish aarch64 binary and put the logic into `publish-binary.yml` - Remove the job to publish armv8 binary - Fix download-latest script accordingly - Adapt dowload-latest with the specific case of the MacOS m1 Co-authored-by: Clémentine Urquizar <clementine@meilisearch.com> Co-authored-by: meili-bot <74670311+meili-bot@users.noreply.github.com>
This commit is contained in:
commit
752a0e13ad
2
.github/is-latest-release.sh
vendored
2
.github/is-latest-release.sh
vendored
@ -74,7 +74,7 @@ semverLT() {
|
|||||||
# Returns the tag of the latest stable release (in terms of semver and not of release date)
|
# Returns the tag of the latest stable release (in terms of semver and not of release date)
|
||||||
get_latest() {
|
get_latest() {
|
||||||
temp_file='temp_file' # temp_file needed because the grep would start before the download is over
|
temp_file='temp_file' # temp_file needed because the grep would start before the download is over
|
||||||
curl -s 'https://api.github.com/repos/meilisearch/meiliSearch/releases' > "$temp_file"
|
curl -s 'https://api.github.com/repos/meilisearch/meilisearch/releases' > "$temp_file"
|
||||||
releases=$(cat "$temp_file" | \
|
releases=$(cat "$temp_file" | \
|
||||||
grep -E "tag_name|draft|prerelease" \
|
grep -E "tag_name|draft|prerelease" \
|
||||||
| tr -d ',"' | cut -d ':' -f2 | tr -d ' ')
|
| tr -d ',"' | cut -d ':' -f2 | tr -d ' ')
|
||||||
|
75
.github/workflows/publish-binaries.yml
vendored
75
.github/workflows/publish-binaries.yml
vendored
@ -38,28 +38,69 @@ jobs:
|
|||||||
asset_name: ${{ matrix.asset_name }}
|
asset_name: ${{ matrix.asset_name }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
|
||||||
publish-armv8:
|
publish-aarch64:
|
||||||
name: Publish for ARMv8
|
name: Publish to GitHub
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: false
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- build: aarch64
|
||||||
|
os: ubuntu-18.04
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
linker: gcc-aarch64-linux-gnu
|
||||||
|
use-cross: true
|
||||||
|
asset_name: meilisearch-linux-aarch64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repository
|
||||||
- uses: uraimo/run-on-arch-action@v2.1.1
|
uses: actions/checkout@v2
|
||||||
id: runcmd
|
|
||||||
|
- name: Installing Rust toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
arch: aarch64 # aka ARMv8
|
toolchain: stable
|
||||||
distro: ubuntu18.04
|
profile: minimal
|
||||||
env: |
|
target: ${{ matrix.target }}
|
||||||
JEMALLOC_SYS_WITH_LG_PAGE: 16
|
override: true
|
||||||
|
|
||||||
|
- name: APT update
|
||||||
run: |
|
run: |
|
||||||
apt update
|
sudo apt update
|
||||||
apt install -y curl gcc make
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
|
- name: Install target specific tools
|
||||||
source $HOME/.cargo/env
|
if: matrix.use-cross
|
||||||
cargo build --release --locked
|
run: |
|
||||||
|
sudo apt-get install -y ${{ matrix.linker }}
|
||||||
|
|
||||||
|
- name: Configure target aarch64 GNU
|
||||||
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
|
## Environment variable is not passed using env:
|
||||||
|
## LD gold won't work with MUSL
|
||||||
|
# env:
|
||||||
|
# JEMALLOC_SYS_WITH_LG_PAGE: 16
|
||||||
|
# RUSTFLAGS: '-Clink-arg=-fuse-ld=gold'
|
||||||
|
run: |
|
||||||
|
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config
|
||||||
|
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config
|
||||||
|
echo 'JEMALLOC_SYS_WITH_LG_PAGE=16' >> $GITHUB_ENV
|
||||||
|
echo RUSTFLAGS="-Clink-arg=-fuse-ld=gold" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Cargo build
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
use-cross: ${{ matrix.use-cross }}
|
||||||
|
args: --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: List target output files
|
||||||
|
run: ls -lR ./target
|
||||||
|
|
||||||
- name: Upload the binary to release
|
- name: Upload the binary to release
|
||||||
uses: svenstaro/upload-release-action@v1-release
|
uses: svenstaro/upload-release-action@v1-release
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.PUBLISH_TOKEN }}
|
repo_token: ${{ secrets.PUBLISH_TOKEN }}
|
||||||
file: target/release/meilisearch
|
file: target/${{ matrix.target }}/release/meilisearch
|
||||||
asset_name: meilisearch-linux-armv8
|
asset_name: ${{ matrix.asset_name }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
76
.github/workflows/publish-crossbuild.yml
vendored
76
.github/workflows/publish-crossbuild.yml
vendored
@ -1,76 +0,0 @@
|
|||||||
name: Publish aarch64 binary
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-aarch64:
|
|
||||||
name: Publish to Github
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
continue-on-error: false
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- build: aarch64
|
|
||||||
os: ubuntu-18.04
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
linker: gcc-aarch64-linux-gnu
|
|
||||||
use-cross: true
|
|
||||||
asset_name: meilisearch-linux-aarch64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Installing Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
target: ${{ matrix.target }}
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: APT update
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
|
|
||||||
- name: Install target specific tools
|
|
||||||
if: matrix.use-cross
|
|
||||||
run: |
|
|
||||||
sudo apt-get install -y ${{ matrix.linker }}
|
|
||||||
|
|
||||||
- name: Configure target aarch64 GNU
|
|
||||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
||||||
## Environment variable is not passed using env:
|
|
||||||
## LD gold won't work with MUSL
|
|
||||||
# env:
|
|
||||||
# JEMALLOC_SYS_WITH_LG_PAGE: 16
|
|
||||||
# RUSTFLAGS: '-Clink-arg=-fuse-ld=gold'
|
|
||||||
run: |
|
|
||||||
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config
|
|
||||||
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config
|
|
||||||
echo 'JEMALLOC_SYS_WITH_LG_PAGE=16' >> $GITHUB_ENV
|
|
||||||
echo RUSTFLAGS="-Clink-arg=-fuse-ld=gold" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Cargo build
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
use-cross: ${{ matrix.use-cross }}
|
|
||||||
args: --release --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: List target output files
|
|
||||||
run: ls -lR ./target
|
|
||||||
|
|
||||||
- name: Upload the binary to release
|
|
||||||
uses: svenstaro/upload-release-action@v1-release
|
|
||||||
with:
|
|
||||||
repo_token: ${{ secrets.PUBLISH_TOKEN }}
|
|
||||||
file: target/${{ matrix.target }}/release/meilisearch
|
|
||||||
asset_name: ${{ matrix.asset_name }}
|
|
||||||
tag: ${{ github.ref }}
|
|
@ -120,7 +120,7 @@ get_latest() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
echo $latest
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gets the OS by setting the $os variable
|
# Gets the OS by setting the $os variable
|
||||||
@ -148,11 +148,18 @@ get_os() {
|
|||||||
get_archi() {
|
get_archi() {
|
||||||
architecture=$(uname -m)
|
architecture=$(uname -m)
|
||||||
case "$architecture" in
|
case "$architecture" in
|
||||||
'x86_64' | 'amd64' | 'arm64')
|
'x86_64' | 'amd64' )
|
||||||
archi='amd64'
|
archi='amd64'
|
||||||
;;
|
;;
|
||||||
|
'arm64')
|
||||||
|
if [ $os = 'macos' ]; then # MacOS M1
|
||||||
|
archi='amd64'
|
||||||
|
else
|
||||||
|
archi='aarch64'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
'aarch64')
|
'aarch64')
|
||||||
archi='armv8'
|
archi='aarch64'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
return 1
|
return 1
|
||||||
@ -169,30 +176,41 @@ success_usage() {
|
|||||||
echo ' $ ./meilisearch --help'
|
echo ' $ ./meilisearch --help'
|
||||||
}
|
}
|
||||||
|
|
||||||
failure_usage() {
|
not_available_failure_usage() {
|
||||||
printf "$RED%s\n$DEFAULT" 'ERROR: Meilisearch binary is not available for your OS distribution or your architecture yet.'
|
printf "$RED%s\n$DEFAULT" 'ERROR: Meilisearch binary is not available for your OS distribution or your architecture yet.'
|
||||||
echo ''
|
echo ''
|
||||||
echo 'However, you can easily compile the binary from the source files.'
|
echo 'However, you can easily compile the binary from the source files.'
|
||||||
echo 'Follow the steps at the page ("Source" tab): https://docs.meilisearch.com/learn/getting_started/installation.html'
|
echo 'Follow the steps at the page ("Source" tab): https://docs.meilisearch.com/learn/getting_started/installation.html'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch_release_failure_usage() {
|
||||||
|
echo ''
|
||||||
|
printf "$RED%s\n$DEFAULT" 'ERROR: Impossible to get the latest stable version of Meilisearch.'
|
||||||
|
echo 'Please let us know about this issue: https://github.com/meilisearch/meilisearch/issues/new/choose'
|
||||||
|
}
|
||||||
|
|
||||||
# MAIN
|
# MAIN
|
||||||
latest="$(get_latest)"
|
|
||||||
|
# Fill $latest variable
|
||||||
|
if ! get_latest; then
|
||||||
|
fetch_release_failure_usage # TO CHANGE
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$latest" = '' ]; then
|
if [ "$latest" = '' ]; then
|
||||||
echo ''
|
fetch_release_failure_usage
|
||||||
echo 'Impossible to get the latest stable version of Meilisearch.'
|
|
||||||
echo 'Please let us know about this issue: https://github.com/meilisearch/meilisearch/issues/new/choose'
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fill $os variable
|
||||||
if ! get_os; then
|
if ! get_os; then
|
||||||
failure_usage
|
not_available_failure_usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fill $archi variable
|
||||||
if ! get_archi; then
|
if ! get_archi; then
|
||||||
failure_usage
|
not_available_failure_usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -208,8 +226,15 @@ case "$os" in
|
|||||||
binary_name='meilisearch'
|
binary_name='meilisearch'
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Fetch the Meilisearch binary
|
||||||
link="https://github.com/meilisearch/meilisearch/releases/download/$latest/$release_file"
|
link="https://github.com/meilisearch/meilisearch/releases/download/$latest/$release_file"
|
||||||
curl -OL "$link"
|
curl --fail-with-body -OL "$link"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
fetch_release_failure_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mv "$release_file" "$binary_name"
|
mv "$release_file" "$binary_name"
|
||||||
chmod 744 "$binary_name"
|
chmod 744 "$binary_name"
|
||||||
success_usage
|
success_usage
|
||||||
|
Loading…
Reference in New Issue
Block a user