-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up and update workflow files (#2193)
* Split up github workflow files * Split up github workflow files * Clean up * Clean up * Checkout repo before setup go --------- Co-authored-by: arturrez <[email protected]>
- Loading branch information
1 parent
7dff013
commit 1f6de79
Showing
6 changed files
with
132 additions
and
129 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
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,51 +1,12 @@ | ||
name: Lint + Unit Tests | ||
name: E2E Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
GO_VERSION: "1.21.7" | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.56.2 | ||
working-directory: . | ||
args: --timeout 5m | ||
- name: Install license check | ||
run: go install github.com/google/[email protected] | ||
- name: Check license | ||
run: addlicense -f ./LICENSE.header -check -v ./**/*.go ./**/**/*.go ./**/**/**/*.go ./**/**/**/**/*.go | ||
test: | ||
name: Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
go: ["1.21.7"] | ||
os: [ubuntu-20.04, macos-13] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- run: go mod download | ||
- run: scripts/build.sh | ||
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/ | grep -v '/sdk/') | ||
env: | ||
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST | ||
- run: go tool cover -func=coverage.out | ||
e2e_test: | ||
name: e2e tests | ||
runs-on: ${{ matrix.os }} | ||
|
@@ -71,70 +32,74 @@ jobs: | |
"\\[Node devnet\\]", | ||
"\\[Docker\\]", | ||
] | ||
os: [ubuntu-latest, macos-13] | ||
os: [ubuntu-latest, macos-14] | ||
exclude: | ||
- os: macos-13 | ||
- os: macos-14 | ||
suite: "\\[Node create\\]" | ||
- os: macos-13 | ||
- os: macos-14 | ||
suite: "\\[Node devnet\\]" | ||
- os: macos-13 | ||
- os: macos-14 | ||
suite: "\\[Docker\\]" | ||
- os: macos-13 | ||
- os: macos-14 | ||
suite: "\\[Public Subnet\\]" | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
#- name: DEBUG => Setup upterm session | ||
# uses: lhotari/action-upterm@v1 | ||
# with: | ||
# limit-access-to-actor: true | ||
- name: Install macosx dependencies | ||
if: ${{ matrix.os == 'macos-13' }} | ||
run: | | ||
brew install python-setuptools | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version-file: 'go.mod' | ||
|
||
- name: Install MacOSX dependencies | ||
if: ${{ matrix.os == 'macos-14' }} | ||
run: brew install python-setuptools | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- name: Yarn install | ||
|
||
- name: Yarn Install | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
retry_on: error | ||
command: yarn --cwd ./tests/e2e/hardhat | ||
- name: ts-node install | ||
|
||
- name: Install Typescript | ||
shell: bash | ||
run: | | ||
npm install -g typescript | ||
npm install -g ts-node | ||
npm install -g tsx | ||
- name: Install docker on macos | ||
if: ${{ (matrix.os == 'macos-13') && (matrix.suite == '\\[Public Subnet\\]') }} | ||
- name: Install Docker on MacOS | ||
if: ${{ (matrix.os == 'macos-14') && (matrix.suite == '\\[Public Subnet\\]') }} | ||
run: | | ||
brew install docker | ||
brew install colima | ||
colima start --vm-type vz | ||
sudo ln -s ~/.colima/default/docker.sock /var/run/docker.sock | ||
- name: generate ssh token for e2e tests | ||
- name: Generate SSH token for E2E tests | ||
run: | | ||
mkdir -p ~/.ssh && ssh-keygen -b 2048 -t rsa -f ~/.ssh/runner-avalanche-cli-keypair -q -N "" | ||
echo "E2E_SSH_PUB_KEY<<EOF" >> $GITHUB_ENV | ||
cat ~/.ssh/runner-avalanche-cli-keypair >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- uses: webfactory/[email protected] | ||
- name: Set up SSH Agent | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ env.E2E_SSH_PUB_KEY }} | ||
- name: Run e2e tests | ||
|
||
- name: Run E2E tests | ||
shell: bash | ||
run: AVALANCHE_CLI_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} LEDGER_SIM=true scripts/run.e2e.sh --filter "${{ matrix.suite }}" | ||
- name: "Upload Artifact" | ||
|
||
- name: Upload Artifact | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
|
@@ -144,6 +109,3 @@ jobs: | |
!~/.avalanche-cli/bin/ | ||
!~/.avalanche-cli/snapshots | ||
retention-days: 5 | ||
#- name: "DEBUG => Sleep for 6 hours" | ||
# if: always() | ||
# run: sleep 6h |
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,32 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Lint Golang | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.56.2 | ||
working-directory: . | ||
args: --timeout 5m | ||
|
||
- name: Check License | ||
run: | | ||
go install github.com/google/[email protected] | ||
addlicense -f ./LICENSE.header -check -v ./**/*.go ./**/**/*.go ./**/**/**/*.go ./**/**/**/**/*.go |
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 |
---|---|---|
@@ -1,69 +1,41 @@ | ||
name: Release (with lint and test) | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
# First confirm that the linting and unit tests pass at this commit prior to creating release artifacts. | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.21.7" | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.56.2 | ||
working-directory: . | ||
args: --timeout 3m | ||
- name: Install license check | ||
run: go install github.com/google/[email protected] | ||
- name: Check license | ||
run: addlicense -f ./LICENSE.header -check -v ./**/*.go | ||
test: | ||
name: Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
go: ["1.21.7"] | ||
os: [ubuntu-20.04] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- run: go mod download | ||
- run: scripts/build.sh | ||
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/ | grep -v '/sdk/') | ||
env: | ||
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST | ||
- run: go tool cover -func=coverage.out | ||
uses: ./.github/workflows/lint.yml | ||
|
||
unit_test: | ||
uses: ./.github/workflows/unit-test.yml | ||
|
||
release: | ||
needs: [lint, test] | ||
runs-on: ubuntu-20.04 | ||
needs: [lint, unit_test] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
path: avalanche-cli | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21.7" | ||
go-version-file: 'go.mod' | ||
|
||
- name: Set up arm64 cross compiler | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install gcc-aarch64-linux-gnu | ||
- name: Checkout osxcross | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: tpoechtrager/osxcross | ||
path: osxcross | ||
|
||
- name: Build osxcross | ||
run: | | ||
sudo apt-get -y install clang llvm-dev libxml2-dev uuid-dev libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio libbz2-dev | ||
|
@@ -75,15 +47,19 @@ jobs: | |
env: | ||
MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz | ||
MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASS }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
|
@@ -92,7 +68,7 @@ jobs: | |
args: release --clean | ||
workdir: ./avalanche-cli/ | ||
env: | ||
#https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret | ||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TELEMETRY_TOKEN: ${{ secrets.POSTHOG_PROD_TOKEN }} | ||
DOCKERFILE: ./Dockerfile.release |
Oops, something went wrong.