github.com/traefik/yaegi@v0.15.1/.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.19
    11    GOLANGCI_LINT_VERSION: v1.47.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.19, '1.20' ]
    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            stable: true
    55  
    56        - name: Check out code
    57          uses: actions/checkout@v2
    58          with:
    59            fetch-depth: 0
    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: [ 1.19, '1.20' ]
    80  
    81      steps:
    82        - name: Set up Go ${{ matrix.go-version }}
    83          uses: actions/setup-go@v2
    84          with:
    85            go-version: ${{ matrix.go-version }}
    86            stable: true
    87  
    88        - name: Check out code
    89          uses: actions/checkout@v2
    90          with:
    91            path: go/src/github.com/traefik/yaegi
    92            fetch-depth: 0
    93  
    94        # https://github.com/marketplace/actions/cache
    95        - name: Cache Go modules
    96          uses: actions/cache@v3
    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