Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ci) update github actions ci to use a single GO_VERSION variable #2806

Merged
merged 6 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -23,6 +22,21 @@ 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:
if: ${{ github.actor != 'dependabot[bot]' }}
ramin marked this conversation as resolved.
Show resolved Hide resolved
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/reusable_dockerfile_lint.yml@v0.2.3 # yamllint disable-line rule:line-length
Expand All @@ -48,7 +62,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
Expand Down Expand Up @@ -86,7 +103,8 @@ jobs:
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: 1.21
go-version: ${{ needs.setup.outputs.go-version }}

# Generate the binaries and release
- uses: goreleaser/goreleaser-action@v5
with:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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/golangci-lint-action@v3.7.0
Expand All @@ -36,7 +38,7 @@ jobs:

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
go-version: ${{ inputs.go-version }}

- run: go mod tidy

Expand All @@ -53,7 +55,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
Expand All @@ -74,7 +76,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
Expand All @@ -89,7 +91,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
Expand Down
Loading