From 7ebe4325e0ae63681381b99329f93ce1e3db7557 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Tue, 24 Sep 2024 14:32:07 +0200 Subject: [PATCH] Adding CGO flags to supress warnings and fix build failures (#364) Co-authored-by: Gaurav Kumar --- .github/workflows/build-and-test.yaml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 6863c0a5..f1a08859 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -1,28 +1,41 @@ name: Build and Test -on: [push] +# Trigger the action on push and pull requests +on: + push: + pull_request: jobs: build: - runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.21', '1.22' , '1.23' ] + go-version: ['1.21', '1.22', '1.23'] steps: - uses: actions/checkout@v4 - name: Set up Go ${{ matrix.go-version }} uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} + - name: Display Go version run: go version + - name: Install dependencies run: go mod download + + # Add CGO_CFLAGS environment variable to suppress the warning - name: Build run: go build -v ./... + env: + CGO_CFLAGS: "-Wno-return-local-addr" + + # Run tests with CGO_CFLAGS set - name: Test with the Go CLI run: go test $(go list ./...) -cover -json > TestResults-${{ matrix.go-version }}.json + env: + CGO_CFLAGS: "-Wno-return-local-addr" + - name: Upload Go test results uses: actions/upload-artifact@v4 with: