From 670dcd45d2b1fab6bba7034533854420800c1349 Mon Sep 17 00:00:00 2001 From: dmachard <5562930+dmachard@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:49:07 +0100 Subject: [PATCH] build binary in job --- .github/workflows/testing-dnstap.yml | 59 +++++++++++++++++++++------- .github/workflows/testing-go.yml | 15 +++++-- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/.github/workflows/testing-dnstap.yml b/.github/workflows/testing-dnstap.yml index ea647a97..4fe8aae5 100644 --- a/.github/workflows/testing-dnstap.yml +++ b/.github/workflows/testing-dnstap.yml @@ -17,31 +17,59 @@ on: permissions: contents: read +env: + Q_VERSION: "0.19.2" + PYTHON_VERSION: "3.13" + GO_VERSION: "1.23" + jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "${{ env.GO_VERSION }}" + + - name: Build Binary + run: | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + + - name: Upload Binary Artifact + uses: actions/upload-artifact@v4 + with: + name: go-dnscollector + path: go-dnscollector + unbound: + needs: build runs-on: ubuntu-latest env: COLLECTOR_USER: runneradmin strategy: matrix: - go-version: [ '1.23' ] + #go-version: [ '1.23' ] unbound: [ '1.19.3', '1.20.0' ] - mode: [ 'tcp' ] steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} + # - uses: actions/setup-go@v5 + # with: + # go-version: ${{ matrix.go-version }} - uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: "${{ env.PYTHON_VERSION }}" - - name: build binary - run: | - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o go-dnscollector *.go + - name: Download Binary Artifact + uses: actions/download-artifact@v4 + with: + name: go-dnscollector + + # - 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: | @@ -70,7 +98,7 @@ jobs: go-version: ${{ matrix.go-version }} - uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: "${{ env.PYTHON_VERSION }}" - name: build binary run: | @@ -103,7 +131,7 @@ jobs: go-version: ${{ matrix.go-version }} - uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: "${{ env.PYTHON_VERSION }}" - name: build binary run: | @@ -144,12 +172,13 @@ jobs: 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.12 + python-version: "${{ env.PYTHON_VERSION }}" - name: build binary run: | @@ -186,7 +215,7 @@ jobs: go-version: ${{ matrix.go-version }} - uses: actions/setup-python@v5 with: - python-version: 3.12 + python-version: "${{ env.PYTHON_VERSION }}" - name: build binary run: | @@ -194,8 +223,8 @@ jobs: - name: download q run: | - wget https://github.com/natesales/q/releases/download/v0.19.2/q_0.19.2_linux_amd64.tar.gz - tar xvf q_0.19.2_linux_amd64.tar.gz + wget https://github.com/natesales/q/releases/download/v0.19.2/q_${{ env.Q_VERSION }}_linux_amd64.tar.gz + tar xvf q_${{ env.Q_VERSION }}_linux_amd64.tar.gz - name: Generate certificate run: | diff --git a/.github/workflows/testing-go.yml b/.github/workflows/testing-go.yml index 44f1bc40..1af24ef1 100644 --- a/.github/workflows/testing-go.yml +++ b/.github/workflows/testing-go.yml @@ -1,4 +1,4 @@ -name: tests go +name: Go Tests on: push: @@ -20,6 +20,9 @@ permissions: env: PROM_VERSION: "2.55.0" GENTAP: "0.8.0" + PYTHON_VERSION: '3.13' + GO_VERSION: '1.23' + CHECKOUT_VERSION: "v4" jobs: dev: @@ -89,7 +92,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.13' + python-version: "${{ env.PYTHON_VERSION }}" - name: build binary run: | @@ -106,7 +109,7 @@ jobs: strategy: matrix: - go-version: [ '1.21', '1.22', '1.23'] + go-version: [ '1.21', '1.22', '1.23' ] steps: - uses: actions/checkout@v4 @@ -146,10 +149,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Configure environment to avoid toolchain installs + shell: bash + run: echo "GOTOOLCHAIN=local" >> "$GITHUB_ENV" + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: "1.23" + go-version: ${{ env.GO_VERSION }} - id: count_tests run: |