| 1 |
name: Main |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
pull_request: |
| 8 |
|
| 9 |
env: |
| 10 |
GO_VERSION: stable |
| 11 |
GOLANGCI_LINT_VERSION: v2.4.0 |
| 12 |
|
| 13 |
jobs: |
| 14 |
|
| 15 |
linting: |
| 16 |
name: Linting |
| 17 |
runs-on: ubuntu-latest |
| 18 |
steps: |
| 19 |
- name: Check out code |
| 20 |
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 21 |
with: |
| 22 |
fetch-depth: 0 |
| 23 |
|
| 24 |
- name: Set up Go ${{ env.GO_VERSION }} |
| 25 |
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff |
| 26 |
with: |
| 27 |
go-version: ${{ env.GO_VERSION }} |
| 28 |
|
| 29 |
- name: Check and get dependencies |
| 30 |
run: | |
| 31 |
go mod tidy |
| 32 |
git diff --exit-code go.mod |
| 33 |
# git diff --exit-code go.sum |
| 34 |
go mod download |
| 35 |
|
| 36 |
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} |
| 37 |
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} |
| 38 |
|
| 39 |
- name: Run golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} |
| 40 |
run: make check |
| 41 |
|
| 42 |
generate: |
| 43 |
name: Checks code and generated code |
| 44 |
runs-on: ubuntu-latest |
| 45 |
needs: linting |
| 46 |
strategy: |
| 47 |
matrix: |
| 48 |
go-version: [ oldstable, stable ] |
| 49 |
steps: |
| 50 |
- name: Check out code |
| 51 |
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 52 |
with: |
| 53 |
fetch-depth: 0 |
| 54 |
|
| 55 |
- name: Set up Go ${{ matrix.go-version }} |
| 56 |
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff |
| 57 |
with: |
| 58 |
go-version: ${{ matrix.go-version }} |
| 59 |
stable: true |
| 60 |
|
| 61 |
- name: Check generated code |
| 62 |
run: | |
| 63 |
rm -f interp/op.go |
| 64 |
make generate |
| 65 |
git update-index -q --refresh |
| 66 |
CHANGED=$(git diff-index --name-only HEAD --) |
| 67 |
test -z "$CHANGED" || echo $CHANGED |
| 68 |
test -z "$CHANGED" |
| 69 |
|
| 70 |
main: |
| 71 |
name: Build and Test |
| 72 |
runs-on: ubuntu-latest |
| 73 |
needs: linting |
| 74 |
defaults: |
| 75 |
run: |
| 76 |
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/yaegi |
| 77 |
strategy: |
| 78 |
matrix: |
| 79 |
go-version: [ oldstable, stable ] |
| 80 |
|
| 81 |
steps: |
| 82 |
- name: Check out code |
| 83 |
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 |
| 84 |
with: |
| 85 |
path: go/src/github.com/traefik/yaegi |
| 86 |
fetch-depth: 0 |
| 87 |
|
| 88 |
- name: Set up Go ${{ matrix.go-version }} |
| 89 |
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff |
| 90 |
with: |
| 91 |
go-version: ${{ matrix.go-version }} |
| 92 |
stable: true |
| 93 |
|
| 94 |
|
| 95 |
- name: Cache Go modules |
| 96 |
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c |
| 97 |
with: |
| 98 |
path: ./_test/tmp |
| 99 |
key: ${{ runner.os }}-yaegi-${{ hashFiles('**//_test/tmp/') }} |
| 100 |
restore-keys: | |
| 101 |
${{ runner.os }}-yaegi- |
| 102 |
|
| 103 |
- name: Setup GOPATH |
| 104 |
run: go env -w GOPATH=${{ github.workspace }}/go |
| 105 |
|
| 106 |
- name: Build |
| 107 |
run: go build -v ./... |
| 108 |
|
| 109 |
- name: Run tests |
| 110 |
run: make tests |
| 111 |
env: |
| 112 |
GOPATH: ${{ github.workspace }}/go |