Refine code #136
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
# https://github.com/mvdan/github-actions-golang | |
name: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go: [1.18.x] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Dependencies | |
run: | | |
sudo apt install gcc-9 g++-9 | |
sudo apt install libgflags-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev | |
sudo apt install libsnappy-dev | |
- name: Cache rocksdb | |
id: cache-rocksdb | |
uses: actions/cache@v2 | |
with: | |
path: rocksdb-5.18.4 | |
key: ${{ runner.os }}-rocksdb-5.18.4-static2 | |
- name: Build rocksdb | |
if: steps.cache-rocksdb.outputs.cache-hit != 'true' | |
run: | | |
wget https://github.com/facebook/rocksdb/archive/refs/tags/v5.18.4.tar.gz | |
tar zxvf v5.18.4.tar.gz | |
cd rocksdb-5.18.4 | |
# make EXTRA_CXXFLAGS="-march=x86-64" CC=gcc-9 CXX=g++-9 static_lib | |
wget -O - https://raw.githubusercontent.com/smartbch/artifacts/main/patches/rocksdb.gcc11.patch | git apply -v | |
CXXFLAGS=-Wno-range-loop-construct PORTABLE=1 make -j4 static_lib | |
strip --strip-unneeded librocksdb.a | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
path: moeingevm | |
- name: Checkout testdata | |
uses: actions/checkout@v2 | |
with: | |
repository: smartbch/testdata | |
path: testdata | |
- name: Build evmwrap | |
run: | | |
cd moeingevm/evmwrap | |
make | |
- name: Build & Test | |
run: | | |
export ROCKSDB_PATH="$PWD/rocksdb-5.18.4" | |
export CGO_CFLAGS="-I/$ROCKSDB_PATH/include" | |
export CGO_LDFLAGS="-L/$ROCKSDB_PATH -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd" | |
export LD_LIBRARY_PATH=$ROCKSDB_PATH:/usr/local/lib | |
export EVMWRAP=$PWD/moeingevm/evmwrap/host_bridge/libevmwrap.so | |
cd moeingevm | |
go build -tags cppbtree ./... | |
go test -tags cppbtree ./... | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2 | |
/home/runner/go/bin/golangci-lint run |