-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use GitHub Actions instead of TravisCI - updates golangci-lint to v1.36.0 and applies my rules
- Loading branch information
Showing
14 changed files
with
256 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Build Cross OS | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
|
||
cross: | ||
name: Go | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi | ||
|
||
strategy: | ||
matrix: | ||
go-version: [ 1.14, 1.15 ] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
include: | ||
- os: ubuntu-latest | ||
go-path-suffix: /go | ||
- os: macos-latest | ||
go-path-suffix: /go | ||
- os: windows-latest | ||
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 }} | ||
|
||
# https://github.com/marketplace/actions/checkout | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: go/src/github.com/traefik/yaegi | ||
|
||
# https://github.com/marketplace/actions/cache | ||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/go/pkg/mod # Module download cache | ||
~/.cache/go-build # Build cache (Linux) | ||
~/Library/Caches/go-build # Build cache (Mac) | ||
'%LocalAppData%\go-build' # Build cache (Windows) | ||
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.go-version }}-go- | ||
- name: Setup GOPATH | ||
run: go env -w GOPATH=${{ github.workspace }}${{ matrix.go-path-suffix }} | ||
|
||
# TODO fail on windows | ||
# - name: Tests | ||
# run: go test -v -cover ./... | ||
# env: | ||
# GOPATH: ${{ github.workspace }}${{ matrix.go-path }} | ||
|
||
- name: Build | ||
run: go build -race -v -ldflags "-s -w" -trimpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
env: | ||
GO_VERSION: 1.15 | ||
GOLANGCI_LINT_VERSION: v1.36.0 | ||
|
||
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 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check and get dependencies | ||
run: | | ||
go mod tidy | ||
git diff --exit-code go.mod | ||
# git diff --exit-code go.sum | ||
go mod download | ||
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} | ||
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} | ||
|
||
- name: Run golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} | ||
run: make check | ||
|
||
generate: | ||
name: Checks code and generated code | ||
runs-on: ubuntu-latest | ||
needs: linting | ||
strategy: | ||
matrix: | ||
go-version: [ 1.14, 1.15 ] | ||
steps: | ||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check generated code | ||
run: | | ||
rm -f interp/op.go | ||
make generate | ||
git update-index -q --refresh | ||
CHANGED=$(git diff-index --name-only HEAD --) | ||
test -z "$CHANGED" || echo $CHANGED | ||
test -z "$CHANGED" | ||
main: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
needs: linting | ||
defaults: | ||
run: | ||
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi | ||
strategy: | ||
matrix: | ||
go-version: [ 1.14, 1.15 ] | ||
|
||
steps: | ||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: go/src/github.com/traefik/yaegi | ||
fetch-depth: 0 | ||
|
||
# https://github.com/marketplace/actions/cache | ||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./_test/tmp | ||
key: ${{ runner.os }}-yaegi-${{ hashFiles('**//_test/tmp/') }} | ||
restore-keys: | | ||
${{ runner.os }}-yaegi- | ||
- name: Setup GOPATH | ||
run: go env -w GOPATH=${{ github.workspace }}/go | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
|
||
- name: Run tests | ||
run: make tests | ||
env: | ||
GOPATH: ${{ github.workspace }}/go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+* | ||
|
||
env: | ||
GO_VERSION: 1.15 | ||
|
||
jobs: | ||
|
||
release: | ||
name: Create a release | ||
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 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.