From 8b80aa59f213babe515fe4e1f52c7ac7376a4b76 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Wed, 17 Jan 2024 21:57:25 +0100 Subject: [PATCH] Enable coreth github workflows --- .github/workflows/ci.coreth.yml | 103 +++++++++++++ .../workflows/{ci.yml => ci.subnet-evm.yml} | 18 ++- coreth/.github/CODEOWNERS | 9 -- coreth/.github/CONTRIBUTING.md | 35 ----- coreth/.github/ISSUE_TEMPLATE/bug_report.md | 34 ----- .../.github/ISSUE_TEMPLATE/feature_request.md | 20 --- coreth/.github/dependabot.yml | 11 -- coreth/.github/pull_request_template.md | 5 - coreth/.github/workflows/ci.yml | 142 ------------------ coreth/.github/workflows/codeql-analysis.yml | 71 --------- coreth/scripts/constants.sh | 2 +- 11 files changed, 115 insertions(+), 335 deletions(-) create mode 100644 .github/workflows/ci.coreth.yml rename .github/workflows/{ci.yml => ci.subnet-evm.yml} (93%) delete mode 100644 coreth/.github/CODEOWNERS delete mode 100644 coreth/.github/CONTRIBUTING.md delete mode 100644 coreth/.github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 coreth/.github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 coreth/.github/dependabot.yml delete mode 100644 coreth/.github/pull_request_template.md delete mode 100644 coreth/.github/workflows/ci.yml delete mode 100644 coreth/.github/workflows/codeql-analysis.yml diff --git a/.github/workflows/ci.coreth.yml b/.github/workflows/ci.coreth.yml new file mode 100644 index 0000000000..32fc48b245 --- /dev/null +++ b/.github/workflows/ci.coreth.yml @@ -0,0 +1,103 @@ +name: coreth - CI +on: + push: + branches: + - master + paths: + - 'coreth/**' + pull_request: + paths: + - 'coreth/**' + +env: + go_version: '~1.20.12' + +jobs: + lint: + name: coreth - Lint + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: ./coreth + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.go_version }} + check-latest: true + - run: ./scripts/lint_allowed_geth_imports.sh + shell: bash + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + working-directory: ./coreth + args: --timeout 3m + test: + name: coreth - Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-11.0, ubuntu-20.04, windows-latest] + defaults: + run: + working-directory: ./coreth + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.go_version }} + check-latest: true + - run: go mod download + shell: bash + - run: ./scripts/build.sh evm + shell: bash + - run: ./scripts/build_test.sh + shell: bash + - run: ./coreth/scripts/coverage.sh + shell: bash + test-race: + name: coreth - Golang Unit Tests Race Detection v${{ matrix.go }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + defaults: + run: + working-directory: ./coreth + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.go_version }} + check-latest: true + - run: go mod download + shell: bash + - run: ./scripts/build.sh evm + shell: bash + - run: ./scripts/build_test.sh -race + shell: bash + avalanchego_e2e: + name: coreth - AvalancheGo E2E Tests v${{ matrix.go }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-20.04 ] + defaults: + run: + working-directory: ./coreth + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ${{ env.go_version }} + check-latest: true + - name: Run e2e tests + run: E2E_SERIAL=1 ./scripts/tests.e2e.sh + shell: bash + - name: Upload testnet network dir + uses: actions/upload-artifact@v3 + if: always() + with: + name: testnet-data + path: ~/.testnetctl/networks/1000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.subnet-evm.yml similarity index 93% rename from .github/workflows/ci.yml rename to .github/workflows/ci.subnet-evm.yml index c437de2bde..d7476b8b89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.subnet-evm.yml @@ -1,4 +1,4 @@ -name: Build + Test + Lint +name: subnet-evm - Build + Test + Lint on: push: @@ -6,11 +6,15 @@ on: - master tags: - 'v[0-9]+.[0-9]+.[0-9]+' + paths-ignore: + - 'coreth/**' pull_request: + paths-ignore: + - 'coreth/**' jobs: lint_test: - name: Lint + name: subnet-evm - Lint runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -28,7 +32,7 @@ jobs: args: --timeout 10m unit_test: - name: Golang Unit Tests + name: subnet-evm - Golang Unit Tests runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -46,7 +50,7 @@ jobs: shell: bash e2e_precompile: - name: e2e precompile tests + name: subnet-evm - e2e precompile tests runs-on: ubuntu-latest steps: - name: Git checkout @@ -88,7 +92,7 @@ jobs: path: /tmp/network-runner-root-data*/ retention-days: 5 e2e_warp: - name: e2e warp tests + name: subnet-evm - e2e warp tests runs-on: ubuntu-latest steps: - name: Git checkout @@ -130,7 +134,7 @@ jobs: path: /tmp/network-runner-root-data*/ retention-days: 5 e2e_load: - name: e2e load tests + name: subnet-evm - e2e load tests runs-on: ubuntu-latest steps: - name: Git checkout @@ -160,7 +164,7 @@ jobs: retention-days: 5 build_image: - name: Build Docker Image + name: subnet-evm - Build Docker Image runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 diff --git a/coreth/.github/CODEOWNERS b/coreth/.github/CODEOWNERS deleted file mode 100644 index 678f3d71e7..0000000000 --- a/coreth/.github/CODEOWNERS +++ /dev/null @@ -1,9 +0,0 @@ -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default code owners for everything in the repo. - -# Unless a later match takes precedence, these owners will be requested for - -# review whenever someone opens a pull request. - -* @aaronbuchwald @darioush @ceyonur diff --git a/coreth/.github/CONTRIBUTING.md b/coreth/.github/CONTRIBUTING.md deleted file mode 100644 index 87c79fcfe2..0000000000 --- a/coreth/.github/CONTRIBUTING.md +++ /dev/null @@ -1,35 +0,0 @@ -# Contributing - -Thank you for considering to help out with the source code! We welcome -contributions from anyone on the internet, and are grateful for even the -smallest of fixes! - -If you'd like to contribute to coreth, please fork, fix, commit and send a -pull request for the maintainers to review and merge into the main code base. If -you wish to submit more complex changes though, please check up with the core -devs first on [Discord](https://chat.avalabs.org) to -ensure those changes are in line with the general philosophy of the project -and/or get some early feedback which can make both your efforts much lighter as -well as our review and merge procedures quick and simple. - -## Coding guidelines - -Please make sure your contributions adhere to our coding guidelines: - - * Code must adhere to the official Go -[formatting](https://go.dev/doc/effective_go#formatting) guidelines -(i.e. uses [gofmt](https://pkg.go.dev/cmd/gofmt)). - * Code must be documented adhering to the official Go -[commentary](https://go.dev/doc/effective_go#commentary) guidelines. - * Pull requests need to be based on and opened against the `master` branch. - * Pull reuqests should include a detailed description - * Commits are required to be signed. See [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) - for information on signing commits. - * Commit messages should be prefixed with the package(s) they modify. - * E.g. "eth, rpc: make trace configs optional" - -## Can I have feature X - -Before you submit a feature request, please check and make sure that it isn't -possible through some other means. - diff --git a/coreth/.github/ISSUE_TEMPLATE/bug_report.md b/coreth/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 049810cd57..0000000000 --- a/coreth/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Logs** -If applicable, please include the relevant logs that indicate a problem and/or the log directory of your node. By default, this can be found at `~/.avalanchego/logs/`. - -**Metrics** -If applicable, please include any metrics gathered from your node to assist us in diagnosing the problem. - -**Operating System** -Which OS you used to reveal the bug. - -**Additional context** -Add any other context about the problem here. - -Avalanche Bug Bounty program can be found [here](https://hackenproof.com/avalanche/avalanche-protocol). diff --git a/coreth/.github/ISSUE_TEMPLATE/feature_request.md b/coreth/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d61..0000000000 --- a/coreth/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/coreth/.github/dependabot.yml b/coreth/.github/dependabot.yml deleted file mode 100644 index b444581e62..0000000000 --- a/coreth/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "gomod" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" diff --git a/coreth/.github/pull_request_template.md b/coreth/.github/pull_request_template.md deleted file mode 100644 index 8200c0597f..0000000000 --- a/coreth/.github/pull_request_template.md +++ /dev/null @@ -1,5 +0,0 @@ -## Why this should be merged - -## How this works - -## How this was tested diff --git a/coreth/.github/workflows/ci.yml b/coreth/.github/workflows/ci.yml deleted file mode 100644 index be551f627c..0000000000 --- a/coreth/.github/workflows/ci.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: CI -on: - push: - branches: - - master - pull_request: - workflow_dispatch: - inputs: - avalanchegoRepo: - description: 'avalanchego github repository' - required: true - default: 'ava-labs/avalanchego' - avalanchegoBranch: - description: 'avalanchego branch' - required: true - default: 'master' - -jobs: - lint: - name: Lint - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - - name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }} - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/checkout@v3 - with: - repository: ${{ github.event.inputs.avalanchegoRepo }} - ref: ${{ github.event.inputs.avalanchegoBranch }} - path: avalanchego - token: ${{ secrets.AVALANCHE_PAT }} - - uses: actions/setup-go@v3 - with: - go-version: '~1.20.12' - check-latest: true - - name: change avalanchego dep - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - go mod edit -replace github.com/ava-labs/avalanchego=./avalanchego - go mod tidy - go clean -modcache # avoid conflicts with the golangci-lint-action cache - - run: ./scripts/lint_allowed_geth_imports.sh - shell: bash - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 - working-directory: . - args: --timeout 3m - test: - name: Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-11.0, ubuntu-20.04, windows-latest] - steps: - - uses: actions/checkout@v3 - - name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }} - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/checkout@v3 - with: - repository: ${{ github.event.inputs.avalanchegoRepo }} - ref: ${{ github.event.inputs.avalanchegoBranch }} - path: avalanchego - token: ${{ secrets.AVALANCHE_PAT }} - - uses: actions/setup-go@v3 - with: - go-version: '~1.20.12' - check-latest: true - - name: change avalanchego dep - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - go mod edit -replace github.com/ava-labs/avalanchego=./avalanchego - go mod tidy - - run: go mod download - shell: bash - - run: ./scripts/build.sh evm - shell: bash - - run: ./scripts/build_test.sh - shell: bash - - run: ./scripts/coverage.sh - shell: bash - test-race: - name: Golang Unit Tests Race Detection v${{ matrix.go }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - steps: - - uses: actions/checkout@v3 - - name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }} - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/checkout@v3 - with: - repository: ${{ github.event.inputs.avalanchegoRepo }} - ref: ${{ github.event.inputs.avalanchegoBranch }} - path: avalanchego - token: ${{ secrets.AVALANCHE_PAT }} - - uses: actions/setup-go@v3 - with: - go-version: '~1.20.12' - check-latest: true - - name: change avalanchego dep - if: ${{ github.event_name == 'workflow_dispatch' }} - run: | - go mod edit -replace github.com/ava-labs/avalanchego=./avalanchego - go mod tidy - - run: go mod download - shell: bash - - run: ./scripts/build.sh evm - shell: bash - - run: ./scripts/build_test.sh -race - shell: bash - avalanchego_e2e: - name: AvalancheGo E2E Tests v${{ matrix.go }} (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-20.04 ] - steps: - - uses: actions/checkout@v3 - - name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }} - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/checkout@v3 - with: - repository: ${{ github.event.inputs.avalanchegoRepo }} - ref: ${{ github.event.inputs.avalanchegoBranch }} - path: avalanchego - token: ${{ secrets.AVALANCHE_PAT }} - - uses: actions/setup-go@v3 - with: - go-version: '~1.20.12' - check-latest: true - - name: Run e2e tests - run: E2E_SERIAL=1 ./scripts/tests.e2e.sh - shell: bash - - name: Upload testnet network dir - uses: actions/upload-artifact@v3 - if: always() - with: - name: testnet-data - path: ~/.testnetctl/networks/1000 diff --git a/coreth/.github/workflows/codeql-analysis.yml b/coreth/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 1442f1e03c..0000000000 --- a/coreth/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,71 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '44 11 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - 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. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # 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@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 - diff --git a/coreth/scripts/constants.sh b/coreth/scripts/constants.sh index 7eb87f37e1..3e30b4e6b8 100644 --- a/coreth/scripts/constants.sh +++ b/coreth/scripts/constants.sh @@ -17,7 +17,7 @@ echo "Using branch: ${current_branch}" # Use an abbreviated version of the full commit to tag the image. # WARNING: this will use the most recent commit even if there are un-committed changes present -coreth_commit="$(git --git-dir="$CORETH_PATH/.git" rev-parse HEAD)" +coreth_commit="$(git --git-dir="$CORETH_PATH/../.git" rev-parse HEAD)" coreth_commit_id="${coreth_commit::8}" build_image_id=${BUILD_IMAGE_ID:-"$avalanche_version-$coreth_commit_id"}