Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
leeopop committed Feb 19, 2024
1 parent 3de3da7 commit 6e6db45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 48 deletions.
38 changes: 4 additions & 34 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,15 @@
name: Rust
name: Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
DPDK_VERSION: 22.11.4

jobs:
build:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update && sudo apt install -y linux-headers-generic build-essential libnuma-dev git meson python3-pyelftools curl libclang-dev clang llvm-dev libbsd-dev
- name: Install DPDK
run: |
wget -O dpdk.tar.xz https://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz
mkdir dpdk-src
tar -xvJf dpdk.tar.xz -C dpdk-src --strip-components=1
cd dpdk-src
meson setup build
ninja -C build
sudo ninja -C build install
sudo ldconfig
rm -rf dpdk-src
- name: Install minimal Rust with clippy and rustfmt
run: |
curl -f -sSf https://sh.rustup.rs | bash -s -- -y --profile minimal --component clippy rustfmt
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Check
run: |
clang --version
llvm-config --version
cargo --version
gcc --version
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Dockerized CI
run: docker build --progress=plain .
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
FROM debian:latest

ENV RTE_SDK=/usr/local/share/dpdk
ENV DPDK_VERSION 22.11.4

WORKDIR /
RUN echo "APT last updated: 2024/01/01"

RUN apt-get update -y && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get autoclean -y
RUN apt-get install -y linux-headers-generic build-essential libnuma-dev git meson python3-pyelftools curl libclang-dev clang llvm-dev libbsd-dev
RUN apt-get install -y curl git tar
RUN mkdir dpdk

ENV RTE_SDK=/usr/local/share/dpdk
ENV DPDK_VERSION 22.11.4

# Install DPDK
RUN mkdir /dpdk
RUN curl -o dpdk.tar.xz https://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz
RUN tar -xvJf dpdk.tar.xz -C dpdk --strip-components=1

WORKDIR /dpdk

RUN meson setup build
RUN ninja -C build
RUN ninja -C build install
RUN ldconfig

WORKDIR /
RUN rm -rf /dpdk

# Init user account
ENV USER_NAME user
RUN useradd -ms /bin/bash $USER_NAME


# Beginning of rust user install
# Rust user install
WORKDIR /home/$USER_NAME
RUN su -c "curl -f -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain none" - $USER_NAME
ADD ./rust-toolchain /
RUN chmod 444 /rust-toolchain
RUN su -c "rustup toolchain install `cat /rust-toolchain | tr -d ' \n'` --profile minimal --component clippy rustfmt" - $USER_NAME
RUN rm /rust-toolchain
# End of rust user install
WORKDIR /

# Beginning of user ci script
# User ci script
ADD . /home/$USER_NAME/
RUN chown -R $USER_NAME:$USER_NAME /home/$USER_NAME
WORKDIR /home/$USER_NAME
RUN su -c "./ci.sh" - $USER_NAME
# End of user ci script

WORKDIR /
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
echo "hello world"
set -x

# Check program version
clang --version
Expand Down

0 comments on commit 6e6db45

Please sign in to comment.