Skip to content

Commit 62c022c

Browse files
authored
Upgrade dependencies, Go 1.19 and CI (#21)
* upgrade dependencies * update Go and CI
1 parent c28966e commit 62c022c

7 files changed

Lines changed: 884 additions & 183 deletions

File tree

.github/workflows/pr.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@ jobs:
55
name: Build
66
runs-on: ubuntu-latest
77
steps:
8-
- name: Set up Go 1.15
9-
uses: actions/setup-go@v1
8+
- name: Checkout
9+
uses: actions/checkout@v2
1010
with:
11-
go-version: 1.15
12-
id: go
11+
fetch-depth: 0
1312

14-
- name: Check out code into the Go module directory
15-
uses: actions/checkout@v1
13+
- name: Set up Go
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.19
17+
18+
- name: Run Golang CI Lint
19+
uses: golangci/golangci-lint-action@v2
1620

1721
- name: Build
1822
run: CGO_ENABLED=0 go build -ldflags="-w -s" -o gogci
1923

20-
- name: Setup Lint
21-
run: curl -LO https://github.com/golangci/golangci-lint/releases/download/v1.23.6/golangci-lint-1.23.6-linux-amd64.tar.gz && tar -xf golangci-lint-1.23.6-linux-amd64.tar.gz
22-
23-
- name: Lint
24-
run: golangci-lint-1.23.6-linux-amd64/golangci-lint run
25-
2624
- name: Upload artifact
2725
uses: actions/upload-artifact@v1
2826
with:

.github/workflows/tag.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,26 @@ jobs:
99
name: Build
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Set up Go 1.15
13-
uses: actions/setup-go@v1
12+
- name: Checkout
13+
uses: actions/checkout@v2
1414
with:
15-
go-version: 1.15
16-
id: go
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: 1.19
21+
22+
- name: Run Golang CI Lint
23+
uses: golangci/golangci-lint-action@v2
1724

1825
- name: Get the version
1926
id: get_version
2027
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
2128

22-
- name: Check out code into the Go module directory
23-
uses: actions/checkout@v1
24-
2529
- name: Build
2630
run: CGO_ENABLED=0 go build -ldflags="-w -s" -o gogci
2731

28-
- name: Setup Lint
29-
run: curl -LO https://github.com/golangci/golangci-lint/releases/download/v1.23.6/golangci-lint-1.23.6-linux-amd64.tar.gz && tar -xf golangci-lint-1.23.6-linux-amd64.tar.gz
30-
31-
- name: Lint
32-
run: golangci-lint-1.23.6-linux-amd64/golangci-lint run
33-
3432
- name: Setup UPX
3533
run: curl -LO https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz && tar -xf upx-3.96-amd64_linux.tar.xz
3634

gitlab/approval.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import (
1212
func (c *Client) CheckMergeRequestApproved() (bool, error) {
1313

1414
// Init gitlab client
15-
git := gitlab.NewClient(nil, c.Token)
16-
err := git.SetBaseURL(c.URL)
15+
git, err := gitlab.NewClient(c.Token, gitlab.WithBaseURL(c.URL))
1716
if err != nil {
18-
return false, fmt.Errorf("failed to set Gitlab client URL: %w", err)
17+
return false, fmt.Errorf("failed to init Gitlab client: %w", err)
1918
}
2019

2120
// Get project and merge request IDs from Gitlab CI env vars

gitlab/mr.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import (
1212
func (c *Client) CheckOldestMergeRequest() (bool, error) {
1313

1414
// Init gitlab client
15-
git := gitlab.NewClient(nil, c.Token)
16-
err := git.SetBaseURL(c.URL)
15+
git, err := gitlab.NewClient(c.Token, gitlab.WithBaseURL(c.URL))
1716
if err != nil {
18-
return false, fmt.Errorf("failed to set gitlab client base url: %w", err)
17+
return false, fmt.Errorf("failed to init Gitlab client: %w", err)
1918
}
2019

2120
// Get project and merge request IDs from Gitlab CI env vars

gitlab/notify.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import (
1616
func (c *Client) CreateMergeRequestNote(tmpl string, data interface{}) error {
1717

1818
// Init gitlab client
19-
git := gitlab.NewClient(nil, c.Token)
20-
err := git.SetBaseURL(c.URL)
19+
git, err := gitlab.NewClient(c.Token, gitlab.WithBaseURL(c.URL))
2120
if err != nil {
22-
return fmt.Errorf("failed to set gitlab client base url: %w", err)
21+
return fmt.Errorf("failed to init gitlab client: %w", err)
2322
}
2423

2524
// Init template

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/Ouest-France/gogci
33
go 1.14
44

55
require (
6-
github.com/Masterminds/sprig/v3 v3.1.0
6+
github.com/Masterminds/sprig/v3 v3.2.2
77
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
8-
github.com/fatih/color v1.9.0
9-
github.com/hashicorp/vault/api v1.0.4
8+
github.com/fatih/color v1.13.0
9+
github.com/hashicorp/vault/api v1.7.2
1010
github.com/mitchellh/go-homedir v1.1.0
11-
github.com/spf13/cobra v0.0.6
12-
github.com/spf13/viper v1.6.2
13-
github.com/xanzy/go-gitlab v0.28.0
14-
gopkg.in/ini.v1 v1.54.0
11+
github.com/spf13/cobra v1.5.0
12+
github.com/spf13/viper v1.12.0
13+
github.com/xanzy/go-gitlab v0.70.0
14+
gopkg.in/ini.v1 v1.66.6
1515
)

0 commit comments

Comments
 (0)