Skip to content

Commit

Permalink
Merge pull request #3 from Andreagit97/tmp_fd_support
Browse files Browse the repository at this point in the history
new: support eBPF iterators on file descriptors
  • Loading branch information
Andreagit97 committed Jul 14, 2024
2 parents e2c3b6a + 0849d8e commit cecfc62
Show file tree
Hide file tree
Showing 62 changed files with 2,191 additions and 1,717 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Exclude vmlinux from github stats
pkg/task/bpf/vmlinux.h linguist-vendored
pkg/iterators/bpf/vmlinux.h linguist-vendored
16 changes: 16 additions & 0 deletions .github/actions/setup-env/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Setup Environment"
description: "Installs dependencies and go code"
runs:
using: "composite"
steps:
- name: Install deps
shell: bash
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev libbpf-dev
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
check-latest: true
51 changes: 24 additions & 27 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
name: Build and test

on:
pull_request:
push:
branches:
- main

jobs:

build_and_test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Install deps
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev
git clone https://github.com/libbpf/libbpf.git --branch v1.2.0 --single-branch
pushd libbpf/src
sudo make install
popd
sudo rm -rf ./libbpf
# The composite action `Setup Environment` is local so we need to checkout before calling it
- name: Checkout commit
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'
check-latest: true
- name: Setup Environment
uses: ./.github/actions/setup-env

- name: Build
run: |
Expand All @@ -40,30 +25,42 @@ jobs:
- name: Run tests
run: |
sudo -E env "PATH=$PATH" go test ./... -count=1
# use goreleaser to build all supported archs
upload_dev_artifacts:
needs: build_and_test
runs-on: ubuntu-24.04
steps:
- name: Checkout commit
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Environment
uses: ./.github/actions/setup-env

# use goreleaser to build all supported archs
- name: Build all supported archs
id: run-goreleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
with:
distribution: goreleaser
version: latest
args: release --snapshot --clean

- name: Archive x86_64 tar.gz
uses: actions/upload-artifact@v3
with:
name: x86_64
path: ./dist/bpftree_Linux_x86_64.tar.gz
path: ./dist/bpftree_Linux_x86_64.tar.gz

- name: Archive arm64 tar.gz
uses: actions/upload-artifact@v3
with:
name: arm64
path: ./dist/bpftree_Linux_arm64.tar.gz
path: ./dist/bpftree_Linux_arm64.tar.gz

- name: Archive s390x tar.gz
uses: actions/upload-artifact@v3
with:
name: s390x
path: ./dist/bpftree_Linux_s390x.tar.gz
path: ./dist/bpftree_Linux_s390x.tar.gz
44 changes: 12 additions & 32 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,17 @@ on:
- main

jobs:

golangci:
name: Lint golang files
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Install deps
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev
git clone https://github.com/libbpf/libbpf.git --branch v1.2.0 --single-branch
pushd libbpf/src
sudo make install
popd
sudo rm -rf ./libbpf
- name: Checkout commit
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'
check-latest: true
- name: Setup Environment
uses: ./.github/actions/setup-env

- name: Build
run: |
Expand All @@ -39,29 +25,23 @@ jobs:
go clean -modcache
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
only-new-issues: false
version: v1.53.3
version: v1.59
args: --timeout=900s

gomodtidy:
name: Enforce go.mod tidiness
runs-on: ubuntu-22.04

runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Checkout commit
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: "${{ github.event.pull_request.head.sha }}"
repository: ${{github.event.pull_request.head.repo.full_name}}
persist-credentials: false
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'
check-latest: true
- name: Setup Environment
uses: ./.github/actions/setup-env

- name: Execute go mod tidy and check the outcome
working-directory: ./
Expand Down
29 changes: 8 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,28 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build-all-archs:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
contents: write # To add assets to a release.
steps:
- name: Install deps
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends build-essential git clang llvm libelf-dev
git clone https://github.com/libbpf/libbpf.git --branch v1.2.0 --single-branch
pushd libbpf/src
sudo make install
popd
sudo rm -rf ./libbpf
- name: Checkout
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Checkout commit
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Environment
uses: ./.github/actions/setup-env

- name: Fetch all tags
run: git fetch --force --tags

- name: Setup Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: '1.20'
check-latest: true

- name: Run GoReleaser
id: run-goreleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
with:
distribution: goreleaser
version: latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ bpftree
dist/
testdata/output/script*
temp.*
pkg/task/iter_bpf*
pkg/iterators/iter_bpf*
# dumped files
*.tree
# generated by golangci-lint
report.xml
Loading

0 comments on commit cecfc62

Please sign in to comment.