build(deps): bump docker/metadata-action from 5.0.0 to 5.3.0 #132
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check-license: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check License Header | |
uses: apache/skywalking-eyes@a790ab8dd23a7f861c18bd6aaa9b012e3a234bce | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qy \ | |
git \ | |
clang \ | |
llvm \ | |
protobuf-compiler \ | |
cmake \ | |
perl \ | |
libssl-dev \ | |
gcc-multilib \ | |
libelf-dev \ | |
musl-tools | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: libbpf/libbpf | |
path: libbpf | |
fetch-depth: 0 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt, clippy, rust-src | |
override: false | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: taplo-cli | |
- run: taplo fmt --check | |
- name: yaml-lint | |
run: yamllint -c .yamllint.yaml --strict . | |
- name: Check C formatting | |
run: git ls-files -- '*.c' '*.h' | xargs clang-format --dry-run --Werror | |
- name: Build eBPF | |
run: | | |
cargo xtask build-ebpf --libbpf-dir ./libbpf | |
- name: Check formatting | |
run: | | |
cargo +nightly fmt --all -- --check | |
- name: Run clippy | |
run: | | |
cargo +nightly clippy --all -- --deny warnings | |
- name: Build | |
run: cargo build --verbose | |
## If the push is a tag....build and upload the release bpfman binaries to an archive | |
- name: Build-Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
rustup target add x86_64-unknown-linux-musl | |
cargo build --release --target x86_64-unknown-linux-musl | |
- name: Package-Binaries | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
tar -czvf bpfman-linux-x86_64.tar.gz ./target/x86_64-unknown-linux-musl/release/bpfman | |
- name: Archive bpfman Release Binaries | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bpfman-release | |
path: | | |
./bpfman-linux-x86_64.tar.gz | |
- name: Run tests | |
run: cargo llvm-cov test --all-features -p bpfman -p bpfman-api --lcov --output-path lcov.info | |
env: | |
RUST_BACKTRACE: full | |
- name: Archive Rust code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: lcov.info | |
if-no-files-found: error | |
## Build go modules | |
build-go: | |
runs-on: ubuntu-latest | |
# k8s codegen requires this to be set | |
env: | |
GOPATH: ${{ github.workspace }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Go mod check | |
working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman | |
run: | | |
go mod tidy | |
git diff --exit-code go.mod go.sum | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Keep this version synced with /bpfman/scripts/verify-golint.sh | |
working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman | |
version: v1.54.2 | |
skip-cache: true | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: -v --timeout 5m --enable=gofmt | |
- name: Build Examples | |
working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman/examples | |
run: | | |
go build ./... | |
- name: Build Operator | |
working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman/bpfman-operator | |
run: make build | |
# FIXME: This is currently failing due to a GOPATH weirdness | |
# - name: Verify Operator | |
# working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman/bpfman-operator | |
# run: make verify | |
- name: Run Tests | |
working-directory: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman/bpfman-operator | |
run: make test | |
- name: Archive Go code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ${{ env.GOPATH }}/src/github.com/bpfman/bpfman/bpfman-operator/cover.out | |
if-no-files-found: error | |
basic-integration-tests: | |
runs-on: ubuntu-latest | |
needs: ["build", "build-go"] | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qy \ | |
git \ | |
clang \ | |
llvm \ | |
protobuf-compiler \ | |
cmake \ | |
perl \ | |
libssl-dev \ | |
gcc-multilib \ | |
libelf-dev | |
- uses: actions/checkout@v4 | |
with: | |
repository: libbpf/libbpf | |
path: libbpf | |
fetch-depth: 0 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rust-src | |
override: true | |
- name: Build eBPF | |
run: cargo xtask build-ebpf --libbpf-dir ./libbpf | |
- name: Build bpfman | |
run: cargo build --verbose | |
- name: Run the bpfman installer | |
run: sudo ./scripts/setup.sh install | |
- name: Give certs time to be created | |
run: sleep 5 | |
- name: Verify the bpfman systemd service is active | |
run: systemctl is-active bpfman | |
- name: Verify the CLI can reach bpfman | |
run: sudo bpfman list | |
- name: Stop the bpfman systemd service | |
run: sudo systemctl stop bpfman | |
- name: Run integration tests | |
run: cargo xtask integration-test | |
kubernetes-integration-tests: | |
needs: ["build", "build-go"] | |
runs-on: ubuntu-latest | |
env: | |
BPFMAN_IMG: "quay.io/bpfman/bpfman:int-test" | |
BPFMAN_AGENT_IMG: "quay.io/bpfman/bpfman-agent:int-test" | |
BPFMAN_OPERATOR_IMG: "quay.io/bpfman/bpfman-operator:int-test" | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qy \ | |
git \ | |
clang \ | |
llvm \ | |
gcc-multilib \ | |
libbpf-dev | |
- name: setup golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "^1.19" | |
- name: cache go modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-build-codegen- | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
## TODO(astoycos) Currently this is just done to ensure we have coverage | |
## on all image builds. Ultimately we should be running the integration | |
## tests with these locally built bytecode images. | |
- name: build example bytecode images | |
run: | | |
go install github.com/cilium/ebpf/cmd/bpf2go@v0.11.0 | |
cd examples | |
make build-bc-images | |
- name: build example userspace images | |
run: cd examples && make build-us-images | |
- name: build images | |
run: cd bpfman-operator && make build-images | |
- name: run integration tests | |
run: cd bpfman-operator && make test-integration | |
## Upload diagnostics if integration test step failed. | |
- name: upload diagnostics | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kubernetes-integration-test-diag | |
path: /tmp/ktf-diag* | |
if-no-files-found: ignore | |
coverage: | |
needs: ["build", "build-go"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
files: ./cover.out,./lcov.info | |
verbose: true | |
# Creates Release | |
# Copies built bpfman binaries to release artifacts | |
# Publish's bpfman and bpfman-api crates to crates.io | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: ["build"] | |
environment: crates.io | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set env | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v3 | |
with: | |
name: bpfman-release | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: ./changelogs/CHANGELOG-${{ env.RELEASE_VERSION }}.md | |
files: | | |
bpfman-linux-x86_64.tar.gz | |
## TODO once we're using an aya mainline version | |
# - name: publish bpfman crate | |
# run: cargo publish -p bpfman --token ${{ secrets.BPFMAN_DEV_TOKEN }} | |
- name: publish bpfman-api crate | |
run: cargo publish -p bpfman-api --token ${{ secrets.BPFMAN_DEV_TOKEN }} | |
build-workflow-complete: | |
needs: | |
[ | |
"check-license", | |
"build", | |
"build-go", | |
"coverage", | |
"basic-integration-tests", | |
"kubernetes-integration-tests", | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build Complete | |
run: echo "Build Complete" |