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

Set go version with shareable workflow. #182

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .github/workflows/go-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Get Go version
on:
workflow_call:
outputs:
go_version:
description: Currently supported Go version
value: ${{ jobs.provide_go_version.outputs.go_version }}

jobs:
provide_go_version:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.22
outputs:
go_version: ${{ steps.get.outputs.version }}
steps:
- name: Get Go version
id: get
run: echo "version=$GO_VERSION" >> $GITHUB_OUTPUT
1 change: 1 addition & 0 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- "samples/**"
- "**_test.go"
- "**.md"
- ".github/**"
types: [opened, edited]
jobs:
checkPullRequest:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Build and Run Tests
on: [pull_request]
jobs:
go-version:
uses: ./.github/workflows/go-version.yml

build:
name: Code generation & compile
needs: go-version
strategy:
fail-fast: false
matrix:
Expand All @@ -14,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ vars.GO_VERSION }}
go-version: ${{ needs.go-version.outputs.go_version }}

- name: Generate protos and build project
run: make generate-protos-and-build
Expand All @@ -34,6 +38,8 @@ jobs:
uses: ./.github/workflows/tests.yml
with:
esdb_version: ${{ matrix.version }}
go_version: ${{ needs.go-version.outputs.go_version }}


linting:
needs: tests
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ on:
type: string

jobs:
go-version:
uses: ./.github/workflows/go-version.yml

test:
needs: go-version
name: Test
uses: ./.github/workflows/tests.yml
with:
esdb_version: ${{ inputs.version }}
go_version: ${{ needs.go-version.outputs.go_version }}
10 changes: 7 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
required: true
type: string

go_version:
required: true
type: string

jobs:
single_node:
name: Single node
Expand All @@ -21,7 +25,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ vars.GO_VERSION }}
go-version: ${{ inputs.go_version }}

- name: Generate certificates
run: docker-compose --file docker-compose.yml up
Expand All @@ -45,7 +49,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ vars.GO_VERSION }}
go-version: ${{ inputs.go_version }}

- name: Generate certificates
run: docker-compose --file docker-compose.yml up
Expand All @@ -70,7 +74,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ vars.GO_VERSION }}
go-version: ${{ inputs.go_version }}

- name: Set up cluster with Docker Compose
run: |
Expand Down