github.com/switchupcb/yaegi@v0.10.2/.github/workflows/main.yml (about)

     1  name: Main
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7    pull_request:
     8  
     9  env:
    10    GO_VERSION: 1.17
    11    GOLANGCI_LINT_VERSION: v1.42.1
    12  
    13  jobs:
    14  
    15    linting:
    16      name: Linting
    17      runs-on: ubuntu-latest
    18      steps:
    19        - name: Set up Go ${{ env.GO_VERSION }}
    20          uses: actions/setup-go@v2
    21          with:
    22            go-version: ${{ env.GO_VERSION }}
    23  
    24        - name: Check out code
    25          uses: actions/checkout@v2
    26          with:
    27            fetch-depth: 0
    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: [ 1.16, 1.17 ]
    49      steps:
    50        - name: Set up Go ${{ matrix.go-version }}
    51          uses: actions/setup-go@v2
    52          with:
    53            go-version: ${{ matrix.go-version }}
    54  
    55        - name: Check out code
    56          uses: actions/checkout@v2
    57          with:
    58            fetch-depth: 0
    59  
    60        - name: Check generated code
    61          run: |
    62            rm -f interp/op.go
    63            make generate
    64            git update-index -q --refresh
    65            CHANGED=$(git diff-index --name-only HEAD --)
    66            test -z "$CHANGED" || echo $CHANGED
    67            test -z "$CHANGED"
    68  
    69    main:
    70      name: Build and Test
    71      runs-on: ubuntu-latest
    72      needs: linting
    73      defaults:
    74        run:
    75          working-directory: ${{ github.workspace }}/go/src/github.com/switchupcb/yaegi
    76      strategy:
    77        matrix:
    78          go-version: [ 1.16, 1.17 ]
    79  
    80      steps:
    81        - name: Set up Go ${{ matrix.go-version }}
    82          uses: actions/setup-go@v2
    83          with:
    84            go-version: ${{ matrix.go-version }}
    85  
    86        - name: Check out code
    87          uses: actions/checkout@v2
    88          with:
    89            path: go/src/github.com/switchupcb/yaegi
    90            fetch-depth: 0
    91  
    92        # https://github.com/marketplace/actions/cache
    93        - name: Cache Go modules
    94          uses: actions/cache@v2
    95          with:
    96            path: ./_test/tmp
    97            key: ${{ runner.os }}-yaegi-${{ hashFiles('**//_test/tmp/') }}
    98            restore-keys: |
    99              ${{ runner.os }}-yaegi-
   100  
   101        - name: Setup GOPATH
   102          run: go env -w GOPATH=${{ github.workspace }}/go
   103  
   104        - name: Build
   105          run: go build -v ./...
   106  
   107        - name: Run tests
   108          run: make tests
   109          env:
   110            GOPATH: ${{ github.workspace }}/go