Update deps script
This commit is contained in:
parent
9806b5d67a
commit
0320302786
|
@ -0,0 +1,54 @@
|
|||
name: deps
|
||||
description: 'Build and cache dependencies'
|
||||
inputs:
|
||||
deps-script-path:
|
||||
description: 'Path of deps.sh script'
|
||||
required: true
|
||||
default: './deps.sh'
|
||||
deps-bundle-path:
|
||||
description: 'Path of deps-bundle.sh script'
|
||||
required: true
|
||||
default: './contrib/deps-bundle.sh'
|
||||
outputs: {}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Has apt-get?
|
||||
shell: bash
|
||||
run: |
|
||||
if command -v apt-get > /dev/null 2>&1; then
|
||||
echo "HAS_APT_GET=1" >> $GITHUB_ENV
|
||||
else
|
||||
echo "HAS_APT_GET=0" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: apt-get update
|
||||
shell: bash
|
||||
run: sudo apt-get update
|
||||
if: env.HAS_APT_GET == '1'
|
||||
|
||||
- id: deps-sh-hash
|
||||
shell: bash
|
||||
run: sha256sum '${{ inputs.deps-script-path }}' | awk '{print "HASH=" $1}' >> "$GITHUB_OUTPUT"
|
||||
|
||||
- id: deps-sh-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: deps-bundle.tar.zst
|
||||
key: ${{ runner.os }}-deps-sh-${{ steps.deps-sh-hash.outputs.HASH }}
|
||||
|
||||
- name: Install system level dependencies
|
||||
shell: bash
|
||||
run: '${{ inputs.deps-script-path }}' check
|
||||
|
||||
- name: Install dependencies from cache
|
||||
shell: bash
|
||||
run: tar -Izstd -xvf deps-bundle.tar.zst
|
||||
if: steps.deps-sh-cache.outputs.cache-hit == 'true'
|
||||
|
||||
- name: Install dependencies from scratch
|
||||
shell: bash
|
||||
run: |
|
||||
'${{ inputs.deps-script-path }}' install
|
||||
'${{ inputs.deps-bundle-path }}'
|
||||
if: steps.deps-sh-cache.outputs.cache-hit != 'true'
|
|
@ -8,18 +8,14 @@ jobs:
|
|||
go-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/deps
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.20.5
|
||||
|
||||
- name: Fetch deps
|
||||
run: |
|
||||
# Hosted with Git LFS. See ./contrib/deps-bundle.sh
|
||||
wget -q https://github.com/firedancer-io/radiance/raw/deps/deps-bundle.tar.zst
|
||||
tar -I zstd -xf deps-bundle.tar.zst
|
||||
go-version: 1.22.0
|
||||
|
||||
- name: Vet
|
||||
run: source activate-opt && go vet ./...
|
||||
|
|
|
@ -9,8 +9,6 @@ cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"/..
|
|||
rm -f deps-bundle.tar.zst
|
||||
|
||||
tar -Izstd -cf deps-bundle.tar.zst \
|
||||
./opt/{include,lib,lib64}
|
||||
./opt/{include,lib}
|
||||
|
||||
echo "[+] Created deps-bundle.tar.zst"
|
||||
|
||||
# Now you can commit this file to the deps branch of the repository
|
||||
|
|
21
deps.sh
21
deps.sh
|
@ -297,7 +297,7 @@ install_zstd () {
|
|||
cd ./opt/git/zstd/lib
|
||||
|
||||
echo "[+] Installing zstd to $PREFIX"
|
||||
"${MAKE[@]}" DESTDIR="$PREFIX" PREFIX="" install-pc install-static install-includes
|
||||
"${MAKE[@]}" DESTDIR="$PREFIX" PREFIX="" MOREFLAGS="-fPIC" install-pc install-static install-includes
|
||||
echo "[+] Successfully installed zstd"
|
||||
}
|
||||
|
||||
|
@ -336,13 +336,12 @@ install_lz4 () {
|
|||
|
||||
install_rocksdb () {
|
||||
cd ./opt/git/rocksdb
|
||||
|
||||
echo "[+] Configuring RocksDB"
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake .. \
|
||||
-G"Unix Makefiles" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DROCKSDB_BUILD_SHARED=OFF \
|
||||
-DWITH_GFLAGS=OFF \
|
||||
|
@ -364,21 +363,13 @@ install_rocksdb () {
|
|||
-DSnappy_INCLUDE_DIRS="$PREFIX/include"
|
||||
echo "[+] Configured RocksDB"
|
||||
|
||||
echo "[+] Building RocksDB"
|
||||
local NJOBS
|
||||
if [[ "$OS" == linux ]]; then
|
||||
NJOBS=$(( $(nproc) / 2 ))
|
||||
NJOBS=$((NJOBS>0 ? NJOBS : 1))
|
||||
elif [[ "$OS" == darwin ]]; then
|
||||
NJOBS=$(sysctl -n hw.physicalcpu)
|
||||
else
|
||||
NJOBS=2
|
||||
fi
|
||||
NJOBS=$(( $(nproc) / 2 ))
|
||||
NJOBS=$((NJOBS>0 ? NJOBS : 1))
|
||||
make -j $NJOBS
|
||||
echo "[+] Successfully built RocksDB"
|
||||
|
||||
echo "[+] Installing RocksDB to $PREFIX"
|
||||
make install DESTDIR="$PREFIX"
|
||||
make install
|
||||
echo "[+] Successfully installed RocksDB"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue