Skip to content

Commit 851f0bd

Browse files
authored
Install dependencies in release.yaml (#3)
* Install dependencies in release.yaml * Use matrix * Use wildcard for file names instead of hardcoding them * Enable ARM builds * Use version specified by the actions job
1 parent fd90884 commit 851f0bd

File tree

3 files changed

+25
-31
lines changed

3 files changed

+25
-31
lines changed

.github/workflows/pr-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
include:
4444
- arch: x86_64
4545
runner: ubuntu-22.04
46-
# - arch: aarch64
47-
# runner: ARM64-CMX
46+
- arch: aarch64
47+
runner: ubuntu-22.04-arm
4848

4949
steps:
5050
- name: Checkout code

.github/workflows/release.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,38 @@ on:
66
- "v*"
77

88
jobs:
9-
build-x86_64:
10-
runs-on: ubuntu-22.04
11-
steps:
12-
- uses: actions/checkout@v4
13-
- run: git config --global --add safe.directory $(pwd) # Workaround for fatal: detected dubious ownership in repository at '/__w/reliability-matrix/reliability-matrix'
14-
- name: Set up Go
15-
uses: actions/setup-go@v4
16-
with:
17-
go-version-file: go.mod
18-
- run: make generate build VERSION=${{ github.ref_name }}
19-
- run: mv ./pktstat-bpf ./pktstat-bpf-x86_64
20-
- name: Upload x86_64 binary
21-
uses: actions/upload-artifact@v4
22-
with:
23-
name: pktstat-bpf-x86_64
24-
path: ./pktstat-bpf-x86_64
25-
26-
build-aarch64:
27-
runs-on: ARM64-CMX
9+
build:
10+
strategy:
11+
matrix:
12+
include:
13+
- arch: x86_64
14+
runner: ubuntu-22.04
15+
- arch: aarch64
16+
runner: ubuntu-22.04-arm
17+
runs-on: ${{ matrix.runner }}
2818
steps:
2919
- uses: actions/checkout@v4
3020
- run: git config --global --add safe.directory $(pwd) # Workaround for fatal: detected dubious ownership in repository at '/__w/reliability-matrix/reliability-matrix'
3121
- name: Set up Go
3222
uses: actions/setup-go@v4
3323
with:
3424
go-version-file: go.mod
25+
- name: Install dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y clang llvm libbpf-dev
3529
- run: make generate build VERSION=${{ github.ref_name }}
36-
- run: mv ./pktstat-bpf ./pktstat-bpf-aarch64
37-
- name: Upload aarch64 binary
30+
- run: mv ./pktstat-bpf ./pktstat-bpf-${{ matrix.arch }}
31+
- name: Upload ${{ matrix.arch }} binary
3832
uses: actions/upload-artifact@v4
3933
with:
40-
name: pktstat-bpf-aarch64
41-
path: ./pktstat-bpf-aarch64
34+
name: pktstat-bpf-${{ matrix.arch }}
35+
path: ./pktstat-bpf-${{ matrix.arch }}
4236

4337
create-release:
4438
runs-on: ubuntu-22.04
4539
needs:
46-
- build-x86_64
47-
- build-aarch64
40+
- build
4841
steps:
4942
- uses: actions/checkout@v4
5043
- name: Download x86_64 binary
@@ -58,6 +51,7 @@ jobs:
5851
name: pktstat-bpf-aarch64
5952
path: ./bin
6053
- name: Create GitHub Release
61-
run: gh release create ${{ github.ref_name }} ./bin/pktstat-bpf-x86_64 ./bin/pktstat-bpf-aarch64 --generate-notes
54+
run: |
55+
gh release create ${{ github.ref_name }} ./bin/pktstat-bpf-* --generate-notes
6256
env:
6357
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Variables
22
TARGET := pktstat-bpf
3-
GIT_LAST_TAG := $(shell git describe --abbrev=0 --tags 2>/dev/null || echo latest)
3+
VERSION ?= $(shell git describe --abbrev=0 --tags 2>/dev/null || echo latest)
44
GIT_HEAD_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
5-
GIT_TAG_COMMIT := $(shell git rev-parse --short $(GIT_LAST_TAG) 2>/dev/null || echo unknown)
5+
GIT_TAG_COMMIT := $(shell git rev-parse --short $(VERSION) 2>/dev/null || echo unknown)
66
GIT_MODIFIED1 := $(shell git diff $(GIT_HEAD_COMMIT) $(GIT_TAG_COMMIT) --quiet 2>/dev/null || echo .dev)
77
GIT_MODIFIED2 := $(shell git diff --quiet 2>/dev/null || echo .dirty)
88
GIT_MODIFIED := $(GIT_MODIFIED1)$(GIT_MODIFIED2)
@@ -18,4 +18,4 @@ generate:
1818
go generate
1919

2020
build:
21-
go build -trimpath -pgo=auto -ldflags="-s -w -X main.GitTag=$(GIT_LAST_TAG) -X main.GitCommit=$(GIT_HEAD_COMMIT) -X main.GitDirty=$(GIT_MODIFIED) -X main.BuildTime=$(BUILD_DATE)" -o $(TARGET)
21+
go build -trimpath -pgo=auto -ldflags="-s -w -X main.GitTag=$(VERSION) -X main.GitCommit=$(GIT_HEAD_COMMIT) -X main.GitDirty=$(GIT_MODIFIED) -X main.BuildTime=$(BUILD_DATE)" -o $(TARGET)

0 commit comments

Comments
 (0)