Skip to content

Commit 67dc072

Browse files
committed
build: behold the power of Nix
1 parent b0cd1e0 commit 67dc072

5,779 files changed

Lines changed: 1780988 additions & 778 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ on:
1111
- release-*
1212

1313
env:
14-
# renovate: datasource=go depName=mvdan.cc/gofumpt
15-
GOFUMPT_VERSION: v0.4.0
16-
# renovate: datasource=go depName=github.com/golangci/golangci-lint
17-
GOLANGCI_LINT_VERSION: v1.51.2
1814
# renovate: datasource=go depName=github.com/florianl/bluebox
1915
BLUEBOX_VERSION: v0.0.1
16+
# renovate: datasource=github-tags depName=NixOS/nix
17+
NIX_VERSION: 2.13.2
2018

2119
jobs:
2220
skip-check:
@@ -36,14 +34,16 @@ jobs:
3634
paths: |-
3735
[
3836
"**.go",
37+
"**.nix",
3938
".github/workflows/build.yml",
4039
".go-version",
41-
"3rdparty",
4240
"Makefile",
4341
"bpf/**",
42+
"flake.lock",
4443
"go.mod",
4544
"go.sum",
46-
"kerneltest/**"
45+
"kerneltest/**",
46+
"VERSION"
4747
]
4848
skip_after_successful_duplicate: false
4949

@@ -55,49 +55,36 @@ jobs:
5555
steps:
5656
- name: Check out the code
5757
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
58+
with:
59+
submodules: true
5860

59-
- name: Set up Go
60-
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
61+
- name: Set up Nix
62+
uses: cachix/install-nix-action@5c11eae19dba042788936d4f1c9685fdd814ac49 # v19
6163
with:
62-
go-version-file: .go-version
63-
cache: true
64+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
65+
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install
6466

65-
- name: Set up Clang
66-
uses: KyleMayes/install-llvm-action@ef175530927af66c61e4e8da4fea4e15de63f780 # v1.7.0
67+
- name: Set up Cachix
68+
uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v12
6769
with:
68-
version: "14"
70+
name: parca-agent
71+
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
72+
73+
- name: Set up DevShell
74+
run: nix develop --command true
6975

7076
- name: clang version
77+
shell: nix develop --command bash -e {0}
7178
run: |
7279
clang -v
7380
ld --version
74-
ld.lld --version
75-
76-
- name: Set up gofumpt
77-
run: go install "mvdan.cc/gofumpt@${GOFUMPT_VERSION}"
78-
79-
- name: Install clang-format
80-
run: sudo apt-get install clang-format
8181
8282
- name: Show clang-format version
83+
shell: nix develop --command bash -e {0}
8384
run: clang-format --version
8485

85-
- name: Install libbpf dependencies
86-
run: |
87-
sudo apt-get update -y
88-
sudo apt-get install -yq libelf-dev zlib1g-dev
89-
90-
- name: Initialize and update git submodules
91-
run: git submodule init && git submodule update
92-
93-
- name: Build libbpf
94-
run: make libbpf
95-
96-
- name: Build BPF
97-
run: make bpf
98-
9986
- name: Build
100-
run: make build
87+
run: nix build --print-build-logs --print-out-paths
10188

10289
- name: Show kernel version
10390
run: uname -a
@@ -110,25 +97,22 @@ jobs:
11097
echo $PATH
11198
11299
- name: Test
113-
# Some of the GH action CI machines have several versions of Go installed.
114-
# Make sometimes somehow resolves different Go. We need to specify explicitly.
100+
shell: nix develop --command bash -e {0}
115101
run: make GO=`which go` test ENABLE_RACE=yes
116102

117103
- name: Test unwind tables
104+
shell: nix develop --command bash -e {0}
118105
run: make test-dwarf-unwind-tables
119106

120107
- name: Format
108+
shell: nix develop --command bash -e {0}
121109
run: make format-check
122110

123-
- name: Install golangci-lint
124-
run: go install "github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}"
125-
126-
- name: Lint
127-
run: make go/lint
128-
129111
- name: Build initramfs
112+
shell: nix develop --command bash -e {0}
130113
run: |
131114
go install "github.com/florianl/bluebox@${BLUEBOX_VERSION}"
115+
export PATH="$(go env GOPATH)/bin:${PATH}"
132116
make initramfs
133117
134118
- name: Upload initramfs

.github/workflows/codeql-analysis.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
schedule:
2424
- cron: '28 16 * * 3'
2525

26+
env:
27+
# renovate: datasource=github-tags depName=NixOS/nix
28+
NIX_VERSION: 2.13.2
29+
2630
jobs:
2731
analyze:
2832
name: Analyze
@@ -44,26 +48,29 @@ jobs:
4448
- name: Check out the code
4549
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
4650

47-
- name: Set up Go
48-
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
51+
- name: Set up Nix
52+
uses: cachix/install-nix-action@5c11eae19dba042788936d4f1c9685fdd814ac49 # v19
4953
with:
50-
go-version-file: .go-version
51-
cache: true
54+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
55+
install_url: https://releases.nixos.org/nix/nix-${{ env.NIX_VERSION }}/install
5256

53-
- name: Set up Clang
54-
uses: KyleMayes/install-llvm-action@ef175530927af66c61e4e8da4fea4e15de63f780 # v1.7.0
57+
- name: Set up Cachix
58+
uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # v12
5559
with:
56-
version: "14"
60+
name: parca-agent
61+
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
5762

58-
- name: Install libbpf dependencies
59-
run: |
60-
sudo apt-get update -y
61-
sudo apt-get install -yq libelf-dev zlib1g-dev
63+
- name: Set up DevShell
64+
run: nix develop --command true
6265

63-
- name: Initialize and update libbpf submodule
64-
run: git submodule init && git submodule update
66+
- name: Set up Go
67+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
68+
with:
69+
go-version-file: .go-version
70+
cache: true
6571

6672
- name: Build BPF
73+
shell: nix develop --command bash -e {0}
6774
run: make bpf
6875

6976
# Initializes the CodeQL tools for scanning.
@@ -84,7 +91,9 @@ jobs:
8491
# ℹ️ Command-line programs to run using the OS shell.
8592
# 📚 https://git.io/JvXDl
8693

87-
- run: make build
94+
- name: Build
95+
shell: nix develop --command bash -e {0}
96+
run: make build
8897

8998
- name: Perform CodeQL Analysis
9099
uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2.2.5

0 commit comments

Comments
 (0)