test.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Test
  2. on:
  3. push:
  4. branches:
  5. - main
  6. paths:
  7. - "**/*.go"
  8. - "go.mod"
  9. - "go.sum"
  10. - ".github/workflows/*.yml"
  11. pull_request:
  12. types: [opened, synchronize, reopened]
  13. paths:
  14. - "**/*.go"
  15. - "go.mod"
  16. - "go.sum"
  17. - ".github/workflows/*.yml"
  18. jobs:
  19. test:
  20. runs-on: ${{ matrix.os }}
  21. strategy:
  22. fail-fast: false
  23. matrix:
  24. os: [windows-latest, ubuntu-latest, macos-latest]
  25. steps:
  26. - name: Set up Go
  27. uses: actions/setup-go@v2
  28. with:
  29. go-version: ^1.16
  30. - name: Checkout codebase
  31. uses: actions/checkout@v2
  32. - name: Prepare geo*dat
  33. if: ${{ matrix.os != 'windows-latest' }}
  34. run: |
  35. mkdir resources
  36. wget -O ./resources/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
  37. wget -O ./resources/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
  38. - name: Prepare geo*dat for Windows
  39. if: ${{ matrix.os == 'windows-latest' }}
  40. run: |
  41. mkdir resources
  42. Invoke-WebRequest -Uri "https://github.com/v2fly/geoip/releases/latest/download/geoip.dat" -OutFile "./resources/geoip.dat"
  43. Invoke-WebRequest -Uri "https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat" -OutFile "./resources/geosite.dat"
  44. - name: Test
  45. run: go test -timeout 1h -v ./...