-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add GitHub workflow to check test and release automatically (#857)
* chore: add integration test workflow * add build and test in workflow * optimize workflow cache * skip error file * feat: add release workflow * fix release workflow * disable window to debug * test release name * fix release tag * fix release tag * add macos * fix macos * fix make test * remove windows, zip before upload * remove build in integration ci * update integration * update release * fix integration test * debug * remove debug * clean up * adjust release strategy * fix multiple cmds * fix paramhub * get app_pub back * remove app_pub_test * add lint * fix lint * fix pub
- Loading branch information
1 parent
c0877c6
commit 9345462
Showing
30 changed files
with
234 additions
and
71 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,33 @@ | ||
name: integration-ci | ||
|
||
on: ["push", "pull_request", "workflow_dispatch"] | ||
|
||
jobs: | ||
integration-test: | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.16 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: sudo apt-get update -y && sudo apt-get install -y expect | ||
- run: git config --global url."https://${{ secrets.GH_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" | ||
- run: go env -w GOPRIVATE="github.com/bnb-chain/*" | ||
# used to debug workflow | ||
# - name: Setup tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
- run: make integration_test | ||
- run: make test |
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,157 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
name: Build Release | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
os: [ubuntu-18.04, macos-11, windows-2019] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
# * Build cache (Windows) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: go env -w GOPRIVATE="github.com/bnb-chain/*" | ||
- run: git config --global url."https://${{ secrets.GH_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" | ||
|
||
# ============================== | ||
# Linux/Macos/Windows Build | ||
# ============================== | ||
|
||
# used to debug workflow | ||
# - name: Setup tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
|
||
- name: Build Binary for ${{matrix.os}} | ||
run: make build | ||
|
||
# ============================== | ||
# Upload artifacts | ||
# ============================== | ||
|
||
- name: Upload Linux Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'ubuntu-18.04' | ||
with: | ||
name: linux | ||
path: ./build | ||
|
||
- name: Upload MacOS Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'macos-11' | ||
with: | ||
name: macos | ||
path: ./build | ||
|
||
- name: Upload Windows Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'windows-2019' | ||
with: | ||
name: windows | ||
path: ./build | ||
|
||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
# ============================== | ||
# Download artifacts | ||
# ============================== | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: linux | ||
path: ./linux | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: macos | ||
path: ./macos | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: windows | ||
path: ./windows | ||
|
||
- run: zip -r linux.zip linux | ||
- run: zip -r macos.zip macos | ||
- run: zip -r windows.zip windows | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: ${{ github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
|
||
# Check downloaded files | ||
- run: ls | ||
|
||
- name: Upload Release Asset - Linux | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./linux.zip | ||
asset_name: bnb-chain-node-binary-linux-${{ github.ref_name }}.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset - MacOS | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./macos.zip | ||
asset_name: bnb-chain-node-binary-macos-${{ github.ref_name }}.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset - Windows | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./windows.zip | ||
asset_name: bnb-chain-node-binary-windows-${{ github.ref_name }}.zip | ||
asset_content_type: application/octet-stream |
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -9,4 +9,4 @@ set timeout 30 | |
send "12345678\r" | ||
expect "Repeat*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -18,4 +18,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ set timeout 30 | |
} | ||
expect "Password*" | ||
send "12345678\r" | ||
interact | ||
expect eof |
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
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 |
---|---|---|
|
@@ -18,4 +18,4 @@ set timeout 30 | |
send "12345678\r" | ||
expect "Enter*" | ||
send "${secret}\r" | ||
interact | ||
expect eof |
Oops, something went wrong.