chore: update CI #1034
Workflow file for this run
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
name: Main | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
GO_VERSION: stable | |
GOLANGCI_LINT_VERSION: v1.56.2 | |
jobs: | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
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 | |
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: [ 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@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
stable: true | |
- 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: [ oldstable, stable ] | |
steps: | |
- name: Check out code | |
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 | |
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 |