diff --git a/.github/workflows/cd-internal-testnet-manual.yml b/.github/workflows2/cd-internal-testnet-manual.yml similarity index 100% rename from .github/workflows/cd-internal-testnet-manual.yml rename to .github/workflows2/cd-internal-testnet-manual.yml diff --git a/.github/workflows/cd-internal-testnet.yml b/.github/workflows2/cd-internal-testnet.yml similarity index 100% rename from .github/workflows/cd-internal-testnet.yml rename to .github/workflows2/cd-internal-testnet.yml diff --git a/.github/workflows/cd-protonet-manual.yml b/.github/workflows2/cd-protonet-manual.yml similarity index 100% rename from .github/workflows/cd-protonet-manual.yml rename to .github/workflows2/cd-protonet-manual.yml diff --git a/.github/workflows/cd-protonet.yml b/.github/workflows2/cd-protonet.yml similarity index 100% rename from .github/workflows/cd-protonet.yml rename to .github/workflows2/cd-protonet.yml diff --git a/.github/workflows/cd-reset-internal-testnet.yml b/.github/workflows2/cd-reset-internal-testnet.yml similarity index 100% rename from .github/workflows/cd-reset-internal-testnet.yml rename to .github/workflows2/cd-reset-internal-testnet.yml diff --git a/.github/workflows/cd-seed-chain.yml b/.github/workflows2/cd-seed-chain.yml similarity index 100% rename from .github/workflows/cd-seed-chain.yml rename to .github/workflows2/cd-seed-chain.yml diff --git a/.github/workflows/cd-start-chain.yml b/.github/workflows2/cd-start-chain.yml similarity index 100% rename from .github/workflows/cd-start-chain.yml rename to .github/workflows2/cd-start-chain.yml diff --git a/.github/workflows/ci-commit.yml b/.github/workflows2/ci-commit.yml similarity index 100% rename from .github/workflows/ci-commit.yml rename to .github/workflows2/ci-commit.yml diff --git a/.github/workflows/ci-default.yml b/.github/workflows2/ci-default.yml similarity index 100% rename from .github/workflows/ci-default.yml rename to .github/workflows2/ci-default.yml diff --git a/.github/workflows/ci-docker.yml b/.github/workflows2/ci-docker.yml similarity index 100% rename from .github/workflows/ci-docker.yml rename to .github/workflows2/ci-docker.yml diff --git a/.github/workflows/ci-lint.yml b/.github/workflows2/ci-lint.yml similarity index 100% rename from .github/workflows/ci-lint.yml rename to .github/workflows2/ci-lint.yml diff --git a/.github/workflows/ci-master.yml b/.github/workflows2/ci-master.yml similarity index 100% rename from .github/workflows/ci-master.yml rename to .github/workflows2/ci-master.yml diff --git a/.github/workflows/ci-pr.yml b/.github/workflows2/ci-pr.yml similarity index 100% rename from .github/workflows/ci-pr.yml rename to .github/workflows2/ci-pr.yml diff --git a/.github/workflows/ci-release.yml b/.github/workflows2/ci-release.yml similarity index 100% rename from .github/workflows/ci-release.yml rename to .github/workflows2/ci-release.yml diff --git a/.github/workflows/ci-rocksdb-build.yml b/.github/workflows2/ci-rocksdb-build.yml similarity index 100% rename from .github/workflows/ci-rocksdb-build.yml rename to .github/workflows2/ci-rocksdb-build.yml diff --git a/.github/workflows2/go.yml b/.github/workflows2/go.yml new file mode 100644 index 0000000000..b46c995bbf --- /dev/null +++ b/.github/workflows2/go.yml @@ -0,0 +1,88 @@ +name: Golang CI + +on: + merge_group: + pull_request: + branches: + - '*' +env: + GO_VERSION: '1.21' + +jobs: + changed_files: + name: Changed Files + runs-on: ubutnu-latest + outputs: + changed_files: ${{ steps.changed_files.outputs.all_changed_files }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Changed Files + id: changed_files + uses: ./.github/actions/changed_files + + golang-ci: + needs: + - changed_files + if: | + contains(needs.changed_files.outputs.changed_files, '.go') + name: golangci-lint + runs-on: + labels: 16-cores + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup_go + with: + cache: false + - name: Load Version + id: load-version + run: | + echo "GOLANGCI_VERSION=v$(cat .golangci-version)" + - name: golangci-ling + uses: golangci/golangci-lint-action@v6 + with: + version: $${{ steps.load-version.outputs.GOLANGCI_VERSION }} + args: --timeout 30m --verbose --allow-parallel-runners --max-same-issues 0 --max-issues-per-linter 0 + working-directory: ${{ github.workspace }} + + golang-test: + needs: + - changed_files + if: | + contains(needs.changed_files.outputs.changed_files, '.go') || + contains(needs.changed_files.outputs.changed_files, 'go.sum') || + ( + contains(needs.changed_files.outputs.changed_files, '.yml') || + contains(needs.changed_files.outputs.changed_files, '.yaml') + ) + && + ( + contains(needs.changed_files.outputs.changed_files, 'app') || + contains(needs.changed_files.outputs.changed_files, 'client') || + contains(needs.changed_files.outputs.changed_files, 'cmd') || + contains(needs.changed_files.outputs.changed_files, 'migrate') || + contains(needs.changed_files.outputs.changed_files, 'tests') || + contains(needs.changed_files.outputs.changed_files, 'x') + ) + name: go test + runs-on: + labels: 16-cores + env: + COVERAGE_DIR: out/coverage/unit/go + COVERAGE_PATH: out/coverage/unit/go/cover.out + FORMATTED_REPORT: out/coverage/unit/go/go-unit-cover.out + HTML_REPORT: out/coverage/unit/go/go-unit-cover.html + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup_go + - name: Go Test + run: | + mkdir -p ${{ env.COVERAGE_DIR }} + readarray -t test_dirs < <(find * -name "*_test.go" -exec dirname {} \; | sort | uniq | grep -v -e '^\.$') + half_nproc=$(( $(nproc --all) / 2 )) + printf '%s\0' "${test_dirs[@]}" | xargs -0 -P $half_nproc -n 1 -I {} go test "./{}" -race + diff --git a/.github/workflows/metric-pipeline.yml b/.github/workflows2/metric-pipeline.yml similarity index 100% rename from .github/workflows/metric-pipeline.yml rename to .github/workflows2/metric-pipeline.yml diff --git a/.github/workflows/proto.yml b/.github/workflows2/proto.yml similarity index 100% rename from .github/workflows/proto.yml rename to .github/workflows2/proto.yml