github.com/phuslu/log@v1.0.100/.github/workflows/build.yml (about)

     1  name: build
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7  
     8  jobs:
     9    build:
    10      runs-on: ubuntu-latest
    11      strategy:
    12        matrix:
    13          go-version: ['tip', '1.22', '1.21', '1.20', '1.19', '1.18']
    14      steps:
    15        - name: Setup Go
    16          if: matrix.go-version != 'tip'
    17          uses: actions/setup-go@master
    18          with:
    19            go-version: ${{ matrix.go-version }}
    20        - name: Setup Go tip if needed
    21          if: matrix.go-version == 'tip'
    22          run: |
    23            set -ex
    24            commit=$(git ls-remote https://github.com/golang/go.git HEAD | awk '{print $1}')
    25            curl -LOJ https://storage.googleapis.com/go-build-snap/go/linux-amd64/${commit}.tar.gz
    26            rm -rf /usr/local/go
    27            sudo tar xzf ${commit}.tar.gz -C /usr/local
    28            sudo ln -sf /usr/local/go/bin/go /usr/bin/go
    29            go version
    30        - uses: actions/checkout@v4
    31        - name: Build
    32          run: go build -v -race
    33        - name: Test
    34          run: go test -v
    35        - name: Bench
    36          run: go test -v -run=none -bench=.
    37    lint:
    38      runs-on: ubuntu-latest
    39      steps:
    40        - uses: actions/setup-go@v4
    41          with:
    42            go-version: '1.22'
    43            check-latest: true
    44        - uses: actions/checkout@v4
    45        - name: Lint
    46          run: |
    47            curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.2
    48            ./bin/golangci-lint run