forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(ci) update github actions ci to use a single GO_VERSION variable (ce…
…lestiaorg#2806) This sets a single variable (`GO_VERSION`) in the main `ci.yml` workflow, which will be the single place we set the current go version. We then run a `setup` job that sets an required output for subsequent jobs to use, adding: ``` with: go-version: ${{ needs.setup.outputs.go-version }} ``` Where we had previously either: 1) duplicated the GO_VERSION env var in that workflow 2) passed in `1.21` or whatever go version explicitly When the rpc openrpc.json workflow check changes are merged, this will also prevent another duplication of the go version appearing. refs celestiaorg#2698
- Loading branch information
Showing
2 changed files
with
28 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ on: | |
- "v*" | ||
pull_request: | ||
workflow_dispatch: | ||
# Inputs the workflow accepts. | ||
inputs: | ||
version: | ||
# Friendly description to be shown in the UI instead of 'name' | ||
|
@@ -23,6 +22,20 @@ on: | |
- major | ||
|
||
jobs: | ||
# set up go version for use through pipelines, setting | ||
# variable one time and setting outputs to access passing it | ||
# to other jobs | ||
setup: | ||
runs-on: ubuntu-latest | ||
env: | ||
# upgrade go version throughout pipeline here | ||
GO_VERSION: "1.21" | ||
outputs: | ||
go-version: ${{ steps.set-vars.outputs.go-version }} | ||
steps: | ||
- id: set-vars | ||
run: echo "go-version=${{env.GO_VERSION}}" >> "$GITHUB_OUTPUT" | ||
|
||
# Dockerfile Linting | ||
hadolint: | ||
uses: celestiaorg/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length | ||
|
@@ -48,7 +61,10 @@ jobs: | |
markdownlint --config .markdownlint.yaml '**/*.md' | ||
go-ci: | ||
needs: setup | ||
uses: ./.github/workflows/go-ci.yml | ||
with: | ||
go-version: ${{ needs.setup.outputs.go-version }} | ||
|
||
# If this was a workflow dispatch event, we need to generate and push a tag | ||
# for goreleaser to grab | ||
|
@@ -86,7 +102,7 @@ jobs: | |
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21 | ||
go-version: ${{ needs.setup.outputs.go-version }} | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v4 | ||
|
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 |
---|---|---|
|
@@ -2,9 +2,11 @@ name: Go CI | |
|
||
on: | ||
workflow_call: | ||
|
||
env: | ||
GO_VERSION: '1.21' | ||
inputs: | ||
go-version: | ||
description: 'Go version' | ||
required: true | ||
type: string | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
|
@@ -20,7 +22,7 @@ jobs: | |
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
|
@@ -38,7 +40,7 @@ jobs: | |
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- run: go mod tidy | ||
|
||
|
@@ -61,7 +63,7 @@ jobs: | |
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: run unit tests | ||
run: make test-unit | ||
|
@@ -85,7 +87,7 @@ jobs: | |
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: execute test run | ||
run: make test-unit-race | ||
|
@@ -101,7 +103,7 @@ jobs: | |
- name: set up go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
go-version: ${{ inputs.go-version }} | ||
|
||
- name: Swamp Tests | ||
run: make test-swamp | ||
|