# Name of the workflow needs to match the name of the major version directory name: v8 on: push: paths: - 'v8/**' pull_request: paths: - 'v8/**' jobs: build: name: Tests runs-on: ubuntu-latest strategy: matrix: go: [ '1.11.x', '1.12.x', '1.13.x' ] env: TEST_KDC_ADDR: 127.0.0.1 TEST_HTTP_URL: http://cname.test.gokrb5 TEST_HTTP_ADDR: 127.0.0.1 DNS_IP: 127.0.88.53 DNSUTILS_OVERRIDE_NS: 127.0.88.53:53 steps: - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v1 with: go-version: ${{ matrix.go }} - name: Checkout uses: actions/checkout@v2 with: ref: ${{ github.ref }} - name: Test well formatted with gofmt run: | GO_FILES=$(find ${GITHUB_WORKFLOW} -iname '*.go' -type f | grep -v /vendor/) test -z $(gofmt -s -d -l -e $GO_FILES | tee /dev/fd/2 | xargs | sed 's/\s//g') id: gofmt - name: Unit tests run: | cd ${GITHUB_WORKFLOW} go test -race ./... id: unitTests - name: Start integration test dependencies run: | sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq krb5-user sudo chmod 666 /etc/krb5.conf 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 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 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 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 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 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 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 sudo sed -i 's/nameserver .*/nameserver '${DNS_IP}'/g' /etc/resolv.conf dig _kerberos._udp.TEST.GOKRB5 id: intgTestDeps - name: Run Examples run: | cd ${GITHUB_WORKFLOW} go run -tags="examples" examples/example.go id: examples - name: Tests including integration tests run: | cd ${GITHUB_WORKFLOW} go test -race ./... env: INTEGRATION: 1 TESTPRIVILEGED: 1 id: intgTests - name: Tests (32bit) run: | cd ${GITHUB_WORKFLOW} go test ./... env: GOARCH: 386 INTEGRATION: 1 TESTPRIVILEGED: 1 id: test32