-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: release add centos for os and optimization (#2535)
- Loading branch information
1 parent
e972e03
commit a3ad035
Showing
2 changed files
with
120 additions
and
52 deletions.
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 |
---|---|---|
|
@@ -14,88 +14,86 @@ jobs: | |
strategy: | ||
matrix: | ||
include: | ||
- arch: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
file_name: ${{ github.event.repository.name }}-${{ github.ref_name }}-linux-amd64 | ||
file_ext: .tar.gz | ||
- arch: aarch64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
file_name: ${{ github.event.repository.name }}-${{ github.ref_name }}-linux-arm64 | ||
file_ext: .tar.gz | ||
- arch: x86_64-apple-darwin | ||
os: macos-latest | ||
file_name: ${{ github.event.repository.name }}-${{ github.ref_name }}-darwin-amd64 | ||
file_ext: .tar.gz | ||
- arch: aarch64-apple-darwin | ||
os: macos-latest | ||
file_name: ${{ github.event.repository.name }}-${{ github.ref_name }}-darwin-arm64 | ||
file_ext: .tar.gz | ||
- os: ubuntu-latest | ||
name: ${{ github.event.repository.name }}-${{ github.ref_name }}-ubuntu-amd64.tar.gz | ||
- os: macos-latest | ||
name: ${{ github.event.repository.name }}-${{ github.ref_name }}-macos-amd64.tar.gz | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Deps - linux | ||
if: contains(matrix.arch, 'linux') | ||
- name: Release build os - ${{ matrix.os }} | ||
run: | | ||
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler | ||
sudo apt-get install -y clang-tidy-12 | ||
chmod +x ci/release-build.sh | ||
./ci/release-build.sh install ${{ matrix.os }} ${{ env.BUILD_TYPE }} | ||
- name: Install Deps - darwin | ||
if: contains(matrix.os, 'macos') | ||
- name: Calculate checksum and rename binary | ||
run: | | ||
brew update | ||
brew install --overwrite [email protected] autoconf protobuf llvm wget git | ||
brew install gcc@10 automake cmake make binutils | ||
chmod +x ci/release-build.sh | ||
./ci/release-build.sh checksum ${{ github.event.repository.name }} ${{ matrix.name }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.name }} | ||
path: build/${{ matrix.name }} | ||
|
||
- name: Configure CMake - linux | ||
if: contains(matrix.arch, 'linux') | ||
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS="-s" -DCMAKE_EXE_LINKER_FLAGS="-s" | ||
- name: Upload checksum of artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.name }}.sha256sum | ||
path: build/${{ matrix.name }}.sha256sum | ||
|
||
- name: Configure CMake - darwin | ||
if: contains(matrix.os, 'macos') | ||
centos: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: centos:7 | ||
env: | ||
name: ${{ github.event.repository.name }}-${{ github.ref_name }}-centos-amd64.tar.gz | ||
steps: | ||
- name: Install deps | ||
run: | | ||
yum install -y wget git autoconf centos-release-scl gcc perl-Digest-SHA | ||
yum install -y devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-make devtoolset-10-bin-util | ||
yum install -y llvm-toolset-7 llvm-toolset-7-clang tcl which | ||
- name: Install cmake | ||
run: | | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} | ||
wget https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh | ||
bash ./cmake-3.26.4-linux-x86_64.sh --skip-license --prefix=/usr | ||
- name: Cache Build - linux | ||
if: contains(matrix.arch, 'linux') | ||
uses: actions/cache@v3 | ||
id: cache-ubuntu | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
with: | ||
key: ${{ runner.os }}-build-ubuntu-${{ hashFiles('**/CMakeLists.txt') }} | ||
path: | | ||
${{ github.workspace }}/buildtrees | ||
${{ github.workspace }}/deps | ||
fetch-depth: 0 | ||
|
||
- name: Build | ||
run: cmake --build build --config ${{ env.BUILD_TYPE }} | ||
- name: Release build os - centos | ||
run: | | ||
chmod +x ci/release-build.sh | ||
./ci/release-build.sh install centos ${{ env.BUILD_TYPE }} -xe | ||
- name: Calculate checksum and rename binary | ||
shell: bash | ||
run: | | ||
cd build/ | ||
chmod +x ${{ github.event.repository.name }} | ||
tar -zcvf ${{ matrix.file_name }}${{ matrix.file_ext }} ${{ github.event.repository.name }} | ||
echo $(shasum -a 256 ${{ matrix.file_name }}${{ matrix.file_ext }} | cut -f1 -d' ') > ${{ matrix.file_name }}${{ matrix.file_ext }}.sha256sum | ||
run: ./ci/release-build.sh checksum ${{ github.event.repository.name }} ${{ env.name }} | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.file_name }}${{ matrix.file_ext }} | ||
path: build/${{ matrix.file_name }}${{ matrix.file_ext }} | ||
name: ${{ env.name }} | ||
path: build/${{ env.name }} | ||
|
||
- name: Upload checksum of artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.file_name }}${{ matrix.file_ext }}.sha256sum | ||
path: build/${{ matrix.file_name }}${{ matrix.file_ext }}.sha256sum | ||
name: ${{ env.name }}.sha256sum | ||
path: build/${{ env.name }}.sha256sum | ||
|
||
release: | ||
name: Release artifacts | ||
needs: [ build ] | ||
needs: [ build,centos ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
|
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,70 @@ | ||
#!/bin/bash | ||
|
||
function install_deps() { | ||
echo "install deps before ..." | ||
if [[ $OS == *"macos"* ]]; then | ||
brew update | ||
brew install --overwrite [email protected] autoconf protobuf llvm wget git | ||
brew install gcc@10 automake cmake make binutils | ||
elif [[ $OS == *"ubuntu"* ]]; then | ||
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler | ||
sudo apt-get install -y clang-tidy-12 | ||
else | ||
echo "not support $OS" | ||
fi | ||
echo "install deps after success ..." | ||
} | ||
|
||
function configure_cmake() { | ||
echo "configure cmake before ..." | ||
if [[ $OS == *"macos"* ]]; then | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE | ||
elif [[ $OS == *"ubuntu"* ]]; then | ||
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS="-s" -DCMAKE_EXE_LINKER_FLAGS="-s" | ||
elif [[ $OS == *"centos"* ]]; then | ||
source /opt/rh/devtoolset-10/enable | ||
cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address | ||
fi | ||
echo "configure cmake after ..." | ||
} | ||
|
||
function build() { | ||
echo "build before ..." | ||
cmake --build build --config $BUILD_TYPE | ||
echo "build after success ..." | ||
} | ||
|
||
function install() { | ||
install_deps | ||
configure_cmake | ||
build | ||
} | ||
|
||
function checksum() { | ||
cd build/ && chmod +x $REPO_NAME | ||
|
||
mkdir bin && cp $REPO_NAME bin | ||
mkdir conf && cp ../conf/pika.conf conf | ||
|
||
tar -zcvf $PACKAGE_NAME bin/$REPO_NAME conf/pika.conf | ||
|
||
echo $(shasum -a 256 $PACKAGE_NAME | cut -f1 -d' ') >${PACKAGE_NAME}.sha256sum | ||
} | ||
|
||
case $1 in | ||
"install") | ||
OS=$2 | ||
BUILD_TYPE=$3 | ||
install | ||
;; | ||
"checksum") | ||
REPO_NAME=$2 | ||
PACKAGE_NAME=$3 | ||
checksum | ||
;; | ||
*) | ||
echo "Invalid option" | ||
echo "option $1" | ||
;; | ||
esac |