github.com/yaling888/clash@v1.53.0/.github/workflows/test.yml (about)

     1  name: Test
     2  on: [push]
     3  jobs:
     4    test:
     5      runs-on: ubuntu-latest
     6      steps:
     7        - uses: actions/checkout@v4
     8  
     9        - name: Get latest go version
    10          id: version
    11          run: |
    12            go_mod_version=$(cat go.mod | grep -oE '^go [0-9]{1,}.[0-9|a-z]{1,}(.[0-9]{1,})?' | awk '(NR==1){printf $2}')
    13            latest_go_version=$(curl -sSL https://go.dev/dl/?mode=json | grep "version" | cut -d\" -f4 | awk -Fgo '(NR==1){printf $2}') || ""
    14            go_version="$latest_go_version"
    15  
    16            if [[ -z "$latest_go_version" ]] || [[ $go_mod_version =~ .*[rc|beta].* ]]; then
    17              go_version="$go_mod_version"
    18            fi
    19  
    20            echo "go_version=${go_version}" >> $GITHUB_OUTPUT
    21  
    22        - name: Setup Go
    23          uses: actions/setup-go@v5
    24          with:
    25            go-version: ${{ steps.version.outputs.go_version }}
    26            check-latest: true
    27            cache: false
    28  
    29        - name: TestAll
    30          if: contains(github.event.head_commit.message, 'test')
    31          run: |
    32            cd test/
    33            make test