Skip to content

Commit

Permalink
Adding CGO flags to supress warnings and fix build failures (uber#364)
Browse files Browse the repository at this point in the history
Co-authored-by: Gaurav Kumar <gauravk@uber.com>
  • Loading branch information
gkeesh7 and gauravkuber authored Sep 24, 2024
1 parent 9863428 commit 7ebe432
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 7ebe432

Please sign in to comment.