git.gammaspectra.live/P2Pool/go-json@v0.99.0/.github/workflows/go.yml (about)

     1  name: Go
     2  on:
     3    push:
     4      branches:
     5        - master
     6    pull_request:
     7  jobs:
     8    build:
     9      name: Build on limited environment
    10      runs-on: ubuntu-latest
    11      steps:
    12      - name: checkout
    13        uses: actions/checkout@v3
    14      - name: build
    15        run: docker-compose run go-json
    16  
    17    test:
    18      name: Test
    19      strategy:
    20        matrix:
    21          os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
    22          go-version: [ "1.19", "1.20", "1.21" ]
    23      runs-on: ${{ matrix.os }}
    24      steps:
    25      - name: setup Go ${{ matrix.go-version }}
    26        uses: actions/setup-go@v3
    27        with:
    28          go-version: ${{ matrix.go-version }}
    29      - name: checkout
    30        uses: actions/checkout@v3
    31      - name: simple test
    32        run: go test -v ./... -count=1
    33      - name: test with GC pressure
    34        run: go test -v ./... -count=1
    35        env:
    36          GOGC: 1
    37      - name: test with race detector
    38        run: go test -v -race ./... -count=1
    39  
    40    lint:
    41      name: Lint
    42      runs-on: ubuntu-latest
    43      steps:
    44        - name: checkout
    45          uses: actions/checkout@v3
    46        - name: setup Go
    47          uses: actions/setup-go@v3
    48          with:
    49            go-version: '1.21'
    50        - name: lint
    51          run: |
    52            make lint
    53    bench:
    54      name: Benchmark
    55      runs-on: ubuntu-latest
    56      steps:
    57        - name: setup Go
    58          uses: actions/setup-go@v3
    59          with:
    60            go-version: '1.21'
    61        - name: checkout ( feature )
    62          uses: actions/checkout@v3
    63        - name: run benchmark ( feature )
    64          run: cd benchmarks && go test -bench GoJson | tee $HOME/new.txt
    65        - name: install benchstat
    66          run: go install golang.org/x/perf/cmd/benchstat@latest
    67        - name: checkout ( master )
    68          uses: actions/checkout@v3
    69          with:
    70            ref: master
    71        - name: run benchmark ( master )
    72          run: cd benchmarks && go test -bench GoJson | tee $HOME/old.txt
    73        - name: compare benchmark results
    74          run: benchstat $HOME/old.txt $HOME/new.txt
    75  
    76    coverage:
    77      name: Coverage
    78      runs-on: ubuntu-latest
    79      steps:
    80        - name: checkout
    81          uses: actions/checkout@v3
    82        - name: setup Go
    83          uses: actions/setup-go@v3
    84          with:
    85            go-version: '1.21'
    86        - name: measure coverage
    87          run: make cover
    88        - uses: codecov/codecov-action@v3
    89          with:
    90            fail_ci_if_error: true
    91            verbose: true