Skip to content

Commit 7499df0

Browse files
committed
workflows: add LDFLAGS/CFLAGS env into workflows.
Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
1 parent 6883e03 commit 7499df0

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

.github/workflows/go-c-cpp.yml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Compilers
1818
run: |
1919
sudo apt-get update
20-
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic
20+
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic gcc
2121
for tool in "clang" "llc" "llvm-strip"
2222
do
2323
sudo rm -f /usr/bin/$tool
@@ -28,35 +28,18 @@ jobs:
2828
with:
2929
submodules: 'recursive'
3030
fetch-depth: 0
31-
- name: Build
31+
- name: Build && golangci-lint
3232
run: |
3333
make clean
3434
make env
3535
make nocore -j4
36-
- name: golangci-lint
37-
uses: golangci/golangci-lint-action@v4
38-
with:
39-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
40-
# version: v3.2.0
41-
42-
# Optional: working directory, useful for monorepos
43-
# working-directory: somedir
44-
45-
# Optional: golangci-lint command line arguments.
46-
args: --disable-all -E errcheck
47-
48-
# Optional: show only new issues if it's a pull request. The default value is `false`.
49-
# only-new-issues: true
50-
51-
# Optional: if set to true then the all caching functionality will be complete disabled,
52-
# takes precedence over all other caching options.
53-
skip-cache: true
54-
55-
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
56-
skip-pkg-cache: true
57-
58-
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
59-
skip-build-cache: true
36+
CGO_CFLAGS="-O2 -g -gdwarf-4 -I$GITHUB_WORKSPACE/lib/libpcap/"
37+
CGO_LDFLAGS="-O2 -g -L$GITHUB_WORKSPACE/lib/libpcap -lpcap -static"
38+
echo $CGO_CFLAGS
39+
echo $CGO_LDFLAGS
40+
echo $CC
41+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
42+
$(go env GOPATH)/bin/golangci-lint run --disable-all -E errcheck
6043
- name: Build NOCORE
6144
run: |
6245
make clean
@@ -75,7 +58,7 @@ jobs:
7558
- name: Install Compilers
7659
run: |
7760
sudo apt-get update
78-
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic
61+
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic gcc
7962
for tool in "clang" "llc" "llvm-strip"
8063
do
8164
sudo rm -f /usr/bin/$tool
@@ -93,6 +76,10 @@ jobs:
9376
make -j8
9477
- name: golangci-lint
9578
uses: golangci/golangci-lint-action@v4
79+
env:
80+
CGO_CFLAGS: -O2 -g -gdwarf-4 -I$GITHUB_WORKSPACE/lib/libpcap/
81+
CGO_LDFLAGS: -O2 -g -L$GITHUB_WORKSPACE/lib/libpcap/ -lpcap -static
82+
CC: /usr/bin/clang
9683
with:
9784
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
9885
# version: v3.2.0

0 commit comments

Comments
 (0)