Skip to content

Commit 3998f77

Browse files
authored
feat(ci): update GitHub Action runners with Linux arm64 host (#722)
1 parent 329aebe commit 3998f77

File tree

1 file changed

+49
-102
lines changed

1 file changed

+49
-102
lines changed

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

Lines changed: 49 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -110,114 +110,61 @@ jobs:
110110
run: go test -v -race ./...
111111

112112
build-on-ubuntu2204-arm64:
113-
runs-on: ubuntu-22.04
113+
runs-on: ubuntu-22.04-arm
114114
name: build on ubuntu-22.04 arm64
115-
# Run steps on a matrix of 3 arch/distro combinations
116-
strategy:
117-
matrix:
118-
include:
119-
- arch: aarch64
120-
distro: ubuntu22.04
121115
steps:
116+
- uses: actions/setup-go@v5
117+
with:
118+
go-version: '1.22.10'
119+
- name: Install Compilers
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 flex bison linux-tools-common linux-tools-generic gcc gcc-x86-64-linux-gnu libssl-dev linux-source
123+
for tool in "clang" "llc" "llvm-strip"
124+
do
125+
sudo rm -f /usr/bin/$tool
126+
sudo ln -s /usr/bin/$tool-14 /usr/bin/$tool
127+
done
128+
cd /usr/src
129+
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
130+
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
131+
sudo tar -xf $source_file
132+
cd $source_dir
133+
test -f .config || sudo make oldconfig
134+
sudo make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- prepare V=0 > /dev/null
135+
ls -al /usr/src/$source_dir
136+
shell: bash
122137
- uses: actions/checkout@v4
123138
with:
124139
submodules: 'recursive'
125140
fetch-depth: 0
126-
set-safe-directory: '/source_code'
127-
- name: Branch Name
141+
- name: Build CO-RE
128142
run: |
129-
echo running on branch ${{ github.ref_name }}
130-
echo checkout directory ${GITHUB_WORKSPACE}
131-
echo PWD directory ${PWD}
132-
- name: Write File
133-
uses: DamianReeves/write-file-action@v1.2
134-
with:
135-
path: ./bin/release_notes.txt
136-
contents: |
137-
"just for CI"
138-
write-mode: append
139-
- uses: uraimo/run-on-arch-action@v2
140-
name: Build artifact
141-
id: build
143+
make clean
144+
make env
145+
DEBUG=1 make -j8
146+
cd ./lib/libpcap/ && sudo make install
147+
cd $GITHUB_WORKSPACE
148+
- name: golangci-lint
149+
uses: golangci/golangci-lint-action@v6
142150
with:
143-
arch: ${{ matrix.arch }}
144-
distro: ${{ matrix.distro }}
145-
146-
# Not required, but speeds up builds
147-
githubToken: ${{ github.token }}
148-
149-
# Create an artifacts directory
150-
setup: |
151-
mkdir -p "${PWD}/artifacts"
152-
153-
# Mount the artifacts directory as /artifacts in the container
154-
dockerRunArgs: |
155-
--volume "${PWD}/artifacts:/artifacts"
156-
--volume "${GITHUB_WORKSPACE}:/source_code"
157-
158-
# Pass some environment variables to the container
159-
env: | # YAML, but pipe character is necessary
160-
artifact_name: ecapture-${{ github.ref_name }}
161-
162-
# The shell to run commands with in the container
163-
shell: /bin/sh
164-
165-
# Install some dependencies in the container. This speeds up builds if
166-
# you are also using githubToken. Any dependencies installed here will
167-
# be part of the container image that gets cached, so subsequent
168-
# builds don't have to re-install them. The image layer is cached
169-
# publicly in your project's package repository, so it is vital that
170-
# no secrets are present in the container state or logs.
171-
install: |
172-
uname -a
173-
apt-get update
174-
apt-get install --yes wget git build-essential pkgconf libelf-dev llvm-12 clang-12 linux-tools-generic linux-tools-common flex bison file gcc-x86-64-linux-gnu libssl-dev bc linux-source
175-
wget https://go.dev/dl/go1.22.10.linux-arm64.tar.gz
176-
rm -rf /usr/local/go
177-
tar -C /usr/local -xzf go1.22.10.linux-arm64.tar.gz
178-
cd /usr/src
179-
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
180-
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
181-
tar -xf $source_file
182-
cd $source_dir
183-
test -f .config || make oldconfig > /dev/null
184-
make ARCH=x86 CROSS_COMPILE=x86_64-linux-gnu- prepare V=0 > /dev/null
185-
make prepare V=0 > /dev/null
186-
ls -al /usr/src/$source_dir
187-
# Produce a binary artifact and place it in the mounted volume
188-
run: |
189-
uname -a
190-
date
191-
export PATH=/usr/local/go/bin:$PATH:/usr/local/bin
192-
echo $PATH
193-
for tool in "clang" "llc" "llvm-strip"
194-
do
195-
rm -f /usr/bin/$tool
196-
ln -s /usr/bin/$tool-12 /usr/bin/$tool
197-
done
198-
clang --version
199-
which bpftool
200-
echo "cat /proc/1/cgroup:"
201-
cat /proc/1/cgroup
202-
echo "cat /proc/1/sched:"
203-
cat /proc/1/sched
204-
cd /usr/src
205-
source_file=$(find . -maxdepth 1 -name "*linux-source*.tar.bz2")
206-
source_dir=$(echo "$source_file" | sed 's/\.tar\.bz2//g')
207-
git config --global --add safe.directory /source_code
208-
cd /source_code
209-
echo "-------------------start: Build CO-RE Linux (include non-CO-RE)-------------------"
210-
KERN_HEADERS=/usr/src/$source_dir make env
211-
make clean
212-
KERN_HEADERS=/usr/src/$source_dir make
213-
bin/ecapture -v
214-
echo "-------------------start: Build non-CO-RE (Cross-Compilation) Linux -------------------"
215-
make clean
216-
KERN_HEADERS=/usr/src/$source_dir CROSS_ARCH=amd64 make env
217-
KERN_HEADERS=/usr/src/$source_dir CROSS_ARCH=amd64 make nocore -j8
218-
file bin/ecapture
219-
- name: Show the artifact
220-
# Items placed in /artifacts in the container will be in
221-
# ${PWD}/artifacts on the host.
151+
args: --disable-all -E errcheck -E staticcheck
152+
skip-cache: true
153+
problem-matchers: true
154+
- name: Build non-CO-RE
155+
run: |
156+
make clean
157+
make env
158+
make nocore
159+
- name: Build CO-RE (Cross-Compilation)
222160
run: |
223-
ls -al "${PWD}/artifacts"
161+
make clean
162+
CROSS_ARCH=amd64 make env
163+
CROSS_ARCH=amd64 make -j8
164+
- name: Build non-CO-RE (Cross-Compilation/Android)
165+
run: |
166+
make clean
167+
CROSS_ARCH=amd64 make env
168+
ANDROID=1 CROSS_ARCH=amd64 make nocore -j8
169+
- name: Test
170+
run: go test -v -race ./...

0 commit comments

Comments
 (0)