Skip to content

Commit

Permalink
Isolate dependencies using devbox
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Jan 3, 2024
1 parent cc610f1 commit 49f92bf
Show file tree
Hide file tree
Showing 47 changed files with 981 additions and 441 deletions.
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM jetpackio/devbox:latest

# Installing your devbox project
WORKDIR /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock

COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} ../install-tools.sh .

RUN devbox run -- echo "All the packages are installed."

RUN devbox shellenv --init-hook >> ~/.profile
ENTRYPOINT [ "devbox", "shell"]
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Devbox Remote Container",
"build": {
"dockerfile": "./Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"jetpack-io.devbox"
]
}
},
"remoteUser": "devbox"
}
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
*.md
.devbox
.devcontainer
.git
.idea
.vscode
*.md
/.github
/data
/dist
/images
/out
/tmp
3rdparty/btfhub*
debug
Dockerfile*
debug
target
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ yarn.lock
Dockerfile*
.github/workflows/*
scripts/*
env.sh
*.sh
73 changes: 37 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
# renovate: datasource=go depName=github.com/florianl/bluebox
BLUEBOX_VERSION: v0.0.1

jobs:
skip-check:
name: Skip check
Expand All @@ -38,13 +34,12 @@ jobs:
[
"**.go",
".github/workflows/build.yml",
".go-version",
"3rdparty",
"Makefile",
"bpf/**",
"go.mod",
"go.sum",
"kerneltest/**",
"test/kernel/**",
"testdata/**"
]
skip_after_successful_duplicate: false
Expand All @@ -58,21 +53,25 @@ jobs:
- name: Check out the code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- name: Install devbox
uses: jetpack-io/devbox-install-action@v0.7.0
with:
go-version-file: .go-version
enable-cache: true

- name: Setup devbox
run: |
devbox run -- echo "done!"
devbox shellenv --init-hook >> ~/.profile
devbox shellenv --init-hook >> ~/.bashrc
- name: Set up Clang
uses: KyleMayes/install-llvm-action@be40c5af3a4adc3e4a03199995ab73aa37536712 # v1.9.0
- uses: HatsuneMiku3939/direnv-action@v1
with:
version: "14"
direnvVersion: 2.32.3

- name: Install dependencies
- name: Install QEMU
run: |
sudo apt-get update -y
sudo apt -y install qemu-system-x86 curl
sudo apt-get install -yq libelf-dev zlib1g-dev
- name: Initialize and update git submodules
run: git submodule init && git submodule update
Expand All @@ -81,12 +80,10 @@ jobs:
run: make libbpf

- name: Build initramfs
run: |
go install "github.com/florianl/bluebox@${BLUEBOX_VERSION}"
make initramfs
run: make initramfs

- name: Run vmtests
run: ./kerneltest/vmtest.sh
run: ./test/kernel/vmtest.sh

go-build-test:
name: Go Build
Expand All @@ -97,40 +94,44 @@ jobs:
- name: Check out the code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- name: Install devbox
uses: jetpack-io/devbox-install-action@v0.7.0
with:
go-version-file: .go-version

# Installs gofumpt, golangci-lint, and govulncheck.
- name: Set up environment
run: ./env.sh
enable-cache: true

- name: Set up Clang
uses: KyleMayes/install-llvm-action@be40c5af3a4adc3e4a03199995ab73aa37536712 # v1.9.0
- name: Set up Go tool cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: |
~/.devbox/go
key: devbox-go-tools.cache-${{ runner.arch }}-${{ hashFiles('install-tools.sh') }}
restore-keys: |
devbox-go-tools.cache-${{ runner.arch }}
devbox-go-tools.cache-
- name: Setup devbox
run: devbox run -- echo "done!"

- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
version: "14"
direnvVersion: 2.32.3

- name: clang version
run: |
clang -v
ld --version
ld.lld --version
- name: Install clang-format
run: sudo apt-get install clang-format

- name: Show clang-format version
run: clang-format --version

- name: Install libbpf dependencies
run: |
sudo apt-get update -y
sudo apt-get install -yq libelf-dev zlib1g-dev
- name: Initialize and update git submodules
run: git submodule init && git submodule update

- name: Go ENV
run: go env

- name: Install Go dependencies
run: make go/deps

Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,30 @@ jobs:
- name: Check out the code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
- name: Install devbox
uses: jetpack-io/devbox-install-action@v0.7.0
with:
go-version-file: .go-version
enable-cache: true

- name: Set up Clang
uses: KyleMayes/install-llvm-action@be40c5af3a4adc3e4a03199995ab73aa37536712 # v1.9.0
- name: Set up Go tool cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
version: "14"

- name: Install libbpf dependencies
run: |
sudo apt-get update -y
sudo apt-get install -yq libelf-dev zlib1g-dev
path: |
~/.devbox/go
key: devbox-go-tools.cache-${{ runner.arch }}-${{ hashFiles('install-tools.sh') }}
restore-keys: |
devbox-go-tools.cache-${{ runner.arch }}
devbox-go-tools.cache-
- name: Setup devbox
run: devbox run -- echo "done!"

- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3

- name: Initialize and update libbpf submodule
- name: Initialize and update submodules
run: git submodule init && git submodule update

- name: Build BPF
Expand All @@ -88,9 +96,6 @@ jobs:
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

- name: Set up environment
run: ./env.sh

- run: make build

- name: Perform CodeQL Analysis
Expand Down
Loading

0 comments on commit 49f92bf

Please sign in to comment.