Support for complex cross-realm scenarios #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: v7 | |
on: | |
push: | |
paths-ignore: | |
- 'v[0-9]+/**' | |
pull_request: | |
paths-ignore: | |
- 'v[0-9]+/**' | |
jobs: | |
build: | |
name: Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: [ '1.18.x', '1.19.x', '1.20.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 | |
GO111MODULE: auto | |
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: | | |
# Remove major version sub directories | |
find . -maxdepth 1 -type d -regex '\./v[0-9]+' | xargs -i rm -rf {} | |
GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/) | |
test -z $(gofmt -s -l -e $GO_FILES | tee /dev/fd/2 | xargs | sed 's/\s//g') | |
id: gofmt | |
- name: Copy to gopkg.in in GOPATH | |
run: | | |
mkdir -p /home/runner/go/src/gopkg.in/jcmturner/gokrb5.v7 | |
cp -r $GITHUB_WORKSPACE/* /home/runner/go/src/gopkg.in/jcmturner/gokrb5.v7 | |
id: gopkg | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
id: goGet | |
- name: Unit tests | |
run: | | |
cd /home/runner/go/src/gopkg.in/jcmturner/gokrb5.v7 | |
go test -race $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) | |
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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test: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 ghcr.io/grafana/gokrb5-test:http | |
sleep 10 # Wait for the containers to be ready | |
sudo sed -i 's/nameserver .*/nameserver '${DNS_IP}'/g' /etc/resolv.conf | |
dig _kerberos._udp.TEST.GOKRB5 | |
id: intgTestDeps | |
- name: Run Examples | |
run: go run -tags="examples" examples/example.go | |
id: examples | |
- name: Tests including integration tests | |
run: | | |
cd /home/runner/go/src/gopkg.in/jcmturner/gokrb5.v7 | |
go test -race $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) | |
env: | |
INTEGRATION: 1 | |
TESTPRIVILEGED: 1 | |
id: intgTests | |
- name: Tests (32bit) | |
run: | | |
cd /home/runner/go/src/gopkg.in/jcmturner/gokrb5.v7 | |
go test $(go list ./... | grep -E -v '/v[0-9]+' | grep -v /vendor/) | |
env: | |
GOARCH: 386 | |
INTEGRATION: 1 | |
TESTPRIVILEGED: 1 | |
id: test32 |