github.com/qiniu/go-sdk/v7@v7.27.0/.github/workflows/ci-test.yml (about) 1 on: [push, pull_request] 2 name: Run Test Cases 3 jobs: 4 go-mod-test: 5 strategy: 6 fail-fast: false 7 max-parallel: 1 8 matrix: 9 go_version: ['1.22', 'stable'] 10 runs-on: ubuntu-latest 11 permissions: 12 actions: read 13 contents: read 14 security-events: write 15 steps: 16 - name: Checkout repo 17 uses: actions/checkout@v4 18 with: 19 ref: ${{ github.ref }} 20 submodules: recursive 21 - name: Install Go 22 uses: actions/setup-go@v5 23 with: 24 go-version: ${{ matrix.go_version }} 25 - name: Format 26 run: | 27 if [ "${{ matrix.go_version }}" = "stable" ]; then 28 UNFORMATTED=$(gofmt -s -l . | grep -v vendor/ || true) 29 if [ -n "$UNFORMATTED" ]; then 30 echo "Files not formatted:" 31 echo "$UNFORMATTED" 32 exit 1 33 fi 34 fi 35 - name: Golint 36 run: | 37 if [ "${{ matrix.go_version }}" = "stable" ]; then 38 set -e 39 go install honnef.co/go/tools/cmd/staticcheck@latest 40 make staticcheck 41 fi 42 - name: Build examples 43 if: matrix.go_version == 'stable' 44 run: go build ./examples/... 45 - name: Run unit cases 46 run: | 47 set -e 48 make unittest 49 env: 50 GO111MODULE: 'on' 51 go-mod-test-windows: 52 needs: 'go-mod-test' 53 runs-on: windows-latest 54 permissions: 55 actions: read 56 contents: read 57 security-events: write 58 steps: 59 - name: Checkout repo 60 uses: actions/checkout@v4 61 with: 62 ref: ${{ github.ref }} 63 submodules: recursive 64 - name: Install Go 65 uses: actions/setup-go@v5 66 with: 67 go-version: stable 68 - name: Run unit cases 69 run: | 70 set -e 71 make unittest 72 shell: bash 73 go-mod-test-macos: 74 needs: 'go-mod-test-windows' 75 runs-on: macos-latest 76 permissions: 77 actions: read 78 contents: read 79 security-events: write 80 steps: 81 - name: Checkout repo 82 uses: actions/checkout@v4 83 with: 84 ref: ${{ github.ref }} 85 submodules: recursive 86 - name: Install Go 87 uses: actions/setup-go@v5 88 with: 89 go-version: stable 90 - name: Install dependencies 91 run: | 92 brew install make 93 - name: Run unit cases 94 run: | 95 set -e 96 make unittest