diff --git a/.github/.workflows/lint.yml b/.github/.workflows/lint.yml deleted file mode 100644 index de312698..00000000 --- a/.github/.workflows/lint.yml +++ /dev/null @@ -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 diff --git a/.github/scripts/install-rocksdb.sh b/.github/scripts/install-rocksdb.sh new file mode 100755 index 00000000..0e1f0795 --- /dev/null +++ b/.github/scripts/install-rocksdb.sh @@ -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 diff --git a/.github/scripts/publish-internal-release-artifacts.sh b/.github/scripts/publish-internal-release-artifacts.sh new file mode 100755 index 00000000..38ccdd99 --- /dev/null +++ b/.github/scripts/publish-internal-release-artifacts.sh @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b9662332 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }}