From 3933a9d2cbda474e22dea22997eefd38f413b40a Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Wed, 5 Jun 2024 14:56:46 +0300 Subject: [PATCH 1/5] Composite setup go action --- .github/actions/setup-go.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/actions/setup-go.yml diff --git a/.github/actions/setup-go.yml b/.github/actions/setup-go.yml new file mode 100644 index 000000000..779b4804a --- /dev/null +++ b/.github/actions/setup-go.yml @@ -0,0 +1,9 @@ +name: Setup go + +runs: + using: 'composite' + steps: + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '1.22.4' From 5be3d8badaf45dcb3bc4638f7cb16dae26400737 Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Wed, 5 Jun 2024 14:57:10 +0300 Subject: [PATCH 2/5] Change pre-commit.yml to use composite action --- .github/workflows/pre-commit.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9e37fcb96..07144819e 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,9 +14,7 @@ jobs: with: fetch-depth: 0 # Disable shallow checkout - uses: actions/setup-python@v2 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go.yml - uses: pre-commit/action@v2.0.3 - name: notify failure From 5b76f982edd49afa69a52a435d7bd742be14a2d6 Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Wed, 5 Jun 2024 15:02:00 +0300 Subject: [PATCH 3/5] Rename setup-go.yml to action.yml --- .github/actions/{setup-go.yml => setup-go/action.yml} | 0 .github/workflows/pre-commit.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/{setup-go.yml => setup-go/action.yml} (100%) diff --git a/.github/actions/setup-go.yml b/.github/actions/setup-go/action.yml similarity index 100% rename from .github/actions/setup-go.yml rename to .github/actions/setup-go/action.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 07144819e..29bdb0cb3 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,7 +14,7 @@ jobs: with: fetch-depth: 0 # Disable shallow checkout - uses: actions/setup-python@v2 - - uses: ./.github/actions/setup-go.yml + - uses: ./.github/actions/setup-go - uses: pre-commit/action@v2.0.3 - name: notify failure From ab3882b99d17887ed50dbb995c8f36b40688b248 Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Wed, 5 Jun 2024 15:07:31 +0300 Subject: [PATCH 4/5] Change all other workflows to use composite action --- .github/workflows/golangci-lint.yml | 4 +--- .github/workflows/govulncheck.yml | 4 +--- .github/workflows/nightly-tests.yml | 8 ++------ .github/workflows/release.yml | 4 +--- .github/workflows/test.yml | 12 +++--------- .github/workflows/verify-pr.yml | 4 +--- 6 files changed, 9 insertions(+), 27 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1de8a6687..c893efaff 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -14,9 +14,7 @@ jobs: runs-on: charon-ci steps: # Config options can be found in README here: https://github.com/golangci/golangci-lint-action - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml index 0341c4572..d7e2cbcb1 100644 --- a/.github/workflows/govulncheck.yml +++ b/.github/workflows/govulncheck.yml @@ -12,8 +12,6 @@ jobs: security-events: write steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.0 - run: govulncheck -show=traces -test ./... diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml index 182ead852..d96706978 100644 --- a/.github/workflows/nightly-tests.yml +++ b/.github/workflows/nightly-tests.yml @@ -9,9 +9,7 @@ jobs: runs-on: charon-ci steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/cache@v3 with: path: | @@ -32,9 +30,7 @@ jobs: - uses: docker/setup-buildx-action@v2 # For compose to build images with: driver-opts: "image=moby/buildkit:v0.10.5" # avoid unknown/unknown arch in ghcr - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/cache@v3 with: path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6cb73ca3..8c4a36c4f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,9 +13,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Disable shallow checkout - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - run: go run . --help > cli-reference.txt - run: go run testutil/genchangelog/main.go - uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76056b09b..3e8234a34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,9 +9,7 @@ jobs: runs-on: charon-ci steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/cache@v3 with: path: | @@ -34,9 +32,7 @@ jobs: - unit_tests steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/cache@v3 with: path: | @@ -61,9 +57,7 @@ jobs: - uses: docker/setup-buildx-action@v2 # For compose to build images with: driver-opts: "image=moby/buildkit:v0.10.5" # avoid unknown/unknown arch in ghcr - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - uses: actions/cache@v3 with: path: | diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index d3b75de10..ed29e8291 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -10,9 +10,7 @@ jobs: GITHUB_PR: ${{ toJSON(github.event.pull_request) }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 - with: - go-version: '1.22.4' + - uses: ./.github/actions/setup-go - name: "Verify PR" run: go run github.com/obolnetwork/charon/testutil/verifypr From b61e9ab3363db5ec9e2de0b5a540d2a264ebd44e Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Wed, 5 Jun 2024 15:11:01 +0300 Subject: [PATCH 5/5] Use actions/checkout before other actions in golangci-lint workflow --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c893efaff..d97ae1ce9 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -14,8 +14,8 @@ jobs: runs-on: charon-ci steps: # Config options can be found in README here: https://github.com/golangci/golangci-lint-action - - uses: ./.github/actions/setup-go - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-go - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: