Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker ci-build v001 #423

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
runs-on: ubuntu-22.04
env:
RUSTFLAGS: -D warnings
RUSTUP_HOME: /root/.rustup
container:
image: zingodevops/ci-build:stable
image: zingodevops/ci-build:001
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
Expand All @@ -35,20 +34,24 @@ jobs:
- name: Rustup show
run: rustup show

- name: Check formatting of code
run: cargo +stable fmt --check
- name: Format checks
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check

- name: Clippy checks
run: cargo +stable clippy
uses: actions-rs/cargo@v1
with:
command: clippy

cargo-test:
name: Cargo test
runs-on: ubuntu-22.04
env:
RUSTFLAGS: -D warnings
RUSTUP_HOME: /root/.rustup
container:
image: zingodevops/ci-build:stable
image: zingodevops/ci-build:001
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
Expand Down Expand Up @@ -79,7 +82,10 @@ jobs:
restore-keys: cargo-zingolib

- name: Run tests and generate coverage
run: cargo tarpaulin --all-features --verbose --workspace --avoid-cfg-tarpaulin --skip-clean --ignore-tests --release --timeout 3000 --out xml
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --verbose --workspace --avoid-cfg-tarpaulin --skip-clean --ignore-tests --release --timeout 3000 --out xml

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
Expand Down
76 changes: 47 additions & 29 deletions docker-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM debian:bookworm-slim
FROM debian:bookworm-slim AS builder

WORKDIR /usr/src

# Install dependencies
# Install dependencies and update ca certificates
RUN apt update \
&& apt install -y --no-install-recommends --no-install-suggests \
build-essential \
Expand All @@ -20,43 +22,59 @@ RUN apt update \
bsdmainutils \
automake \
libtinfo5 \
golang \
ca-certificates \
&& update-ca-certificates

# Build lightwalletd
RUN git clone https://github.com/zcash/lightwalletd \
&& cd lightwalletd \
&& git checkout v0.4.15 \
&& make

# Build zcashd and fetch params
RUN git clone https://github.com/zcash/zcash.git \
&& cd zcash/ \
&& git checkout v5.6.1 \
&& ./zcutil/fetch-params.sh \
&& ./zcutil/clean.sh \
&& ./zcutil/build.sh -j$(nproc)

FROM debian:bookworm-slim

# Copy regtest binaries and zcash params from builder
COPY --from=builder /usr/src/lightwalletd/lightwalletd /usr/bin/
COPY --from=builder /usr/src/zcash/src/zcashd /usr/bin/
COPY --from=builder /usr/src/zcash/src/zcash-cli /usr/bin/
COPY --from=builder /root/.zcash-params/ /root/.zcash-params/

# Install dependencies and update ca certificates
RUN apt update \
&& apt install -y --no-install-recommends --no-install-suggests \
python3 \
git \
gcc \
protobuf-compiler \
curl \
pkg-config \
libssl-dev \
apt-transport-https \
gnupg2 \
procps \
golang \
build-essential \
protobuf-compiler \
ca-certificates \
&& update-ca-certificates

# build lightwalletd
RUN git clone https://github.com/zcash/lightwalletd && cd lightwalletd && make && \
ln -s lightwalletd /usr/bin
# Install Rust and Cargo-Tarpaulin
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
# Install rust and cargo tarpaulin
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV HOME=/root
ENV CARGO_HOME=$HOME/.cargo
ENV RUSTUP_HOME=$HOME/.rustup
ENV PATH=$PATH:$CARGO_HOME/bin
RUN rustup toolchain install stable \
&& rustup component add clippy \
&& cargo install cargo-tarpaulin \
&& rustup update

# build zcashd and fetch params
RUN git clone https://github.com/zcash/zcash.git \
&& cd zcash/ \
&& git checkout v5.4.2 \
&& ./zcutil/fetch-params.sh

RUN cd zcash && ./zcutil/clean.sh && ./zcutil/build.sh -j$(nproc)
RUN ln -s /zcash/src/zcashd /zcash/src/zcash-cli /usr/bin
RUN rustup install stable && rustup default stable
RUN rustup toolchain install stable --profile minimal --component clippy \
&& rustup update \
&& rustup default stable
RUN cargo install cargo-tarpaulin

WORKDIR /usr/src

RUN mv -f /lightwalletd/lightwalletd /usr/bin
# Apt clean up
RUN apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

10 changes: 6 additions & 4 deletions docker-ci/README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
The following is required to successfully update the builder image for Github CI workflows:
- copy lightwalletd binary into the zingolib/docker-ci/ directory
- run 'docker build -t zingodevops/ci-build:stable .' to build the image locally
The following is required to successfully update the docker container for Github CI workflows:
- update the lightwalletd and zcash git tags to the latest versions in 'docker-ci/Dockerfile'
- change to the `docker-ci` directory
- run 'docker build -t zingodevops/ci-build:<new image version number> .' to build the image locally
- run 'docker login' and fill in the credentials for DockerHub
- run 'docker push zingodevops:ci-build:stable' to push to DockerHub
- run 'docker push zingodevops/ci-build:<new image version number>' to push to DockerHub
- update github workflow files to the new image version number
Loading