testingv8.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Name of the workflow needs to match the name of the major version directory
  2. name: v8
  3. on:
  4. push:
  5. paths:
  6. - 'v8/**'
  7. pull_request:
  8. paths:
  9. - 'v8/**'
  10. jobs:
  11. build:
  12. name: Tests
  13. runs-on: ubuntu-latest
  14. strategy:
  15. matrix:
  16. go: [ '1.13.x', '1.14.x' ]
  17. env:
  18. TEST_KDC_ADDR: 127.0.0.1
  19. TEST_HTTP_URL: http://cname.test.gokrb5
  20. TEST_HTTP_ADDR: 127.0.0.1
  21. DNS_IP: 127.0.88.53
  22. DNSUTILS_OVERRIDE_NS: 127.0.88.53:53
  23. steps:
  24. - name: Set up Go ${{ matrix.go }}
  25. uses: actions/setup-go@v1
  26. with:
  27. go-version: ${{ matrix.go }}
  28. - name: Checkout
  29. uses: actions/checkout@v2
  30. with:
  31. ref: ${{ github.ref }}
  32. - name: Test well formatted with gofmt
  33. run: |
  34. GO_FILES=$(find ${GITHUB_WORKFLOW} -iname '*.go' -type f | grep -v /vendor/)
  35. test -z $(gofmt -s -d -l -e $GO_FILES | tee /dev/fd/2 | xargs | sed 's/\s//g')
  36. id: gofmt
  37. - name: Unit tests
  38. run: |
  39. cd ${GITHUB_WORKFLOW}
  40. go test -race ./...
  41. id: unitTests
  42. - name: Start integration test dependencies
  43. run: |
  44. sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq krb5-user
  45. sudo chmod 666 /etc/krb5.conf
  46. sudo docker run -d -h ns.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -e "TEST_KDC_ADDR=${TEST_KDC_ADDR}" -e "TEST_HTTP_ADDR=${TEST_HTTP_ADDR}" -p ${DNSUTILS_OVERRIDE_NS}:53 -p ${DNSUTILS_OVERRIDE_NS}:53/udp --name dns jcmturner/gokrb5:dns
  47. sudo docker run -d -h kdc.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -p 88:88 -p 88:88/udp -p 464:464 -p 464:464/udp --name krb5kdc jcmturner/gokrb5:kdc-centos-default
  48. sudo docker run -d -h kdc.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -p 78:88 -p 78:88/udp --name krb5kdc-old jcmturner/gokrb5:kdc-older
  49. sudo docker run -d -h kdc.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -p 98:88 -p 98:88/udp --name krb5kdc-latest jcmturner/gokrb5:kdc-latest
  50. sudo docker run -d -h kdc.resdom.gokrb5 -v /etc/localtime:/etc/localtime:ro -p 188:88 -p 188:88/udp --name krb5kdc-resdom jcmturner/gokrb5:kdc-resdom
  51. sudo docker run -d -h kdc.test.gokrb5 -v /etc/localtime:/etc/localtime:ro -p 58:88 -p 58:88/udp --name krb5kdc-shorttickets jcmturner/gokrb5:kdc-shorttickets
  52. sudo docker run -d --add-host host.test.gokrb5:127.0.0.88 -v /etc/localtime:/etc/localtime:ro -p 80:80 -p 443:443 --name gokrb5-http jcmturner/gokrb5:http
  53. sudo sed -i 's/nameserver .*/nameserver '${DNS_IP}'/g' /etc/resolv.conf
  54. dig _kerberos._udp.TEST.GOKRB5
  55. id: intgTestDeps
  56. - name: Run Examples
  57. run: |
  58. cd ${GITHUB_WORKFLOW}
  59. go run -tags="examples" examples/example.go
  60. id: examples
  61. - name: Tests including integration tests
  62. run: |
  63. cd ${GITHUB_WORKFLOW}
  64. go test -race ./...
  65. env:
  66. INTEGRATION: 1
  67. TESTPRIVILEGED: 1
  68. id: intgTests
  69. - name: Tests (32bit)
  70. run: |
  71. cd ${GITHUB_WORKFLOW}
  72. go test ./...
  73. env:
  74. GOARCH: 386
  75. INTEGRATION: 1
  76. TESTPRIVILEGED: 1
  77. id: test32