Skip to content

Commit

Permalink
chore: update CI
Browse files Browse the repository at this point in the history
* chore: update CI

* chore: update CI
  • Loading branch information
ldez authored Mar 6, 2024
1 parent 0a5b16c commit 9aa161f
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 68 deletions.
32 changes: 7 additions & 25 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
go-version: [ '1.21', '1.22' ]
go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

include:
Expand All @@ -29,36 +29,18 @@ jobs:
go-path-suffix: \go

steps:
# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
stable: true

# https://github.com/marketplace/actions/checkout
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: go/src/github.com/traefik/yaegi

# https://github.com/marketplace/actions/cache
- name: Cache Go modules
uses: actions/cache@v3
# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
go-version: ${{ matrix.go-version }}
stable: true

- name: Setup GOPATH
run: go env -w GOPATH=${{ github.workspace }}${{ matrix.go-path-suffix }}
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ on:
pull_request:

env:
GO_VERSION: '1.22'
GOLANGCI_LINT_VERSION: v1.55.2
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.56.2

jobs:

linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
go mod tidy
Expand All @@ -45,19 +45,19 @@ jobs:
needs: linting
strategy:
matrix:
go-version: [ '1.21', '1.22' ]
go-version: [ oldstable, stable ]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
stable: true

- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Check generated code
run: |
rm -f interp/op.go
Expand All @@ -76,21 +76,21 @@ jobs:
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi
strategy:
matrix:
go-version: [ '1.21', '1.22' ]
go-version: [ oldstable, stable ]

steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
stable: true

- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: go/src/github.com/traefik/yaegi
fetch-depth: 0

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
stable: true

# https://github.com/marketplace/actions/cache
- name: Cache Go modules
uses: actions/cache@v3
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v[0-9]+.[0-9]+*

env:
GO_VERSION: '1.21'
GO_VERSION: stable

jobs:

Expand All @@ -15,28 +15,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Go modules
uses: actions/cache@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version: ${{ env.GO_VERSION }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }}
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ linters:

issues:
exclude-use-default: false
max-per-linter: 0
max-issues-per-linter: 0
max-same-issues: 0
exclude: []
exclude:
- 'fmt.Sprintf can be replaced with string'
exclude-rules:
- path: .+_test\.go
linters:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ archives:
- LICENSE

brews:
- tap:
- repository:
owner: traefik
name: homebrew-tap
commit_author:
Expand Down
3 changes: 2 additions & 1 deletion cmd/yaegi/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bufio"
"bytes"
"errors"
"flag"
"fmt"
"io"
Expand Down Expand Up @@ -38,7 +39,7 @@ func extractCmd(arg []string) error {

args := eflag.Args()
if len(args) == 0 {
return fmt.Errorf("missing package")
return errors.New("missing package")
}

license, err := genLicense(licensePath)
Expand Down
2 changes: 1 addition & 1 deletion extract/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (e *Extractor) importPath(pkgIdent, importPath string) (string, error) {
return "", err
}
if err != nil {
if len(pkgIdent) > 0 && pkgIdent[0] == '.' {
if pkgIdent != "" && pkgIdent[0] == '.' {
// pkgIdent is definitely a relative path, not a package name, and it does not exist
return "", err
}
Expand Down

0 comments on commit 9aa161f

Please sign in to comment.