-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(tooling): DEV-1096 Improve CI/CD pipelines for release process (#…
…304) * Only run one instance of linter for specific ref * Bump Checkout action version * Remove broken timeout argument * Made style consistent throughout Lint action * Create dispatcher workflow * Splitting out build * Fix YAML formatting errors * Remove wait on lint * Specify Go version for linting * Make Ubuntu version consistent * Change test.yml to build.yml * Restore Go setup * Combine build tarball and Debian into single job * Added Github CodeQL Action * DEV-1237 Fix issues with build and test workflows (#309) * Deactivate lint and release workflows * Remove set pipefail for workflow * Use script to check for validator status instead of inline GitHub Actions * Fix release tagging * Remove unused script * Fix variable passing * FInal release test Co-authored-by: Ankur Banerjee <[email protected]> Co-authored-by: jay-dee7 <[email protected]>
- Loading branch information
1 parent
75ee782
commit 66352a4
Showing
15 changed files
with
359 additions
and
525 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: "Build" | ||
on: | ||
workflow_call: | ||
outputs: | ||
VERSION: | ||
description: "Build version number" | ||
value: ${{ jobs.build-binary.outputs.VERSION }} | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
|
||
jobs: | ||
go-unit-tests: | ||
name: "Golang unit tests" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.17' | ||
|
||
- name: Run Golang unit tests | ||
run: go test -v ./... | ||
|
||
build-binary: | ||
name: "Node binary" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.set-version.outputs.VERSION }} | ||
|
||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.17' | ||
|
||
- name: Fetch Golang protoc compiler plugins | ||
env: | ||
GOLANG_PROTOBUF_VERSION: 1.3.5 | ||
GOGO_PROTOBUF_VERSION: 1.3.2 | ||
GRPC_GATEWAY_VERSION: 1.14.7 | ||
# Taken from: tendermintdev/sdk-proto-gen:v0.2 | ||
run: | | ||
go get \ | ||
github.com/golang/protobuf/protoc-gen-go@v"$GOLANG_PROTOBUF_VERSION" \ | ||
github.com/gogo/protobuf/protoc-gen-gogo@v"$GOGO_PROTOBUF_VERSION" \ | ||
github.com/gogo/protobuf/protoc-gen-gogofast@v"$GOGO_PROTOBUF_VERSION" \ | ||
github.com/gogo/protobuf/protoc-gen-gogofaster@v"$GOGO_PROTOBUF_VERSION" \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v"$GRPC_GATEWAY_VERSION" \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v"$GRPC_GATEWAY_VERSION" \ | ||
github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest | ||
- name: Install buf | ||
env: | ||
PREFIX: "/usr/local" | ||
VERSION: "1.0.0-rc8" | ||
run: | | ||
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \ | ||
sudo tar -xvzf - -C "${PREFIX}" --strip-components 1 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Required to fetch version | ||
|
||
- name: Build node binary | ||
run: | | ||
make proto-gen build | ||
- name: Store artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cheqd-noded | ||
path: build/cheqd-noded | ||
|
||
- name: Set version number | ||
id: set-version | ||
run: | | ||
VERSION=$(build/cheqd-noded version 2>&1) | ||
echo ::set-output name=VERSION::"$VERSION" | ||
- name: Install fpm | ||
run: | | ||
sudo apt-get install ruby ruby-dev rubygems build-essential | ||
sudo gem install --no-document fpm | ||
- name: Build Debian package | ||
working-directory: ./build-tools | ||
run: | | ||
./build-deb.sh "../build/cheqd-noded" | ||
- name: Store Debian package artifact | ||
uses: actions/upload-artifact@v3 | ||
env: | ||
VERSION: ${{ steps.set-version.outputs.VERSION }} | ||
with: | ||
name: cheqd-node_${{ env.VERSION }}_amd64.deb | ||
path: build-tools/output/cheqd-node_${{ env.VERSION }}_amd64.deb | ||
|
||
build-docker-images: | ||
name: "Docker images" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Required to fetch version | ||
|
||
- name: Build cheqd-cli Docker image 'cheqd-noded' as entrypoint | ||
# TODO: Get rid of UID and GID | ||
run: docker build --target base -t cheqd-cli -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . | ||
|
||
- name: Build cheqd-node Docker image with 'node-start' as entrypoint | ||
run: docker build --target node -t cheqd-node -f docker/Dockerfile --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" . | ||
|
||
- name: Save cheqd-cli Docker image | ||
run: docker save -o cheqd-cli-image.tar cheqd-cli | ||
|
||
- name: Store cheqd-cli artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cheqd-cli-image.tar | ||
path: cheqd-cli-image.tar | ||
|
||
- name: Save cheqd-node Docker image | ||
run: docker save -o cheqd-node-image.tar cheqd-node | ||
|
||
- name: Store cheqd-node artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cheqd-node-image.tar | ||
path: cheqd-node-image.tar |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
name: "Workflow Dispatch" | ||
on: push | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: [ push, workflow_dispatch ] | ||
|
||
jobs: | ||
|
||
call-lint: | ||
name: "Lint" | ||
uses: ./.github/workflows/lint.yml | ||
|
||
call-test: | ||
call-build: | ||
name: "Build" | ||
needs: call-lint | ||
uses: ./.github/workflows/build.yml | ||
|
||
call-test: | ||
name: "Test" | ||
needs: call-build | ||
uses: ./.github/workflows/test.yml | ||
with: | ||
VERSION: ${{ needs.call-build.outputs.VERSION }} | ||
|
||
call-release: | ||
name: "Release" | ||
needs: [call-test, call-build] | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
RELEASE_VERSION: ${{ needs.call-build.outputs.VERSION }} |
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
Oops, something went wrong.