From 5fb26c1c4a190038e3e4aadd2d1af31ca43a0af7 Mon Sep 17 00:00:00 2001 From: Richard Pringle Date: Wed, 1 May 2024 14:13:40 +0200 Subject: [PATCH] Consolidate CI (#828) * Add rust-ci local github-action * Abstract install-go action * Centralize Go install parameters * Consolidate CI * Comment out code coverage * Finish centralizing the Go installation for CI * Handle releases * Fix passing secret to release-actions * [ci] Small Tweaks (#875) * nits * remove labels --------- Co-authored-by: Patrick O'Grady --- .github/actions/install-go/action.yml | 23 ++ .github/actions/install-rust/action.yml | 21 ++ .../actions/token-wallet-release/action.yml | 23 ++ .github/actions/vm-release/action.yml | 52 +++ .github/workflows/auto-generated-checker.yml | 27 -- .github/workflows/codeql-analysis.yml | 59 ++-- .github/workflows/hypersdk-ci.yml | 308 ++++++++++++++++++ .../workflows/hypersdk-static-analysis.yml | 34 -- .github/workflows/hypersdk-unit-tests.yml | 31 -- .github/workflows/morpheusvm-load-tests.yml | 40 --- .github/workflows/morpheusvm-release.yml | 65 ---- .../workflows/morpheusvm-static-analysis.yml | 40 --- .github/workflows/morpheusvm-sync-tests.yml | 39 --- .github/workflows/morpheusvm-unit-tests.yml | 58 ---- .github/workflows/rust-ci.yml | 52 ++- .github/workflows/tidy-checker.yml | 33 -- .github/workflows/tokenvm-load-tests.yml | 40 --- .github/workflows/tokenvm-release.yml | 92 ------ .github/workflows/tokenvm-static-analysis.yml | 40 --- .github/workflows/tokenvm-sync-tests.yml | 39 --- .github/workflows/tokenvm-unit-tests.yml | 58 ---- .github/workflows/vm-release.yml | 43 +++ 22 files changed, 519 insertions(+), 698 deletions(-) create mode 100644 .github/actions/install-go/action.yml create mode 100644 .github/actions/install-rust/action.yml create mode 100644 .github/actions/token-wallet-release/action.yml create mode 100644 .github/actions/vm-release/action.yml delete mode 100644 .github/workflows/auto-generated-checker.yml create mode 100644 .github/workflows/hypersdk-ci.yml delete mode 100644 .github/workflows/hypersdk-static-analysis.yml delete mode 100644 .github/workflows/hypersdk-unit-tests.yml delete mode 100644 .github/workflows/morpheusvm-load-tests.yml delete mode 100644 .github/workflows/morpheusvm-release.yml delete mode 100644 .github/workflows/morpheusvm-static-analysis.yml delete mode 100644 .github/workflows/morpheusvm-sync-tests.yml delete mode 100644 .github/workflows/morpheusvm-unit-tests.yml delete mode 100644 .github/workflows/tidy-checker.yml delete mode 100644 .github/workflows/tokenvm-load-tests.yml delete mode 100644 .github/workflows/tokenvm-release.yml delete mode 100644 .github/workflows/tokenvm-static-analysis.yml delete mode 100644 .github/workflows/tokenvm-sync-tests.yml delete mode 100644 .github/workflows/tokenvm-unit-tests.yml create mode 100644 .github/workflows/vm-release.yml diff --git a/.github/actions/install-go/action.yml b/.github/actions/install-go/action.yml new file mode 100644 index 0000000000..4e392688db --- /dev/null +++ b/.github/actions/install-go/action.yml @@ -0,0 +1,23 @@ +name: 'Install Go toolchain with defaults' +description: 'Install a go toolchain with defaults' + +inputs: + cache: + description: "to cache or not to cache, that is the question" + required: false + default: "true" + cache-dependency-path: + description: "forwards go actions/setup-go" + required: false + + +runs: + using: composite + steps: + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + check-latest: true + cache: ${{ inputs.cache }} + cache-dependency-path: ${{ inputs.cache-dependency-path }} diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml new file mode 100644 index 0000000000..5943e6505e --- /dev/null +++ b/.github/actions/install-rust/action.yml @@ -0,0 +1,21 @@ +name: 'Install Rust toolchain and Cache' +description: 'Install a rust toolchain and cache' + +inputs: + targets: + description: 'pass targets to the rust-toolchain installer' + required: false + cache: + description: "to cache or not to cache, that is the question" + required: false + default: "true" + +runs: + using: composite + steps: + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ inputs.targets }} + - if: ${{ inputs.cache == 'true' }} + uses: Swatinem/rust-cache@v2 diff --git a/.github/actions/token-wallet-release/action.yml b/.github/actions/token-wallet-release/action.yml new file mode 100644 index 0000000000..7b8230f3bb --- /dev/null +++ b/.github/actions/token-wallet-release/action.yml @@ -0,0 +1,23 @@ +name: 'Release Token Wallet' +description: 'Release the Token Wallet' + +runs: + using: composite + steps: + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Build wallet + working-directory: ./examples/tokenvm/cmd/token-wallet + shell: bash + run: scripts/build.sh + env: + PUBLISH: "false" + - name: Archive Builds + uses: actions/upload-artifact@v4 + with: + name: token-wallet + path: ./examples/tokenvm/cmd/token-wallet/token-wallet.zip diff --git a/.github/actions/vm-release/action.yml b/.github/actions/vm-release/action.yml new file mode 100644 index 0000000000..3be3e88ca7 --- /dev/null +++ b/.github/actions/vm-release/action.yml @@ -0,0 +1,52 @@ +name: 'Release VM' +description: 'Release the VM' + +inputs: + vm-name: + description: 'VM name' + required: true + github-token: + description: 'GitHub Token' + required: true + +runs: + using: composite + steps: + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/${{ inputs.vm-name }}/go.sum + - name: Set up arm64 cross compiler + shell: bash + run: | + sudo apt-get -y update + sudo apt-get -y install gcc-aarch64-linux-gnu + - name: Checkout osxcross + uses: actions/checkout@v2 + with: + repository: tpoechtrager/osxcross + path: osxcross + - name: Build osxcross + shell: bash + 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 + cd osxcross + wget https://github.com/joseluisq/macosx-sdks/releases/download/12.3/$MACOS_SDK_FNAME -O tarballs/$MACOS_SDK_FNAME + echo $MACOS_SDK_CHECKSUM tarballs/$MACOS_SDK_FNAME | sha256sum -c - + UNATTENDED=1 ./build.sh + echo $PWD/target/bin >> $GITHUB_PATH + env: + MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz + MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + distribution: goreleaser + version: latest + args: release + workdir: ./examples/${{ inputs.vm-name }}/ + env: + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret + GITHUB_TOKEN: ${{ inputs.github-token }} diff --git a/.github/workflows/auto-generated-checker.yml b/.github/workflows/auto-generated-checker.yml deleted file mode 100644 index 5dbc5f45ab..0000000000 --- a/.github/workflows/auto-generated-checker.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Auto-Generated Code Checker -on: - push: - branches: - - main - pull_request: - -jobs: - mock_gen: - name: Mocks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - - shell: bash - run: scripts/mock.gen.sh - - shell: bash - run: scripts/tests.clean.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8c5984fcf2..6810d64667 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,14 +12,14 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: - cron: '41 18 * * 3' @@ -35,44 +35,43 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go' ] + language: ['go'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/hypersdk-ci.yml b/.github/workflows/hypersdk-ci.yml new file mode 100644 index 0000000000..143be18d79 --- /dev/null +++ b/.github/workflows/hypersdk-ci.yml @@ -0,0 +1,308 @@ +name: HyperSDK CI +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + mock-gen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + - shell: bash + run: scripts/mock.gen.sh + - shell: bash + run: scripts/tests.clean.sh + + go-mod-tidy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + - shell: bash + run: go mod tidy + - shell: bash + working-directory: ./examples/morpheusvm + run: go mod tidy + - shell: bash + working-directory: ./examples/tokenvm + run: go mod tidy + - shell: bash + run: scripts/tests.clean.sh + + hypersdk-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + - name: Run static analysis tests + shell: bash + run: scripts/tests.lint.sh + - name: Run shellcheck + shell: bash + run: scripts/tests.shellcheck.sh + + hypersdk-unit-tests: + runs-on: ubuntu-20.04-32 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + - name: Run unit tests + shell: bash + run: scripts/tests.unit.sh + + hypersdk-tests: + runs-on: ubuntu-latest + needs: [mock-gen, go-mod-tidy, hypersdk-lint, hypersdk-unit-tests] + steps: + - name: Finished HyperSDK tests + run: echo "Finished HyperSDK tests" + + # TokenVM + tokenvm-lint: + needs: [hypersdk-tests] + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Run static analysis tests + working-directory: ./examples/tokenvm + shell: bash + run: scripts/tests.lint.sh + - name: Build vm, cli, faucet, feed + working-directory: ./examples/tokenvm + shell: bash + run: scripts/build.sh + + tokenvm-unit-tests: + needs: [hypersdk-tests] + runs-on: ubuntu-20.04-32 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Run unit tests + working-directory: ./examples/tokenvm + shell: bash + run: scripts/tests.unit.sh + - name: Run integration tests + working-directory: ./examples/tokenvm + shell: bash + run: scripts/tests.integration.sh + # - name: Archive code coverage results (text) + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-out + # path: ./examples/tokenvm/integration.coverage.out + # - name: Archive code coverage results (html) + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-html + # path: ./examples/tokenvm/integration.coverage.html + - name: Run e2e tests + working-directory: ./examples/tokenvm + shell: bash + run: scripts/run.sh + env: + MODE: 'test' + + tokenvm-load-tests: + needs: [tokenvm-unit-tests] + strategy: + matrix: + level: [v1, v2, v3] # v4 is not supported + runs-on: ubuntu-20.04-32 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Run load tests + working-directory: ./examples/tokenvm + shell: bash + run: GOAMD64=${{ matrix.level }} scripts/tests.load.sh + + tokenvm-sync-tests: + needs: [tokenvm-unit-tests] + runs-on: ubuntu-20.04-32 + timeout-minutes: 25 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/tokenvm/go.sum + - name: Run sync tests + working-directory: ./examples/tokenvm + shell: bash + run: scripts/run.sh + env: + MODE: 'full-test' + + token-wallet-release: + needs: [tokenvm-load-tests, tokenvm-sync-tests] + runs-on: macos-latest-xl + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/token-wallet-release + + tokenvm-release: + needs: [tokenvm-load-tests, tokenvm-sync-tests] + # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 + runs-on: ubuntu-20.04-32 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/vm-release + with: + vm-name: tokenvm + github-token: ${{ secrets.GITHUB_TOKEN }} + + # MorpheusVM + morpheusvm-lint: + needs: [hypersdk-tests] + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/morpheusvm/go.sum + - name: Run static analysis tests + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/tests.lint.sh + - name: Build vm, cli + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/build.sh + + morpheusvm-unit-tests: + needs: [hypersdk-tests] + runs-on: ubuntu-20.04-32 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/morpheusvm/go.sum + - name: Run unit tests + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/tests.unit.sh + - name: Run integration tests + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/tests.integration.sh + # - name: Archive code coverage results (text) + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-out + # path: ./examples/morpheusvm/integration.coverage.out + # - name: Archive code coverage results (html) + # uses: actions/upload-artifact@v4 + # with: + # name: code-coverage-html + # path: ./examples/morpheusvm/integration.coverage.html + - name: Run e2e tests + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/run.sh + env: + MODE: 'test' + + morpheusvm-load-tests: + needs: [morpheusvm-unit-tests] + strategy: + matrix: + level: [v1, v2, v3] # v4 is not supported + runs-on: ubuntu-20.04-32 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/morpheusvm/go.sum + - name: Run load tests + working-directory: ./examples/morpheusvm + shell: bash + run: GOAMD64=${{ matrix.level }} scripts/tests.load.sh + + morpheusvm-sync-tests: + needs: [morpheusvm-unit-tests] + runs-on: ubuntu-20.04-32 + timeout-minutes: 25 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: ./.github/actions/install-go + with: + cache-dependency-path: | + go.sum + examples/morpheusvm/go.sum + - name: Run sync tests + working-directory: ./examples/morpheusvm + shell: bash + run: scripts/run.sh + env: + MODE: 'full-test' + + morpheusvm-release: + needs: [morpheusvm-load-tests, morpheusvm-sync-tests] + # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 + runs-on: ubuntu-20.04-32 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/vm-release + with: + vm-name: morpheusvm + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/hypersdk-static-analysis.yml b/.github/workflows/hypersdk-static-analysis.yml deleted file mode 100644 index badb2afa88..0000000000 --- a/.github/workflows/hypersdk-static-analysis.yml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: HyperSDK Static Analysis - -on: - push: - branches: - - main - pull_request: - -jobs: - hypersdk-lint: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - - name: Run static analysis tests - shell: bash - run: scripts/tests.lint.sh - - name: Run shellcheck - shell: bash - run: scripts/tests.shellcheck.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/hypersdk-unit-tests.yml b/.github/workflows/hypersdk-unit-tests.yml deleted file mode 100644 index e26f0e624d..0000000000 --- a/.github/workflows/hypersdk-unit-tests.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: HyperSDK Unit Tests - -on: - push: - branches: - - main - pull_request: - -jobs: - hypersdk-unit-tests: - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - - name: Run unit tests - shell: bash - run: scripts/tests.unit.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/morpheusvm-load-tests.yml b/.github/workflows/morpheusvm-load-tests.yml deleted file mode 100644 index 021c3377f4..0000000000 --- a/.github/workflows/morpheusvm-load-tests.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: MorpheusVM Load Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - morpheusvm-load-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - strategy: - matrix: - level: [v1, v2, v3] # v4 is not supported - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/morpheusvm/go.sum - - name: Run load tests - working-directory: ./examples/morpheusvm - shell: bash - run: GOAMD64=${{ matrix.level }} scripts/tests.load.sh -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/morpheusvm-release.yml b/.github/workflows/morpheusvm-release.yml deleted file mode 100644 index ef2d624194..0000000000 --- a/.github/workflows/morpheusvm-release.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: MorpheusVM Release - -on: - push: - branches: - - main - tags: - - "*" - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - morpheusvm-release: - # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 - runs-on: ubuntu-20.04-32 - if: ${{ github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - steps: - - name: Git checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/morpheusvm/go.sum - - 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@v2 - 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 - cd osxcross - wget https://github.com/joseluisq/macosx-sdks/releases/download/12.3/$MACOS_SDK_FNAME -O tarballs/$MACOS_SDK_FNAME - echo $MACOS_SDK_CHECKSUM tarballs/$MACOS_SDK_FNAME | sha256sum -c - - UNATTENDED=1 ./build.sh - echo $PWD/target/bin >> $GITHUB_PATH - env: - MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz - MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release - workdir: ./examples/morpheusvm/ - env: - # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/morpheusvm-static-analysis.yml b/.github/workflows/morpheusvm-static-analysis.yml deleted file mode 100644 index 8259a3cf81..0000000000 --- a/.github/workflows/morpheusvm-static-analysis.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: MorpheusVM Static Analysis - -on: - push: - branches: - - main - pull_request: - -jobs: - morpheusvm-lint: - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/morpheusvm/go.sum - - name: Run static analysis tests - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/tests.lint.sh - - name: Build vm, cli - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/build.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/morpheusvm-sync-tests.yml b/.github/workflows/morpheusvm-sync-tests.yml deleted file mode 100644 index 7f2a2a2204..0000000000 --- a/.github/workflows/morpheusvm-sync-tests.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: MorpheusVM Sync Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - morpheusvm-sync-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 25 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/morpheusvm/go.sum - - name: Run sync tests - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/run.sh - env: - MODE: "full-test" -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/morpheusvm-unit-tests.yml b/.github/workflows/morpheusvm-unit-tests.yml deleted file mode 100644 index 25bd47ecd8..0000000000 --- a/.github/workflows/morpheusvm-unit-tests.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: MorpheusVM Unit Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - morpheusvm-unit-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/morpheusvm/go.sum - - name: Run unit tests - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/tests.unit.sh - - name: Run integration tests - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/tests.integration.sh - - name: Archive code coverage results (text) - uses: actions/upload-artifact@v4 - with: - name: code-coverage-out - path: ./examples/morpheusvm/integration.coverage.out - - name: Archive code coverage results (html) - uses: actions/upload-artifact@v4 - with: - name: code-coverage-html - path: ./examples/morpheusvm/integration.coverage.html - - name: Run e2e tests - working-directory: ./examples/morpheusvm - shell: bash - run: scripts/run.sh - env: - MODE: "test" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 9b97955110..caca66a2cd 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -17,48 +17,41 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - name: Checkout uses: actions/checkout@v4 + - name: Install Rust + uses: ./.github/actions/install-rust + with: + cache: false - name: Run static analysis tests run: cargo fmt --all --check docs: runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.21' - check-latest: true - cache: true + - name: Checkout + uses: actions/checkout@v4 + - name: Install Go + uses: ./.github/actions/install-go - name: Install Rust - uses: dtolnay/rust-toolchain@stable + uses: ./.github/actions/install-rust with: targets: wasm32-unknown-unknown - - name: Checkout - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 + cache: false - name: Run doc tests run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --document-private-items --all clippy: runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.21' - check-latest: true - cache: true + - name: Checkout + uses: actions/checkout@v4 + - name: Install Go + uses: ./.github/actions/install-go - name: Install Rust - uses: dtolnay/rust-toolchain@stable + uses: ./.github/actions/install-rust with: targets: wasm32-unknown-unknown - - name: Checkout - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - name: Run static analysis tests shell: bash run: cargo clippy --all --all-features --tests --benches --examples -- -D warnings @@ -66,18 +59,13 @@ jobs: unit-tests: runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.21' - check-latest: true - cache: true + - name: Checkout + uses: actions/checkout@v4 + - name: Install Go + uses: ./.github/actions/install-go - name: Install Rust - uses: dtolnay/rust-toolchain@stable + uses: ./.github/actions/install-rust with: targets: wasm32-unknown-unknown - - name: Checkout - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - name: Run unit tests run: cargo test --all-features --all diff --git a/.github/workflows/tidy-checker.yml b/.github/workflows/tidy-checker.yml deleted file mode 100644 index 8f7c00e337..0000000000 --- a/.github/workflows/tidy-checker.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: go.mod Checker -on: - push: - branches: - - main - pull_request: - -jobs: - go_mod_tidy: - name: Tidy - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - - shell: bash - run: go mod tidy - - shell: bash - working-directory: ./examples/morpheusvm - run: go mod tidy - - shell: bash - working-directory: ./examples/tokenvm - run: go mod tidy - - shell: bash - run: scripts/tests.clean.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/tokenvm-load-tests.yml b/.github/workflows/tokenvm-load-tests.yml deleted file mode 100644 index ddad04e67f..0000000000 --- a/.github/workflows/tokenvm-load-tests.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: TokenVM Load Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - tokenvm-load-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - strategy: - matrix: - level: [v1, v2, v3] # v4 is not supported - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - name: Run load tests - working-directory: ./examples/tokenvm - shell: bash - run: GOAMD64=${{ matrix.level }} scripts/tests.load.sh -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/tokenvm-release.yml b/.github/workflows/tokenvm-release.yml deleted file mode 100644 index d3ad118e91..0000000000 --- a/.github/workflows/tokenvm-release.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: TokenVM Release - -on: - push: - branches: - - main - tags: - - "*" - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - token-wallet-release: - runs-on: macos-latest-xl - if: ${{ github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - name: Build wallet - working-directory: ./examples/tokenvm/cmd/token-wallet - shell: bash - run: scripts/build.sh - env: - PUBLISH: false - - name: Archive Builds - uses: actions/upload-artifact@v4 - with: - name: token-wallet - path: ./examples/tokenvm/cmd/token-wallet/token-wallet.zip - - tokenvm-release: - # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 - runs-on: ubuntu-20.04-32 - if: ${{ github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - steps: - - name: Git checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - 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@v2 - 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 - cd osxcross - wget https://github.com/joseluisq/macosx-sdks/releases/download/12.3/$MACOS_SDK_FNAME -O tarballs/$MACOS_SDK_FNAME - echo $MACOS_SDK_CHECKSUM tarballs/$MACOS_SDK_FNAME | sha256sum -c - - UNATTENDED=1 ./build.sh - echo $PWD/target/bin >> $GITHUB_PATH - env: - MACOS_SDK_FNAME: MacOSX12.3.sdk.tar.xz - MACOS_SDK_CHECKSUM: 3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release - workdir: ./examples/tokenvm/ - env: - # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/tokenvm-static-analysis.yml b/.github/workflows/tokenvm-static-analysis.yml deleted file mode 100644 index d4086c7811..0000000000 --- a/.github/workflows/tokenvm-static-analysis.yml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: TokenVM Static Analysis - -on: - push: - branches: - - main - pull_request: - -jobs: - tokenvm-lint: - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - name: Run static analysis tests - working-directory: ./examples/tokenvm - shell: bash - run: scripts/tests.lint.sh - - name: Build vm, cli, faucet, feed - working-directory: ./examples/tokenvm - shell: bash - run: scripts/build.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/tokenvm-sync-tests.yml b/.github/workflows/tokenvm-sync-tests.yml deleted file mode 100644 index 8fc1bbdae9..0000000000 --- a/.github/workflows/tokenvm-sync-tests.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: TokenVM Sync Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - tokenvm-sync-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 25 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - name: Run sync tests - working-directory: ./examples/tokenvm - shell: bash - run: scripts/run.sh - env: - MODE: "full-test" -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/tokenvm-unit-tests.yml b/.github/workflows/tokenvm-unit-tests.yml deleted file mode 100644 index 56fb2002c2..0000000000 --- a/.github/workflows/tokenvm-unit-tests.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. -# See the file LICENSE for licensing terms. - -name: TokenVM Unit Tests - -on: - push: - branches: - - main - pull_request: - types: [labeled,synchronize,reopened] - -jobs: - tokenvm-unit-tests: - if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'run all ci') }} - runs-on: - labels: ubuntu-20.04-32 - timeout-minutes: 10 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - check-latest: true - cache: true - cache-dependency-path: | - go.sum - examples/tokenvm/go.sum - - name: Run unit tests - working-directory: ./examples/tokenvm - shell: bash - run: scripts/tests.unit.sh - - name: Run integration tests - working-directory: ./examples/tokenvm - shell: bash - run: scripts/tests.integration.sh - - name: Archive code coverage results (text) - uses: actions/upload-artifact@v4 - with: - name: code-coverage-out - path: ./examples/tokenvm/integration.coverage.out - - name: Archive code coverage results (html) - uses: actions/upload-artifact@v4 - with: - name: code-coverage-html - path: ./examples/tokenvm/integration.coverage.html - - name: Run e2e tests - working-directory: ./examples/tokenvm - shell: bash - run: scripts/run.sh - env: - MODE: "test" - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true diff --git a/.github/workflows/vm-release.yml b/.github/workflows/vm-release.yml new file mode 100644 index 0000000000..8b2a0d19b0 --- /dev/null +++ b/.github/workflows/vm-release.yml @@ -0,0 +1,43 @@ +# Copyright (C) 2023, Ava Labs, Inc. All rights reserved. +# See the file LICENSE for licensing terms. + +name: TokenVM Release + +on: + push: + tags: + - '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + token-wallet-release: + runs-on: macos-latest-xl + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/token-wallet-release + + tokenvm-release: + # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 + runs-on: ubuntu-20.04-32 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/vm-release + with: + vm-name: tokenvm + github-token: ${{ secrets.GITHUB_TOKEN }} + + morpheusvm-release: + # We build with 20.04 to maintain max compatibility: https://github.com/golang/go/issues/57328 + runs-on: ubuntu-20.04-32 + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: ./.github/actions/vm-release + with: + vm-name: morpheusvm + github-token: ${{ secrets.GITHUB_TOKEN }}