Added ci build scripts
Added basic github actions build scripts.
This commit is contained in:
parent
c2f0c0ac05
commit
c18632c1b2
|
@ -0,0 +1,63 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/release.yml'
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set rust version
|
||||||
|
run: |
|
||||||
|
source ci/rust-version.sh
|
||||||
|
echo "RUST_STABLE=$rust_stable" | tee -a $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set env vars
|
||||||
|
run: |
|
||||||
|
source ci/env.sh
|
||||||
|
echo "GEYSER_PLUGIN_NAME=$plugin_name" | tee -a $GITHUB_ENV
|
||||||
|
echo "GEYSER_PLUGIN_LIB=lib${plugin_lib_name}" | tee -a $GITHUB_ENV
|
||||||
|
|
||||||
|
- if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libudev-dev libssl-dev libsasl2-dev libzstd-dev
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.RUST_STABLE }}
|
||||||
|
override: true
|
||||||
|
profile: minimal
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
|
- name: Check Solana version
|
||||||
|
run: |
|
||||||
|
echo "CI_TAG=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
|
||||||
|
echo "CI_OS_NAME=linux" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
SOLANA_VERSION="$(./ci/solana-version.sh)"
|
||||||
|
SOLANA_VERSION="v${SOLANA_VERSION#=}"
|
||||||
|
echo "SOLANA_VERSION=$SOLANA_VERSION" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Build release tarball
|
||||||
|
run: ./ci/create-tarball.sh
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
body: |
|
||||||
|
${{ env.GEYSER_PLUGIN_NAME }} ${{ env.CI_TAG }}
|
||||||
|
solana ${{ env.SOLANA_VERSION }}
|
||||||
|
rust ${{ env.RUST_STABLE }}
|
||||||
|
files: |
|
||||||
|
${{ env.GEYSER_PLUGIN_NAME }}-release-*
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Source:
|
||||||
|
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/.github/workflows/test.yml
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set rust version
|
||||||
|
run: |
|
||||||
|
source ci/rust-version.sh
|
||||||
|
echo "RUST_STABLE=$rust_stable" | tee -a $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set env vars
|
||||||
|
run: |
|
||||||
|
source ci/env.sh
|
||||||
|
echo "GEYSER_PLUGIN_NAME=$plugin_name" | tee -a $GITHUB_ENV
|
||||||
|
echo "GEYSER_PLUGIN_LIB=lib${plugin_lib_name}" | tee -a $GITHUB_ENV
|
||||||
|
|
||||||
|
- if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libudev-dev libssl-dev libsasl2-dev libzstd-dev
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.RUST_STABLE }}
|
||||||
|
override: true
|
||||||
|
profile: minimal
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
|
||||||
|
|
||||||
|
- name: cargo fmt
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: fmt
|
||||||
|
args: --all -- --check
|
||||||
|
|
||||||
|
- name: cargo clippy
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: clippy
|
||||||
|
args: --workspace --all-targets #-- --deny=warnings
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./ci/cargo-build-test.sh
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source:
|
||||||
|
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/cargo-build-test.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
source ./ci/rust-version.sh stable
|
||||||
|
|
||||||
|
export RUSTFLAGS="-D warnings"
|
||||||
|
export RUSTBACKTRACE=1
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# Build/test all host crates
|
||||||
|
cargo +"$rust_stable" build
|
||||||
|
cargo +"$rust_stable" test -- --nocapture
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,78 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
exitcode=0
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
exitcode=1
|
||||||
|
echo "Error: $*"
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
usage: $0 [+<cargo version>] [--debug] <install directory>
|
||||||
|
EOF
|
||||||
|
exit $exitcode
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$CI_OS_NAME" in
|
||||||
|
osx)
|
||||||
|
libExt=dylib
|
||||||
|
;;
|
||||||
|
linux)
|
||||||
|
libExt=so
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo CI_OS_NAME unsupported
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
maybeRustVersion=
|
||||||
|
installDir=
|
||||||
|
buildVariant=release
|
||||||
|
maybeReleaseFlag=--release
|
||||||
|
|
||||||
|
while [[ -n $1 ]]; do
|
||||||
|
if [[ ${1:0:1} = - ]]; then
|
||||||
|
if [[ $1 = --debug ]]; then
|
||||||
|
maybeReleaseFlag=
|
||||||
|
buildVariant=debug
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
usage "Unknown option: $1"
|
||||||
|
fi
|
||||||
|
elif [[ ${1:0:1} = \+ ]]; then
|
||||||
|
maybeRustVersion=$1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
installDir=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$installDir" ]]; then
|
||||||
|
usage "Install directory not specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)"
|
||||||
|
|
||||||
|
echo "Install location: $installDir ($buildVariant)"
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"/..
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
|
||||||
|
mkdir -p "$installDir/lib"
|
||||||
|
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
||||||
|
cargo $maybeRustVersion build $maybeReleaseFlag --lib
|
||||||
|
)
|
||||||
|
|
||||||
|
cp -fv "target/$buildVariant/${GEYSER_PLUGIN_LIB}.$libExt" "$installDir"/lib/
|
||||||
|
|
||||||
|
echo "Done after $SECONDS seconds"
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
case "$CI_OS_NAME" in
|
||||||
|
osx)
|
||||||
|
_cputype="$(uname -m)"
|
||||||
|
if [[ $_cputype = arm64 ]]; then
|
||||||
|
_cputype=aarch64
|
||||||
|
fi
|
||||||
|
TARGET=${_cputype}-apple-darwin
|
||||||
|
;;
|
||||||
|
linux)
|
||||||
|
TARGET=x86_64-unknown-linux-gnu
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo CI_OS_NAME unsupported
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
RELEASE_BASENAME="${RELEASE_BASENAME:="${GEYSER_PLUGIN_NAME}-release"}"
|
||||||
|
TARBALL_BASENAME="${TARBALL_BASENAME:="$RELEASE_BASENAME"}"
|
||||||
|
|
||||||
|
echo --- Creating release tarball
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
rm -rf "${RELEASE_BASENAME:?}"/
|
||||||
|
mkdir "${RELEASE_BASENAME}"/
|
||||||
|
|
||||||
|
COMMIT="$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
(
|
||||||
|
echo "channel: $CI_TAG"
|
||||||
|
echo "commit: $COMMIT"
|
||||||
|
echo "target: $TARGET"
|
||||||
|
) > "${RELEASE_BASENAME}"/version.yml
|
||||||
|
|
||||||
|
# Make CHANNEL available to include in the software version information
|
||||||
|
export CHANNEL
|
||||||
|
|
||||||
|
source ci/rust-version.sh stable
|
||||||
|
ci/cargo-install-all.sh stable "${RELEASE_BASENAME}"
|
||||||
|
|
||||||
|
tar cvf "${TARBALL_BASENAME}"-$TARGET.tar "${RELEASE_BASENAME}"
|
||||||
|
bzip2 "${TARBALL_BASENAME}"-$TARGET.tar
|
||||||
|
cp "${RELEASE_BASENAME}"/version.yml "${TARBALL_BASENAME}"-$TARGET.yml
|
||||||
|
)
|
||||||
|
|
||||||
|
echo --- ok
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
plugin_name=solana-geyser-sqs-grpc-release
|
||||||
|
plugin_lib_name=solana_geyser_connector_plugin_grpc
|
|
@ -0,0 +1,137 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source:
|
||||||
|
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/rust-version.sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file maintains the rust versions for use by CI.
|
||||||
|
#
|
||||||
|
# Obtain the environment variables without any automatic toolchain updating:
|
||||||
|
# $ source ci/rust-version.sh
|
||||||
|
#
|
||||||
|
# Obtain the environment variables updating both stable and nightly, only stable, or
|
||||||
|
# only nightly:
|
||||||
|
# $ source ci/rust-version.sh all
|
||||||
|
# $ source ci/rust-version.sh stable
|
||||||
|
# $ source ci/rust-version.sh nightly
|
||||||
|
|
||||||
|
# Then to build with either stable or nightly:
|
||||||
|
# $ cargo +"$rust_stable" build
|
||||||
|
# $ cargo +"$rust_nightly" build
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ -n $RUST_STABLE_VERSION ]]; then
|
||||||
|
stable_version="$RUST_STABLE_VERSION"
|
||||||
|
else
|
||||||
|
stable_version=1.57.0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
|
||||||
|
nightly_version="$RUST_NIGHTLY_VERSION"
|
||||||
|
else
|
||||||
|
nightly_version=2022-02-24
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
export rust_stable="$stable_version"
|
||||||
|
export rust_stable_docker_image=solanalabs/rust:"$stable_version"
|
||||||
|
|
||||||
|
export rust_nightly=nightly-"$nightly_version"
|
||||||
|
export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version"
|
||||||
|
|
||||||
|
[[ -z $1 ]] || (
|
||||||
|
rustup_install() {
|
||||||
|
declare toolchain=$1
|
||||||
|
if ! cargo +"$toolchain" -V > /dev/null; then
|
||||||
|
echo "$0: Missing toolchain? Installing...: $toolchain" >&2
|
||||||
|
rustup install "$toolchain"
|
||||||
|
cargo +"$toolchain" -V
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
case $1 in
|
||||||
|
stable)
|
||||||
|
rustup_install "$rust_stable"
|
||||||
|
;;
|
||||||
|
nightly)
|
||||||
|
rustup_install "$rust_nightly"
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
rustup_install "$rust_stable"
|
||||||
|
rustup_install "$rust_nightly"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0: Note: ignoring unknown argument: $1" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Source:
|
||||||
|
# https://github.com/solana-labs/solana-accountsdb-plugin-postgres/blob/master/ci/rust-version.sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file maintains the rust versions for use by CI.
|
||||||
|
#
|
||||||
|
# Obtain the environment variables without any automatic toolchain updating:
|
||||||
|
# $ source ci/rust-version.sh
|
||||||
|
#
|
||||||
|
# Obtain the environment variables updating both stable and nightly, only stable, or
|
||||||
|
# only nightly:
|
||||||
|
# $ source ci/rust-version.sh all
|
||||||
|
# $ source ci/rust-version.sh stable
|
||||||
|
# $ source ci/rust-version.sh nightly
|
||||||
|
|
||||||
|
# Then to build with either stable or nightly:
|
||||||
|
# $ cargo +"$rust_stable" build
|
||||||
|
# $ cargo +"$rust_nightly" build
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ -n $RUST_STABLE_VERSION ]]; then
|
||||||
|
stable_version="$RUST_STABLE_VERSION"
|
||||||
|
else
|
||||||
|
stable_version=1.57.0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $RUST_NIGHTLY_VERSION ]]; then
|
||||||
|
nightly_version="$RUST_NIGHTLY_VERSION"
|
||||||
|
else
|
||||||
|
nightly_version=2022-02-24
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
export rust_stable="$stable_version"
|
||||||
|
export rust_stable_docker_image=solanalabs/rust:"$stable_version"
|
||||||
|
|
||||||
|
export rust_nightly=nightly-"$nightly_version"
|
||||||
|
export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version"
|
||||||
|
|
||||||
|
[[ -z $1 ]] || (
|
||||||
|
rustup_install() {
|
||||||
|
declare toolchain=$1
|
||||||
|
if ! cargo +"$toolchain" -V > /dev/null; then
|
||||||
|
echo "$0: Missing toolchain? Installing...: $toolchain" >&2
|
||||||
|
rustup install "$toolchain"
|
||||||
|
cargo +"$toolchain" -V
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
case $1 in
|
||||||
|
stable)
|
||||||
|
rustup_install "$rust_stable"
|
||||||
|
;;
|
||||||
|
nightly)
|
||||||
|
rustup_install "$rust_nightly"
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
rustup_install "$rust_stable"
|
||||||
|
rustup_install "$rust_nightly"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0: Note: ignoring unknown argument: $1" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
)
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Prints the Solana version.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
cargo read-manifest | jq -r '.dependencies[] | select(.name == "solana-geyser-plugin-interface") | .req'
|
Loading…
Reference in New Issue