Skip to content

Commit

Permalink
fixed linter warnings
Browse files Browse the repository at this point in the history
- fixed caching workflow
  • Loading branch information
Phillip Miller committed Dec 29, 2021
1 parent 7124b9a commit c32060b
Showing 3 changed files with 83 additions and 50 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/codacy-coverage-reporter.yml
Original file line number Diff line number Diff line change
@@ -23,17 +23,24 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-codacy-coverage-reporter-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-codacy-coverage-reporter-${{ env.cache-name }}-
${{ runner.OS }}-codacy-coverage-reporter-
${{ runner.OS }}-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
@@ -60,7 +67,8 @@ jobs:
# Run Tests and Coverage
- name: Run Tests and Coverage
run: |
go test -v -coverprofile=coverage.out ./... | tee >(richgo testfilter) | go-junit-report > coverage/${{ runner.OS }}-report.xml
go test -v -coverprofile=coverage.out ./... | tee test.out
cat test.out | go-junit-report > coverage/${{ runner.OS }}-report.xml
gocov convert coverage.out | gocov-xml > coverage/${{ runner.OS }}-report.xml
- name: Run codacy-coverage-reporter
103 changes: 64 additions & 39 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -22,18 +22,24 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Install dependencies
run: go get github.com/mattn/[email protected]
@@ -58,18 +64,24 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
key: ${{ runner.os }}-test-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-test-${{ env.cache-name }}-
${{ runner.OS }}-test-
${{ runner.OS }}-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Install dependencies
run: go get github.com/mattn/[email protected]
@@ -104,18 +116,24 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
key: ${{ runner.os }}-run-pimp-my-shell-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-run-pimp-my-shell-${{ env.cache-name }}-
${{ runner.OS }}-run-pimp-my-shell-
${{ runner.OS }}-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Go Build
run: |
@@ -176,17 +194,24 @@ jobs:
with:
go-version: 1.17.x

- name: Cache Go modules
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-release-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.OS }}-release-${{ env.cache-name }}-
${{ runner.OS }}-release-
${{ runner.OS }}-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: Install dependencies
run: go get github.com/mattn/[email protected]
2 changes: 1 addition & 1 deletion githubapi/githubapi.go
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ type ReleaseAssets struct {
}

func getLatestReleasesFromGithubRepo(owner, repo string) (*ReleaseAssets, error) {
client := &github.Client{}
var client = &github.Client{}
ctx := context.Background()
githubToken, ok := os.LookupEnv("GITHUB_TOKEN")
if ok {

0 comments on commit c32060b

Please sign in to comment.