Skip to content

Commit

Permalink
[ci] workaround gha mounting a new home dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
rexhoffman authored and bors-libra committed Sep 22, 2021
1 parent 6d3ece8 commit 4477bf2
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 132 deletions.
18 changes: 10 additions & 8 deletions .github/actions/build-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ runs:
- name: reconfigure container for gha runner
shell: bash
run: |
echo 'CARGO_HOME=/opt/cargo/' | tee -a $GITHUB_ENV
echo 'CARGO_HOME=/opt/cargo' | tee -a $GITHUB_ENV
echo 'RUSTUP_HOME=/opt/rustup' | tee -a $GITHUB_ENV
if [[ "$(uname -s)" == "Darwin" ]]; then
sudo dscl . append /Groups/wheel GroupMembership $USER
sudo mkdir -p /opt/cargo || true
Expand All @@ -43,18 +44,19 @@ runs:
# prepare move lang prover tooling.
# By setting these values the dev-setup.sh script can detect already installed executables (and check versions).
echo 'Z3_EXE='${HOME}/bin/z3 | tee -a $GITHUB_ENV
echo 'CVC4_EXE='${HOME}/bin/cvc4 | tee -a $GITHUB_ENV
echo 'DOTNET_ROOT='${HOME}/.dotnet/ | tee -a $GITHUB_ENV
echo 'BOOGIE_EXE='${HOME}/.dotnet/tools/boogie | tee -a $GITHUB_ENV
echo 'Z3_EXE='/opt/bin/z3 | tee -a $GITHUB_ENV
echo 'CVC4_EXE='/opt/bin/cvc4 | tee -a $GITHUB_ENV
echo 'DOTNET_ROOT='/opt/dotnet/ | tee -a $GITHUB_ENV
echo 'BOOGIE_EXE='/opt/dotnet/tools/boogie | tee -a $GITHUB_ENV
echo 'MVP_TEST_ON_CI'='1' | tee -a $GITHUB_ENV
echo "$HOME/bin" | tee -a $GITHUB_PATH
echo "$HOME/.dotnet" | tee -a $GITHUB_PATH
echo "/opt/bin" | tee -a $GITHUB_PATH
echo "/opt/dotnet" | tee -a $GITHUB_PATH
echo "/opt/dotnet/tools" | tee -a $GITHUB_PATH
echo "/opt/cargo/bin" | tee -a $GITHUB_PATH
echo '/usr/lib/golang/bin' | tee -a $GITHUB_PATH
- name: install common dependencies (should be ~ 10 seconds in a linux build, on mac it's a beast.)
shell: bash
run: scripts/dev_setup.sh -t -o -b -p -y -s
run: scripts/dev_setup.sh -t -o -b -p -y -s -n
- id: rust-environment
shell: bash
run: |
Expand Down
65 changes: 37 additions & 28 deletions docker/ci/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,49 @@ WORKDIR /diem
COPY rust-toolchain /diem/rust-toolchain
COPY scripts/dev_setup.sh /diem/scripts/dev_setup.sh

RUN apk add bash=5.1.4-r0 --no-cache
ENV HOME "/github/home"
#Needed for sccache to function, and to work around home dir being blatted.
ENV CARGO_HOME "/opt/cargo"
ENV RUSTUP_HOME "/opt/rustup"

# Batch mode and all operations tooling
RUN scripts/dev_setup.sh -t -o -y -b -p -s
ENV PATH "/root/.cargo/bin:/root/bin/:$PATH"
RUN apk add bash=5.1.4-r0 --no-cache && \
mkdir -p /github/home && \
mkdir -p /opt/cargo/ && \
mkdir -p /opt/git/ && \
/diem/scripts/dev_setup.sh -t -o -b -p -y -s -n

ENV DOTNET_ROOT "/opt/dotnet"
ENV Z3_EXE "/opt/bin/z3"
ENV CVC4_EXE "/opt/bin/cvc4"
ENV BOOGIE_EXE "/opt/dotnet/tools/boogie"
ENV PATH "/opt/cargo/bin:/usr/lib/golang/bin:/opt/bin:${DOTNET_ROOT}:${DOTNET_ROOT}/tools:$PATH"

FROM setup_ci_alpine as tested_ci_alpine

# Compile a small rust tool? But we already have in dev_setup (sccache/grcov)...?
# Test that all commands we need are installed and on the PATH
RUN [ -x "$(command -v shellcheck)" ] \
&& [ -x "$(command -v hadolint)" ] \
&& [ -x "$(command -v vault)" ] \
&& [ -x "$(command -v terraform)" ] \
&& [ -x "$(command -v kubectl)" ] \
&& [ -x "$(command -v rustup)" ] \
&& [ -x "$(command -v cargo)" ] \
&& [ -x "$(command -v cargo-guppy)" ] \
&& [ -x "$(command -v sccache)" ] \
&& [ -x "$(command -v grcov)" ] \
&& [ -x "$(command -v helm)" ] \
&& [ -x "$(command -v aws)" ] \
&& [ -x "$(command -v z3)" ] \
&& [ -x "$(command -v tidy)" ] \
&& [ -x "$(command -v xsltproc)" ] \
&& [ -x "$(command -v "$HOME/.dotnet/tools/boogie")" ] \
&& [ -x "$(xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(command -v tidy)" ] \
&& [ -x "$(command -v xsltproc)" ] \
&& [ -x "$(command -v javac)" ] \
&& [ -x "$(command -v clang)" ] \
&& [ -x "$(command -v python3)" ] \
&& [ -x "$(command -v go)" ] \
&& [ -x "$(command -v npm)" ]
RUN [ -x "$(set -x; command -v shellcheck)" ] \
&& [ -x "$(set -x; command -v hadolint)" ] \
&& [ -x "$(set -x; command -v vault)" ] \
&& [ -x "$(set -x; command -v terraform)" ] \
&& [ -x "$(set -x; command -v kubectl)" ] \
&& [ -x "$(set -x; command -v rustup)" ] \
&& [ -x "$(set -x; command -v cargo)" ] \
&& [ -x "$(set -x; command -v cargo-guppy)" ] \
&& [ -x "$(set -x; command -v sccache)" ] \
&& [ -x "$(set -x; command -v grcov)" ] \
&& [ -x "$(set -x; command -v helm)" ] \
&& [ -x "$(set -x; command -v aws)" ] \
&& [ -x "$(set -x; command -v z3)" ] \
&& [ -x "$(set -x; command -v "$BOOGIE_EXE")" ] \
&& [ -x "$(set -x; xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(set -x; command -v tidy)" ] \
&& [ -x "$(set -x; command -v xsltproc)" ] \
&& [ -x "$(set -x; command -v javac)" ] \
&& [ -x "$(set -x; command -v clang)" ] \
&& [ -x "$(set -x; command -v python3)" ] \
&& [ -x "$(set -x; command -v go)" ] \
&& [ -x "$(set -x; command -v npm)" ]

# should be a no-op, but since sccache failes to execute, sccache is rebuilt.
RUN scripts/dev_setup.sh -t -o -y -b -p -s
Expand Down
55 changes: 34 additions & 21 deletions docker/ci/arch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,51 @@ WORKDIR /diem
COPY rust-toolchain /diem/rust-toolchain
COPY scripts/dev_setup.sh /diem/scripts/dev_setup.sh

ENV HOME "/github/home"
#Needed for sccache to function, and to work around home dir being blatted.
ENV CARGO_HOME "/opt/cargo"
ENV RUSTUP_HOME "/opt/rustup"

# WORKAROUND for glibc 2.33 and old Docker
# See https://github.com/actions/virtual-environments/issues/2658
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562
RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
bsdtar -C / -xvf "$patched_glibc"
bsdtar -C / -xvf "$patched_glibc" && \
mkdir -p /github/home && \
mkdir -p /opt/cargo/ && \
mkdir -p /opt/git/ && \
/diem/scripts/dev_setup.sh -t -o -b -p -y -n && \
pacman -Scc --noconfirm

ENV DOTNET_ROOT "/opt/dotnet"
ENV Z3_EXE "/opt/bin/z3"
ENV CVC4_EXE "/opt/bin/cvc4"
ENV BOOGIE_EXE "/opt/dotnet/tools/boogie"
ENV PATH "/opt/cargo/bin:/usr/lib/golang/bin:/opt/bin:${DOTNET_ROOT}:${DOTNET_ROOT}/tools:$PATH"

# Batch mode and all operations tooling
RUN scripts/dev_setup.sh -t -o -y -b -p && pacman -Scc --noconfirm
ENV PATH "/root/.cargo/bin:/root/bin/:$PATH"

FROM setup_ci_arch as tested_ci_arch

# Compile a small rust tool? But we already have in dev_setup (sccache/grcov)...?
# Test that all commands we need are installed and on the PATH
RUN [ -x "$(command -v shellcheck)" ] \
&& [ -x "$(command -v hadolint)" ] \
&& [ -x "$(command -v vault)" ] \
&& [ -x "$(command -v terraform)" ] \
&& [ -x "$(command -v kubectl)" ] \
&& [ -x "$(command -v rustup)" ] \
&& [ -x "$(command -v cargo)" ] \
&& [ -x "$(command -v cargo-guppy)" ] \
&& [ -x "$(command -v sccache)" ] \
&& [ -x "$(command -v grcov)" ] \
&& [ -x "$(command -v helm)" ] \
&& [ -x "$(command -v aws)" ] \
&& [ -x "$(command -v z3)" ] \
&& [ -x "$(command -v "$HOME/.dotnet/tools/boogie")" ] \
&& [ -x "$(xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(command -v tidy)" ] \
&& [ -x "$(command -v xsltproc)" ]
RUN [ -x "$(set -x; command -v shellcheck)" ] \
&& [ -x "$(set -x; command -v hadolint)" ] \
&& [ -x "$(set -x; command -v vault)" ] \
&& [ -x "$(set -x; command -v terraform)" ] \
&& [ -x "$(set -x; command -v kubectl)" ] \
&& [ -x "$(set -x; command -v rustup)" ] \
&& [ -x "$(set -x; command -v cargo)" ] \
&& [ -x "$(set -x; command -v cargo-guppy)" ] \
&& [ -x "$(set -x; command -v sccache)" ] \
&& [ -x "$(set -x; command -v grcov)" ] \
&& [ -x "$(set -x; command -v helm)" ] \
&& [ -x "$(set -x; command -v aws)" ] \
&& [ -x "$(set -x; command -v z3)" ] \
&& [ -x "$(set -x; command -v "$BOOGIE_EXE")" ] \
&& [ -x "$(set -x; xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(set -x; command -v tidy)" ] \
&& [ -x "$(set -x; command -v xsltproc)" ]
# These should eventually be installed and tested, but since we don't automate on arch, low pri.
# && [ -x "$(command -v javac)" ] \
# && [ -x "$(command -v clang)" ] \
Expand Down
73 changes: 37 additions & 36 deletions docker/ci/github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,50 @@ COPY scripts/dev_setup.sh /diem/scripts/dev_setup.sh

#this is the default home on docker images in gha, until it's not?
ENV HOME "/github/home"
#Needed for sccache to function
ENV CARGO_HOME "/opt/cargo/"
#Needed for sccache to function, and to work around home dir being blatted.
ENV CARGO_HOME "/opt/cargo"
ENV RUSTUP_HOME "/opt/rustup"

# Batch mode and all operations tooling
RUN mkdir -p /github/home \
&& mkdir -p /opt/cargo/ \
&& mkdir -p /opt/git/ \
&& /diem/scripts/dev_setup.sh -t -o -b -p -y -s\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV PATH "/opt/cargo/bin:/usr/lib/golang/bin:/github/home/bin:$PATH"
ENV DOTNET_ROOT "/github/home/.dotnet"
ENV Z3_EXE "/github/home/bin/z3"
ENV CVC4_EXE "/github/home/bin/cvc4"
ENV BOOGIE_EXE "/github/home/.dotnet/tools/boogie"
RUN mkdir -p /github/home && \
mkdir -p /opt/cargo/ && \
mkdir -p /opt/git/ && \
/diem/scripts/dev_setup.sh -t -o -b -p -y -s -n && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV DOTNET_ROOT "/opt/dotnet"
ENV Z3_EXE "/opt/bin/z3"
ENV CVC4_EXE "/opt/bin/cvc4"
ENV BOOGIE_EXE "/opt/dotnet/tools/boogie"
ENV PATH "/opt/cargo/bin:/usr/lib/golang/bin:/opt/bin:${DOTNET_ROOT}:${DOTNET_ROOT}/tools:$PATH"

FROM setup_ci as tested_ci

# Compile a small rust tool? But we already have in dev_setup (sccache/grcov)...?
# Test that all commands we need are installed and on the PATH
RUN [ -x "$(command -v shellcheck)" ] \
&& [ -x "$(command -v hadolint)" ] \
&& [ -x "$(command -v vault)" ] \
&& [ -x "$(command -v terraform)" ] \
&& [ -x "$(command -v kubectl)" ] \
&& [ -x "$(command -v rustup)" ] \
&& [ -x "$(command -v cargo)" ] \
&& [ -x "$(command -v cargo-guppy)" ] \
&& [ -x "$(command -v sccache)" ] \
&& [ -x "$(command -v grcov)" ] \
&& [ -x "$(command -v helm)" ] \
&& [ -x "$(command -v aws)" ] \
&& [ -x "$(command -v z3)" ] \
&& [ -x "$(command -v "$HOME/.dotnet/tools/boogie")" ] \
&& [ -x "$(xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(command -v tidy)" ] \
&& [ -x "$(command -v xsltproc)" ] \
&& [ -x "$(command -v javac)" ] \
&& [ -x "$(command -v clang)" ] \
&& [ -x "$(command -v python3)" ] \
&& [ -x "$(command -v go)" ] \
&& [ -x "$(command -v npm)" ]
RUN [ -x "$(set -x; command -v shellcheck)" ] \
&& [ -x "$(set -x; command -v hadolint)" ] \
&& [ -x "$(set -x; command -v vault)" ] \
&& [ -x "$(set -x; command -v terraform)" ] \
&& [ -x "$(set -x; command -v kubectl)" ] \
&& [ -x "$(set -x; command -v rustup)" ] \
&& [ -x "$(set -x; command -v cargo)" ] \
&& [ -x "$(set -x; command -v cargo-guppy)" ] \
&& [ -x "$(set -x; command -v sccache)" ] \
&& [ -x "$(set -x; command -v grcov)" ] \
&& [ -x "$(set -x; command -v helm)" ] \
&& [ -x "$(set -x; command -v aws)" ] \
&& [ -x "$(set -x; command -v z3)" ] \
&& [ -x "$(set -x; command -v "$BOOGIE_EXE")" ] \
&& [ -x "$(set -x; xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(set -x; command -v tidy)" ] \
&& [ -x "$(set -x; command -v xsltproc)" ] \
&& [ -x "$(set -x; command -v javac)" ] \
&& [ -x "$(set -x; command -v clang)" ] \
&& [ -x "$(set -x; command -v python3)" ] \
&& [ -x "$(set -x; command -v go)" ] \
&& [ -x "$(set -x; command -v npm)" ]

# should be a no-op
# sccache builds fine, but is not executable ??? in alpine, ends up being recompiled. Wierd.
Expand Down
Loading

0 comments on commit 4477bf2

Please sign in to comment.