Skip to content

Commit

Permalink
ci: change to use GitHub actions
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed May 15, 2024
1 parent fe00de2 commit 2d97e38
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build
on:
push:
branches:
- main
pull_request:
jobs:
build-amd64:
name: Build AMD64 binaries
runs-on: longhorn-infra-amd64-runners
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install make curl kmod
run: |
sudo apt update
sudo apt-get -y install make curl kmod
# Build binaries
- name: Run ci
run: make ci

- uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}

build-arm64:
name: Build ARM64 binaries
runs-on: longhorn-infra-arm64-runners
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install make curl kmod
run: |
sudo apt update
sudo apt-get -y install make curl kmod
# Build binaries
- name: Run ci
run: make ci

- uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
13 changes: 8 additions & 5 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.suse.com/bci/bci-base:15.5

ARG DAPPER_HOST_ARCH=amd64
ARG DAPPER_HOST_ARCH
ARG http_proxy
ARG https_proxy
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
Expand All @@ -21,7 +21,7 @@ RUN zypper -n addrepo --refresh https://download.opensuse.org/repositories/syste
zypper -n addrepo --refresh https://download.opensuse.org/repositories/devel:languages:python:backports/SLE_15/devel:languages:python:backports.repo && \
zypper --gpg-auto-import-keys ref

RUN zypper -n install cmake curl wget git gcc tar xsltproc docbook-xsl-stylesheets python3 meson ninja python3-pip \
RUN zypper -n install cmake curl wget git gcc unzip tar xsltproc docbook-xsl-stylesheets python3 meson ninja python3-pip \
e2fsprogs xfsprogs util-linux-systemd python3-pyelftools libcmocka-devel device-mapper

# Install Go & tools
Expand All @@ -30,8 +30,9 @@ ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm64=arm64 GOLANG_ARCH_s390x=s390x GOLA
RUN wget -O - https://storage.googleapis.com/golang/go1.22.2.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2


# Build SPDK
ENV HUGEMEM=1024
RUN echo "vm.nr_hugepages=$((HUGEMEM/2))" >> /etc/sysctl.conf
ENV SPDK_DIR /usr/src/spdk
ENV SPDK_COMMIT_ID 62a8f8a9c5ac99f6e63d654f6fc6c427c5d8815b
RUN git clone https://github.com/longhorn/spdk.git ${SPDK_DIR} --recursive && \
Expand Down Expand Up @@ -64,16 +65,18 @@ RUN cd /usr/src && \
make && \
make install

# Build nvme-cli 2.5
# Build nvme-cli 2.7.1
ENV NVME_CLI_DIR /usr/src/nvme-cli
ENV NVME_CLI_COMMIT_ID d6c07e0de9be777009ebb9ab7475bee1ae3e0e95
ENV NVME_CLI_COMMIT_ID dcdad6f5d70ffb2fa151f229db048180671eb1fe
RUN git clone https://github.com/linux-nvme/nvme-cli.git ${NVME_CLI_DIR} && \
cd ${NVME_CLI_DIR} && \
git checkout ${NVME_CLI_COMMIT_ID} && \
meson setup --force-fallback-for=libnvme .build && \
meson compile -C .build && \
meson install -C .build

RUN ldconfig

VOLUME /tmp
ENV TMPDIR /tmp
ENTRYPOINT ["./scripts/entry"]
Expand Down
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ trap "umount /dev && umount /sys" EXIT

PACKAGES="$(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"

go test -v -race -cover ${PACKAGES}
go test -v -race -cover -coverprofile=coverage.out ${PACKAGES}

0 comments on commit 2d97e38

Please sign in to comment.