Skip to content

Commit

Permalink
upgrade to go1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
greenpau committed Sep 5, 2023
1 parent d30d6bf commit a117ac3
Show file tree
Hide file tree
Showing 6 changed files with 445 additions and 225 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release

on:
workflow_dispatch: {}
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v3
with:
go-version: '>=1.20.7'
cache: true
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: /home/runner/go
45 changes: 23 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: build

on:
workflow_dispatch: {}
push:
branches:
- main
Expand All @@ -13,24 +14,26 @@ jobs:
core:
strategy:
matrix:
go-version: [1.13.x, 1.14.x]
go-version: [1.20.x]
platform: [ubuntu-latest]
name: Build
runs-on: ${{ matrix.platform }}
env:
GOBIN: /home/runner/.local/bin
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Setup Environment
uses: actions/checkout@v3
- name: Amend Environment Path
run: |
mkdir -p /home/runner/.local/bin
echo "::add-path::/home/runner/.local/bin"
echo "/home/runner/.local/bin" >> $GITHUB_PATH
- name: Setup Environment
run: |
mkdir -p .coverage
echo "*** Current Directory ***"
pwd
Expand All @@ -44,33 +47,31 @@ jobs:
- name: Install prerequisites
run: |
sudo apt-get --assume-yes install make
sudo apt-get --assume-yes install libnss3-tools
sudo apt-get install openvswitch-switch
sudo apt-get update
- name: Install Go modules
run: |
go install golang.org/x/lint/golint
go install golang.org/x/tools/cmd/godoc
make dep
- name: Open vSwitch Checks
run: |
sudo ovs-vsctl --version
sudo ovs-vsctl show
sudo systemctl status openvswitch-switch.service
sudo ovs-vsctl add-br br0
sudo ovs-vsctl list bridge
sudo ps -ef
- name: Validate prerequisites
run: |
echo "*** Local binaries ***"
find /home/runner/.local/bin
- name: Run lint tests
- name: Run tests
run: |
golint cmd/client/*.go
golint pkg/client/*.go
- name: Run Go tests
run: go test -v -coverprofile=.coverage/coverage.out ./pkg/client/*.go
make test
- name: Generate coverage report
run: make coverage
- name: Upload coverage report
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: Test Coverage Report
path: .coverage/coverage.html
- name: Build binary
run: make
- name: Test binary
run: bin/go-redfish-api-idrac-client --version
#- name: Upload binary
# uses: actions/upload-artifact@v1
# with:
# name: go-redfish-api-idrac-client
# path: bin/go-redfish-api-idrac-client
37 changes: 37 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
ldflags:
- -w -s
-X main.appName=go-redfish-api-idrac-client \
-X main.appVersion={{ .Version }} \
-X main.gitCommit={{ .Commit }} \
-X main.gitBranch={{ .Branch }} \
-X main.BuildUser=greenpau \
-X main.BuildDate={{ .Date }} \
-gcflags="all=-trimpath=$(GOPATH)/src" \
-asmflags="all=-trimpath $(GOPATH)/src" cmd/$(APP)/*
main: './cmd/go-redfish-api-idrac-client'
asmflags:
- 'all=-trimpath={{.Env.GOPATH}}'
gcflags:
- 'all=-trimpath={{.Env.GOPATH}}'
binary: go-redfish-api-idrac-client
archives:
- name_template: "go-redfish-api-idrac-client_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Version }}"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ qtest:

dep:
@echo "Making dependencies check ..."
@go get -u golang.org/x/lint/golint
@go get -u golang.org/x/tools/cmd/godoc
@go get -u github.com/kyoh86/richgo
@go install golang.org/x/lint/golint@latest
@go install github.com/kyoh86/richgo@latest
@go install github.com/greenpau/versioned/cmd/versioned@latest

release:
@echo "Making release"
Expand Down
34 changes: 20 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
module github.com/greenpau/go-redfish-api-idrac

go 1.14
go 1.20

require (
github.com/davecgh/go-spew v1.1.1
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/greenpau/versioned v1.0.23
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
github.com/magiconair/properties v1.8.4 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/sirupsen/logrus v1.6.0
github.com/spf13/afero v1.4.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/greenpau/versioned v1.0.28
github.com/iancoleman/strcase v0.3.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.16.0
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.1
golang.org/x/sys v0.0.0-20200922070232-aee5d888a860 // indirect
gopkg.in/ini.v1 v1.61.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit a117ac3

Please sign in to comment.