github.com/cloudwego/hertz@v0.9.3/.github/workflows/tests.yml (about)

     1  name: Tests
     2  
     3  on: [push, pull_request]
     4  
     5  jobs:
     6    compat-test:
     7      strategy:
     8        matrix:
     9          version: ["1.17", "1.18", "1.19"]
    10      runs-on: [self-hosted, X64]
    11      steps:
    12        - uses: actions/checkout@v4
    13        - name: Set up Go
    14          uses: actions/setup-go@v5
    15          with:
    16            go-version: ${{ matrix.version }}
    17            cache: false # don't use cache for self-hosted runners
    18  
    19        # Just build tests without running them
    20        - name: Build Test
    21          run: go test -run=nope ./...
    22  
    23    unit-test:
    24      strategy:
    25        matrix:
    26          version: ["1.20", "1.21", "1.22", "1.23"]
    27      runs-on: [self-hosted, X64]
    28      steps:
    29        - uses: actions/checkout@v4
    30        - name: Set up Go
    31          uses: actions/setup-go@v5
    32          with:
    33            go-version: ${{ matrix.version }}
    34            cache: false # don't use cache for self-hosted runners
    35  
    36        - name: Unit Test
    37          run: go test -race -covermode=atomic -coverprofile=coverage.txt ./...
    38  
    39        - name: Codecov
    40          run: bash <(curl -s https://codecov.io/bash)
    41  
    42    ut-windows:
    43      strategy:
    44        matrix:
    45          version: ["1.20", "1.21", "1.22", "1.23"]
    46      runs-on: windows-latest
    47      steps:
    48        - uses: actions/checkout@v4
    49        - name: Set up Go
    50          uses: actions/setup-go@v5
    51          with:
    52            go-version: ${{ matrix.version }}
    53            cache: false # don't use cache for self-hosted runners
    54  
    55        - name: Unit Test
    56          run: go test -race -covermode=atomic  ./...
    57  
    58    hz-test-unix:
    59      runs-on: [ self-hosted, X64 ]
    60      steps:
    61        - uses: actions/checkout@v4
    62        - name: Set up Go
    63          uses: actions/setup-go@v5
    64          with:
    65            go-version: stable
    66            cache: false # don't use cache for self-hosted runners
    67  
    68        - name: Setup Environment
    69          run: |
    70            echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
    71            echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
    72  
    73        - name: Get changed files
    74          id: changed-files
    75          uses: tj-actions/changed-files@v41
    76  
    77        - name: Hz Test
    78          if: contains(steps.changed-files.outputs.all_changed_files, 'cmd/hz')
    79          run: |
    80            cd cmd/hz
    81            sh test_hz_unix.sh
    82  
    83  
    84    hz-test-windows:
    85      runs-on: windows-latest
    86      steps:
    87        - uses: actions/checkout@v4
    88        - name: Set up Go
    89          uses: actions/setup-go@v5
    90          with:
    91            go-version: stable
    92  
    93        - name: Get changed files
    94          id: changed-files
    95          uses: tj-actions/changed-files@v41
    96  
    97        - name: Install Protobuf
    98          shell: pwsh
    99          run: |
   100            Invoke-WebRequest https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-win64.zip -OutFile protoc-3.19.4-win64.zip
   101            Expand-Archive protoc-3.19.4-win64.zip -DestinationPath protoc-3.19.4-win64
   102            $GOPATH=go env GOPATH
   103            Copy-Item -Path protoc-3.19.4-win64\bin\protoc.exe -Destination $GOPATH\bin
   104            Copy-Item -Path protoc-3.19.4-win64\include\* -Destination cmd\hz\testdata\include\google -Recurse
   105            protoc --version
   106  
   107        - name: Hz Test
   108          if: contains(steps.changed-files.outputs.all_changed_files, 'cmd/hz')
   109          run: |
   110            cd cmd/hz
   111            sh test_hz_windows.sh