mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 07:45:18 +00:00
github action for ci (#1398)
* add workflow for CI on PRs to master or release branch, and every push to master * sprint demo
This commit is contained in:
parent
0e41374baf
commit
3a766030a3
12
.github/.workflows/lint.yml
vendored
12
.github/.workflows/lint.yml
vendored
@ -1,12 +0,0 @@
|
|||||||
name: Lint
|
|
||||||
on: [pull_request]
|
|
||||||
jobs:
|
|
||||||
golangci-lint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: golangci-lint
|
|
||||||
uses: reviewdog/action-golangci-lint@v1
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.github_token }}
|
|
||||||
reporter: github-pr-review
|
|
15
.github/scripts/install-rocksdb.sh
vendored
Executable file
15
.github/scripts/install-rocksdb.sh
vendored
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# install build dependencies
|
||||||
|
sudo apt-get install -y libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
|
||||||
|
|
||||||
|
# get rocksdb sources
|
||||||
|
git clone https://github.com/facebook/rocksdb.git /home/runner/rocksdb
|
||||||
|
|
||||||
|
cd /home/runner/rocksdb
|
||||||
|
|
||||||
|
git checkout v7.7.3
|
||||||
|
|
||||||
|
# install rocksdb locally
|
||||||
|
sudo make -j $(nproc --all) install-shared
|
14
.github/scripts/publish-internal-release-artifacts.sh
vendored
Executable file
14
.github/scripts/publish-internal-release-artifacts.sh
vendored
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
archs=(amd64)
|
||||||
|
dbs=(goleveldb rocksdb)
|
||||||
|
OS=linux
|
||||||
|
|
||||||
|
for db in "${dbs[@]}"
|
||||||
|
do
|
||||||
|
for arch in "${archs[@]}"
|
||||||
|
do
|
||||||
|
env GOOS=$OS GOARCH="$arch" make build COSMOS_BUILD_OPTIONS="$db" && aws s3 cp ./out/$OS/kava s3://releases.kava.io/kava/$OS/"$db"/"$BUILD_TAG"
|
||||||
|
done
|
||||||
|
done
|
78
.github/workflows/ci.yml
vendored
Normal file
78
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
name: Continuous Integration
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
# run CI on pull requests to master or a release branch
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- 'releases/**'
|
||||||
|
push:
|
||||||
|
# run CI on any push to the master branch
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
# concurrently lint, build, and run tests against kava based off current commit
|
||||||
|
jobs:
|
||||||
|
golangci-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: reviewdog/action-golangci-lint@v1
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.github_token }}
|
||||||
|
reporter: github-pr-review
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repo from current commit
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: build application
|
||||||
|
run: make build
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout repo from current commit
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: run unit tests
|
||||||
|
run: make test
|
||||||
|
# only run on merges to master
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref_name == 'master'
|
||||||
|
steps:
|
||||||
|
- name: checkout repo from current commit
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.18'
|
||||||
|
check-latest: true
|
||||||
|
cache: true
|
||||||
|
- name: build application
|
||||||
|
run: make build
|
||||||
|
- name: run unit tests
|
||||||
|
run: make test
|
||||||
|
- name: set build tag
|
||||||
|
run: echo "BUILD_TAG=$(date +%s)-$(git rev-parse HEAD | cut -c 1-8)" >> $GITHUB_ENV
|
||||||
|
- name: build rocksdb dependency
|
||||||
|
run: bash ${GITHUB_WORKSPACE}/.github/scripts/install-rocksdb.sh
|
||||||
|
env:
|
||||||
|
ROCKSDB_VERSION: v7.7.3
|
||||||
|
- name: Build and upload release artifacts
|
||||||
|
run: bash ${GITHUB_WORKSPACE}/.github/scripts/publish-internal-release-artifacts.sh
|
||||||
|
env:
|
||||||
|
BUILD_TAG: ${{ env.BUILD_TAG }}
|
||||||
|
AWS_REGION: us-east-1
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_KEY_SECRET }}
|
Loading…
Reference in New Issue
Block a user