| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | - develop |
| 8 | pull_request: |
| 9 | branches: |
| 10 | - master |
| 11 | - develop |
| 12 | |
| 13 | |
| 14 | permissions: |
| 15 | contents: read |
| 16 | |
| 17 | |
| 18 | jobs: |
| 19 | |
| 20 | build: |
| 21 | name: Build |
| 22 | runs-on: ubuntu-latest |
| 23 | strategy: |
| 24 | matrix: |
| 25 | go-version: [1.17, 1.18, 1.19, '1.20', '1.21', '1.22', '1.23', '1.24'] |
| 26 | steps: |
| 27 | |
| 28 | - name: Set up Go |
| 29 | uses: actions/setup-go@v5 |
| 30 | with: |
| 31 | go-version: ${{ matrix.go-version }} |
| 32 | env: |
| 33 | GOPATH: ${{ env.HOME }} |
| 34 | id: go |
| 35 | |
| 36 | - name: Check out code into the Go module directory |
| 37 | uses: actions/checkout@v4 |
| 38 | |
| 39 | - name: Get dependencies |
| 40 | run: | |
| 41 | go get -v -t -d ./... |
| 42 | |
| 43 | - name: Build |
| 44 | run: go build -v . |
| 45 | |
| 46 | - name: Test |
| 47 | run: go test -v . |
| 48 | |
| 49 | - name: Test cmd |
| 50 | run: | |
| 51 | cd cli/pinyin/ |
| 52 | go run ./main.go 测试 |
| 53 | go run ./main.go -s zhao 测试 |
| 54 | echo 测试 | go run ./main.go |