main.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Go
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. # 如果 go 项目在 server 子目录
  8. paths:
  9. - './server/**'
  10. jobs:
  11. build:
  12. name: Build
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Set up Go 1.13
  16. uses: actions/setup-go@v1
  17. with:
  18. go-version: 1.13
  19. id: go
  20. - name: Check out code into the Go module directory
  21. uses: actions/checkout@v2
  22. - name: cache
  23. id: cache
  24. uses: actions/cache@v1
  25. with:
  26. path: ~/go/pkg/mod
  27. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  28. restore-keys: |
  29. ${{ runner.os }}-go-
  30. - name: Get dependencies
  31. run: |
  32. go get -v -t -d ./...
  33. if [ -f Gopkg.toml ]; then
  34. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  35. dep ensure
  36. fi
  37. working-directory: ./server
  38. - name: Build
  39. run: go build -v . -o output
  40. working-directory: ./server
  41. - name: artifact
  42. uses: actions/upload-artifact@v1
  43. with:
  44. name: artifact
  45. path: output