forked from apache/kvrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for manually building artifact
- Loading branch information
Showing
2 changed files
with
132 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
name: Build Release Artifacts | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-artifacts: | ||
name: Build Release Artifacts | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- name: macOS-x86_64 | ||
os: macos-13 | ||
compiler: clang | ||
arch: x86_64 | ||
- name: macOS-arm64 | ||
os: macos-14 | ||
compiler: clang | ||
arch: arm64 | ||
- name: Linux-x86_64 | ||
os: ubuntu-22.04 | ||
compiler: gcc | ||
arch: x86_64 | ||
- name: Linux-arm64 | ||
os: ubuntu-22.04 | ||
compiler: gcc | ||
arch: arm64 | ||
qemu: true | ||
|
||
runs-on: ['${{ matrix.os }}-xlarge'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Setup QEMU for Linux ARM64 builds | ||
- name: Set up QEMU | ||
if: ${{ matrix.qemu }} | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
# Setup macOS | ||
- name: Setup macOS | ||
if: ${{ startsWith(matrix.os, 'macos') }} | ||
run: | | ||
brew install cmake gcc autoconf automake libtool openssl coreutils | ||
echo "NPROC=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV | ||
echo "CMAKE_EXTRA_DEFS=-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" >> $GITHUB_ENV | ||
# Setup Linux | ||
- name: Setup Linux | ||
if: ${{ startsWith(matrix.os, 'ubuntu') }} | ||
run: | | ||
sudo apt update | ||
sudo apt install -y ninja-build | ||
echo "NPROC=$(nproc)" >> $GITHUB_ENV | ||
# Build for macOS | ||
- name: Build macOS Binary | ||
if: ${{ startsWith(matrix.os, 'macos') }} | ||
run: | | ||
./x.py build -j$NPROC --compiler ${{ matrix.compiler }} \ | ||
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \ | ||
-DPORTABLE=1 \ | ||
${{ env.CMAKE_EXTRA_DEFS }} | ||
# Build for Linux x86_64 | ||
- name: Build Linux x86_64 Binary | ||
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.arch == 'x86_64' }} | ||
run: | | ||
./x.py build -j$NPROC --compiler ${{ matrix.compiler }} -DPORTABLE=1 | ||
# Build for Linux ARM64 using Docker | ||
- name: Build Linux ARM64 Binary | ||
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.arch == 'arm64' }} | ||
run: | | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
docker buildx create --use | ||
docker buildx build --platform linux/arm64 \ | ||
--build-arg MORE_BUILD_ARGS="-j$NPROC" \ | ||
--output type=local,dest=build-arm64 . | ||
mkdir -p build | ||
cp build-arm64/bin/kvrocks build/ | ||
# Package artifacts | ||
- name: Package Artifacts | ||
run: | | ||
ARTIFACT_NAME="kvrocks-${{ github.sha }}-${{ matrix.name }}" | ||
mkdir -p "dist/${ARTIFACT_NAME}" | ||
cp build/kvrocks "dist/${ARTIFACT_NAME}/" | ||
cp kvrocks.conf LICENSE NOTICE "dist/${ARTIFACT_NAME}/" | ||
cd dist | ||
tar czf "${ARTIFACT_NAME}.tar.gz" "${ARTIFACT_NAME}" | ||
# Upload artifacts | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: kvrocks-${{ matrix.name }} | ||
path: dist/*.tar.gz | ||
retention-days: 7 | ||
|
||
create-release: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: artifacts/**/*.tar.gz | ||
tag_name: ${{ github.sha }} | ||
|
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