test.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. permissions:
  21. contents: read
  22. runs-on: ${{ matrix.os }}
  23. strategy:
  24. fail-fast: false
  25. matrix:
  26. os: [windows-latest, ubuntu-latest, macos-latest]
  27. steps:
  28. - name: Set up Go
  29. uses: actions/setup-go@v3
  30. with:
  31. go-version: '1.20'
  32. check-latest: true
  33. - name: Checkout codebase
  34. uses: actions/checkout@v3
  35. - name: Prepare geo*dat
  36. if: ${{ matrix.os != 'windows-latest' }}
  37. run: |
  38. mkdir resources
  39. wget -O ./resources/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
  40. wget -O ./resources/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
  41. - name: Prepare geo*dat for Windows
  42. if: ${{ matrix.os == 'windows-latest' }}
  43. run: |
  44. mkdir resources
  45. Invoke-WebRequest -Uri "https://github.com/v2fly/geoip/releases/latest/download/geoip.dat" -OutFile "./resources/geoip.dat"
  46. Invoke-WebRequest -Uri "https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat" -OutFile "./resources/geosite.dat"
  47. - name: Test
  48. run: go test -timeout 1h -v ./...