github.com/decred/dcrlnd@v0.7.6/.github/workflows/go.yml (about)

     1  name: Build and Test
     2  on: [push, pull_request]
     3  permissions:
     4    contents: read
     5  
     6  jobs:
     7    build:
     8      name: Build
     9      runs-on: ubuntu-latest
    10      strategy:
    11        matrix:
    12          go: ['1.21', '1.22']
    13      steps:
    14        - name: Set up Go
    15          uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 #v5.0.0
    16          with:
    17            go-version: ${{ matrix.go }}
    18  
    19        - name: Check out source
    20          uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
    21  
    22        - name: Install Linters
    23          run: "go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.0"
    24  
    25        - name: Check golangci-lint version
    26          run: golangci-lint --version
    27  
    28        - name: Build
    29          run: go build ./...
    30  
    31        - name: Lint
    32          run: |
    33            golangci-lint run --out-format=github-actions
    34  
    35        - name: Package test binaries
    36          run: |
    37            export GOPATH=$(go env GOPATH)
    38            make package-test-binaries
    39  
    40        - name: Upload test binaries
    41          uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
    42          with:
    43            name: ${{ matrix.go }}-test-binaries
    44            path: dcrlnd_testbins.tar.gz
    45  
    46    testsuite:
    47      name: Test
    48      needs: build
    49      runs-on: ubuntu-latest
    50      strategy:
    51        fail-fast: false
    52        matrix:
    53          go: ['1.21']
    54          testsuite:
    55            - unit-race # unit tests
    56            - itest-parallel-run # embedded wallet using dcrd for sync and chain ops
    57            - itest-parallel-run walletimpl=embeddedwallet_dcrw # embedded wallet, dcrd sync but dcrw chain ops
    58            - itest-parallel-run walletimpl=embeddedwallet_dcrw backend=spv # embedded wallet, spv sync and dcrw chain ops
    59            - itest-parallel-run walletimpl=remotewallet # remote wallet dcrd sync
    60            - itest-parallel-run walletimpl=remotewallet backend=spv # remote wallet spv sync
    61      steps:
    62        - name: Set up Go
    63          uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 #v5.0.0
    64          with:
    65            go-version: ${{ matrix.go }}
    66  
    67        - name: Check out source
    68          uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
    69  
    70        - name: Download the test binaries
    71          uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #v4.1.8
    72          with:
    73            name: ${{ matrix.go }}-test-binaries
    74            path: ${{ matrix.go }}-test-binaries
    75  
    76        - name: Unpack the test binaries
    77          run: |
    78            export GOPATH=$(go env GOPATH)
    79            mv ${{ matrix.go }}-test-binaries/* .
    80            make unpack-test-binaries
    81  
    82        - name: Run the test suite
    83          run: |
    84            export GOPATH=$(go env GOPATH)
    85            export PATH=${PATH}:$(go env GOPATH)/bin
    86            make ${{ matrix.testsuite }}
    87  
    88        - name: Compress log files
    89          if: always()
    90          run: |
    91            find . -iname *.log | tar -T - --ignore-failed-read -czf output-logs.tar.gz
    92  
    93        - name: Upload logs
    94          if: always()
    95          uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 #v4.6.0
    96          with:
    97            name: ${{ matrix.go }}-${{ matrix.testsuite }}-logs.tar.gz
    98            path: output-logs.tar.gz
    99  
   100