Skip to content

Commit

Permalink
feat: Introduce go-version file to support multiple go versions on CI (
Browse files Browse the repository at this point in the history
  • Loading branch information
toninis committed Nov 3, 2023
1 parent e3ba578 commit d3dae4d
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 24 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/mmctl-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:
logsartifact:
required: true
type: string
env:
go-version: "1.20.7"

jobs:
test:
name: ${{ inputs.name }}
Expand All @@ -26,16 +25,20 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
working-directory: ./server
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: server/go.sum
- name: Run setup-go-work
run: |
cd server
make setup-go-work
- name: Setup needed prepackaged plugins
- name: Setup needed prepackaged plugins
run: |
cd server
make prepackaged-plugins PLUGIN_PACKAGES=mattermost-plugin-jira-v3.2.5
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/server-ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
- cloud
- release-*
- mono-repo*
env:
go-version: "1.20.7"

jobs:
master-ci:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/server-ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
- "server/**"
- "e2e-tests/**"
- ".github/**"
env:
go-version: "1.20.7"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
50 changes: 37 additions & 13 deletions .github/workflows/server-ci-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ name: Server CI Template
on:
workflow_call:

env:
go-version: "1.20.7"

jobs:
check-mocks:
name: Check mocks
Expand All @@ -18,10 +15,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -40,10 +40,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -62,10 +65,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -82,10 +88,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -104,10 +113,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand Down Expand Up @@ -156,10 +168,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -178,10 +193,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -200,10 +218,13 @@ jobs:
steps:
- name: Checkout mattermost-server
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand Down Expand Up @@ -264,10 +285,13 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: |
server/go.sum
server/public/go.sum
Expand All @@ -277,7 +301,7 @@ jobs:
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
cache-dependency-path: "webapp/package-lock.json"
- name: Run setup-go-work
run: make setup-go-work
- name: Build
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/server-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:
logsartifact:
required: true
type: string
env:
go-version: "1.20.7"

jobs:
test:
name: ${{ inputs.name }}
Expand All @@ -26,10 +25,14 @@ jobs:
steps:
- name: Checkout mattermost project
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Calculate Golang Version
id: go
working-directory: ./server
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ env.go-version }}
go-version: ${{ steps.go.outputs.GO_VERSION }}
cache-dependency-path: server/go.sum
- name: Run docker compose
run: |
Expand Down
1 change: 1 addition & 0 deletions server/.go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.20.7

0 comments on commit d3dae4d

Please sign in to comment.