chore: update CI

* chore: update CI

* chore: update CI
This commit is contained in:
Ludovic Fernandez
2024-03-06 09:12:03 +01:00
committed by GitHub
parent 0a5b16cad6
commit 9aa161f2da
7 changed files with 44 additions and 68 deletions
+7 -25
View File
@@ -17,7 +17,7 @@ jobs:
strategy: strategy:
matrix: matrix:
go-version: [ '1.21', '1.22' ] go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
include: include:
@@ -29,36 +29,18 @@ jobs:
go-path-suffix: \go go-path-suffix: \go
steps: 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 # https://github.com/marketplace/actions/checkout
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
path: go/src/github.com/traefik/yaegi path: go/src/github.com/traefik/yaegi
# https://github.com/marketplace/actions/cache # https://github.com/marketplace/actions/setup-go-environment
- name: Cache Go modules - name: Set up Go ${{ matrix.go-version }}
uses: actions/cache@v3 uses: actions/setup-go@v5
with: with:
# In order: go-version: ${{ matrix.go-version }}
# * Module download cache stable: true
# * 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-
- name: Setup GOPATH - name: Setup GOPATH
run: go env -w GOPATH=${{ github.workspace }}${{ matrix.go-path-suffix }} run: go env -w GOPATH=${{ github.workspace }}${{ matrix.go-path-suffix }}
+23 -23
View File
@@ -7,8 +7,8 @@ on:
pull_request: pull_request:
env: env:
GO_VERSION: '1.22' GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.55.2 GOLANGCI_LINT_VERSION: v1.56.2
jobs: jobs:
@@ -16,16 +16,16 @@ jobs:
name: Linting name: Linting
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
fetch-depth: 0 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 - name: Check and get dependencies
run: | run: |
go mod tidy go mod tidy
@@ -45,19 +45,19 @@ jobs:
needs: linting needs: linting
strategy: strategy:
matrix: matrix:
go-version: [ '1.21', '1.22' ] go-version: [ oldstable, stable ]
steps: steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go ${{ matrix.go-version }} - name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
stable: true stable: true
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check generated code - name: Check generated code
run: | run: |
rm -f interp/op.go rm -f interp/op.go
@@ -76,21 +76,21 @@ jobs:
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi
strategy: strategy:
matrix: matrix:
go-version: [ '1.21', '1.22' ] go-version: [ oldstable, stable ]
steps: 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 - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
path: go/src/github.com/traefik/yaegi path: go/src/github.com/traefik/yaegi
fetch-depth: 0 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 # https://github.com/marketplace/actions/cache
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v3 uses: actions/cache@v3
+7 -15
View File
@@ -6,7 +6,7 @@ on:
- v[0-9]+.[0-9]+* - v[0-9]+.[0-9]+*
env: env:
GO_VERSION: '1.21' GO_VERSION: stable
jobs: jobs:
@@ -15,28 +15,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Cache Go modules - name: Set up Go ${{ env.GO_VERSION }}
uses: actions/cache@v3 uses: actions/setup-go@v5
with: with:
path: ~/go/pkg/mod go-version: ${{ env.GO_VERSION }}
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2 uses: goreleaser/goreleaser-action@v5
with: with:
version: latest version: latest
args: release --rm-dist args: release --clean
env: env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }}
+3 -2
View File
@@ -142,9 +142,10 @@ linters:
issues: issues:
exclude-use-default: false exclude-use-default: false
max-per-linter: 0 max-issues-per-linter: 0
max-same-issues: 0 max-same-issues: 0
exclude: [] exclude:
- 'fmt.Sprintf can be replaced with string'
exclude-rules: exclude-rules:
- path: .+_test\.go - path: .+_test\.go
linters: linters:
+1 -1
View File
@@ -47,7 +47,7 @@ archives:
- LICENSE - LICENSE
brews: brews:
- tap: - repository:
owner: traefik owner: traefik
name: homebrew-tap name: homebrew-tap
commit_author: commit_author:
+2 -1
View File
@@ -3,6 +3,7 @@ package main
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"errors"
"flag" "flag"
"fmt" "fmt"
"io" "io"
@@ -38,7 +39,7 @@ func extractCmd(arg []string) error {
args := eflag.Args() args := eflag.Args()
if len(args) == 0 { if len(args) == 0 {
return fmt.Errorf("missing package") return errors.New("missing package")
} }
license, err := genLicense(licensePath) license, err := genLicense(licensePath)
+1 -1
View File
@@ -387,7 +387,7 @@ func (e *Extractor) importPath(pkgIdent, importPath string) (string, error) {
return "", err return "", err
} }
if err != nil { 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 // pkgIdent is definitely a relative path, not a package name, and it does not exist
return "", err return "", err
} }