From 2457b0b449895a93029cbc2751d4f30971924b3e Mon Sep 17 00:00:00 2001 From: dmachard <5562930+dmachard@users.noreply.github.com> Date: Sun, 3 Nov 2024 14:33:05 +0100 Subject: [PATCH] code factory powerdns ci --- .github/workflows/testing-powerdns.yml | 92 +++++++++----------------- 1 file changed, 33 insertions(+), 59 deletions(-) diff --git a/.github/workflows/testing-powerdns.yml b/.github/workflows/testing-powerdns.yml index 9d770373..a492298b 100644 --- a/.github/workflows/testing-powerdns.yml +++ b/.github/workflows/testing-powerdns.yml @@ -1,4 +1,4 @@ -name: tests powerdns +name: Tests PowerDNS on: push: @@ -19,68 +19,42 @@ permissions: jobs: - dnsdist: + build-and-test: runs-on: ubuntu-latest strategy: matrix: go-version: [ '1.23' ] - dnsdist: [ '18', '19' ] + component: + - { name: 'dnsdist', version: '18' } + - { name: 'dnsdist', version: '19' } + - { name: 'recursor', version: '51' } steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "${{ matrix.go-version }}" - - - uses: actions/setup-python@v5 - with: - python-version: 3.13 - - - name: build binary - run: | - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy dnsdist docker image - run: | - sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_protobuf.conf:/etc/dnsdist/conf.d/dnsdist.conf:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.dnsdist }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test dns query - run: | - sudo python3 -m pip install dnspython - sudo -E python3 -m unittest tests.dnsquery_powerdns -v - - recursor: - runs-on: ubuntu-latest - - strategy: - matrix: - go-version: [ '1.23' ] - recursor: [ '51' ] - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: "${{ matrix.go-version }}" - - - uses: actions/setup-python@v5 - with: - python-version: 3.13 - - - name: build binary - run: | - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go - - - name: Deploy recursor 5.x docker image - run: | - sudo docker run -d --network="host" --name=recursor --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.yml:/etc/powerdns/recursor.yml:z powerdns/pdns-recursor-${{ matrix.recursor }} - until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done - - - name: Test send query - run: | - sudo python3 -m pip install dnspython - sudo -E python3 -m unittest tests.dnsquery_powerdns -v \ No newline at end of file + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "${{ matrix.go-version }}" + + - uses: actions/setup-python@v5 + with: + python-version: 3.13 + + - name: Build binary + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + + - name: Deploy Docker image + run: | + if [[ "${{ matrix.component.name }}" == "dnsdist" ]]; then + sudo docker run -d --network="host" --name=dnsdist --volume=$PWD/tests/testsdata/powerdns/dnsdist_protobuf.conf:/etc/dnsdist/conf.d/dnsdist.conf:z -v /tmp/:/tmp/ powerdns/dnsdist-${{ matrix.component.version }} + elif [[ "${{ matrix.component.name }}" == "recursor" ]]; then + sudo docker run -d --network="host" --name=recursor --volume=$PWD/tests/testsdata/powerdns/pdns_recursor.yml:/etc/powerdns/recursor.yml:z powerdns/pdns-recursor-${{ matrix.component.version }} + fi + until (dig -p 5553 www.github.com @127.0.0.1 | grep NOERROR); do sleep 5.0; done + + - name: Test DNS query + run: | + sudo python3 -m pip install dnspython + sudo -E python3 -m unittest tests.dnsquery_powerdns -v