Skip to content

Commit

Permalink
workflows: add LDFLAGS/CFLAGS env into workflows.
Browse files Browse the repository at this point in the history
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Feb 25, 2024
1 parent 6883e03 commit 3d389fc
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions .github/workflows/go-c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ jobs:
build-on-ubuntu2004:
runs-on: ubuntu-20.04
name: build on ubuntu-20.04 x86_64
env:
CGO_CFLAGS: -O2 -g -gdwarf-4 -I$GITHUB_WORKSPACE/lib/libpcap/
CGO_LDFLAGS: -O2 -g -L$GITHUB_WORKSPACE/lib/libpcap/ -lpcap -static
CC: /usr/bin/clang
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.21.0'
- name: Install Compilers
run: |
sudo apt-get update
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic gcc
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
Expand All @@ -28,35 +32,14 @@ jobs:
with:
submodules: 'recursive'
fetch-depth: 0
- name: Build
- name: Build && golangci-lint
run: |
make clean
make env
make nocore -j4
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v3.2.0

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --disable-all -E errcheck

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
cd lib/libpcap/ && sudo make install
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
$(go env GOPATH)/bin/golangci-lint run --disable-all -E errcheck
- name: Build NOCORE
run: |
make clean
Expand All @@ -75,7 +58,7 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic gcc
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
Expand All @@ -93,6 +76,10 @@ jobs:
make -j8
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
env:
CGO_CFLAGS: -O2 -g -gdwarf-4 -I$GITHUB_WORKSPACE/lib/libpcap/
CGO_LDFLAGS: -O2 -g -L$GITHUB_WORKSPACE/lib/libpcap/ -lpcap -static
CC: /usr/bin/clang
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v3.2.0
Expand Down

0 comments on commit 3d389fc

Please sign in to comment.