github.com/fufuok/freelru@v0.13.3/.github/workflows/unit-test-on-pull-request.yml (about)

     1  name: FreeLRU
     2  
     3  on:
     4    push:
     5      branches: [main]
     6    pull_request:
     7      branches: ["**"]
     8  
     9  jobs:
    10    lint:
    11      name: Lint
    12      runs-on: ubuntu-latest
    13      strategy:
    14        fail-fast: true
    15        max-parallel: 2
    16        matrix:
    17          go: ["stable"]
    18      steps:
    19      - name: Set up Go ${{matrix.go}}
    20        uses: actions/setup-go@v4
    21        with:
    22          go-version: ${{matrix.go}}
    23          check-latest: true
    24        id: go
    25      - name: Check out
    26        uses: actions/checkout@v4
    27      - name: Linter
    28        run: |
    29            go version
    30            go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
    31            make lint
    32  
    33    test:
    34      name: Test
    35      runs-on: ubuntu-latest
    36      strategy:
    37        fail-fast: true
    38        max-parallel: 2
    39        matrix:
    40          go: ["stable", "1.18.10"]
    41      steps:
    42      - name: Set up Go ${{matrix.go}}
    43        uses: actions/setup-go@v4
    44        with:
    45          go-version: ${{matrix.go}}
    46          check-latest: true
    47        id: go
    48      - name: Check out
    49        uses: actions/checkout@v4
    50      - name: Run Test
    51        run: |
    52            make check
    53  
    54    bench:
    55      name: Bench
    56      runs-on: ubuntu-latest
    57      strategy:
    58        fail-fast: true
    59        max-parallel: 2
    60        matrix:
    61          go: ["stable"]
    62      steps:
    63        - name: Set up Go ${{matrix.go}}
    64          uses: actions/setup-go@v4
    65          with:
    66            go-version: ${{matrix.go}}
    67            check-latest: true
    68          id: go
    69        - name: Check out
    70          uses: actions/checkout@v4
    71        - name: Run Benchmarks
    72          run: |
    73            GOMAXPROCS=100 make bench
    74  
    75    coverage:
    76      name: Coverage
    77      runs-on: ubuntu-latest
    78      strategy:
    79        fail-fast: true
    80        max-parallel: 2
    81        matrix:
    82          go: ["stable"]
    83      permissions:
    84        contents: write
    85      steps:
    86        - name: Set up Go ${{matrix.go}}
    87          uses: actions/setup-go@v4
    88          with:
    89            go-version: ${{matrix.go}}
    90            check-latest: true
    91          id: go
    92        - name: Check out
    93          uses: actions/checkout@v4
    94          with:
    95            ref: ${{ github.head_ref }}
    96        - name: Build
    97          run: |
    98            go install
    99        - name: Run Coverage
   100          run: |
   101            go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
   102  
   103        - name: Report Coveralls
   104          run: curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz && ./coveralls report coverage.out --format=golang
   105          env:
   106            COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}