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

R hello world #345

Merged
merged 20 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2157368
r: add track readme file
vpayno Mar 28, 2024
b896279
r: add ci tools and scripts
vpayno Mar 28, 2024
02e9831
r: force pyenv anaconda3
vpayno Mar 28, 2024
2ce6b8f
r/hello-world: download exercise
vpayno Mar 28, 2024
7e68eb4
r/hello-world: 1st iteration
vpayno Mar 28, 2024
3807f71
ci(r): add initial R CI workflow
vpayno Mar 28, 2024
d8519ed
ci(docker-build): add R layer
vpayno Mar 29, 2024
c607711
ci(docker-build): fix glob typo in clean up call
vpayno Mar 29, 2024
caf1f91
ci(docker-build): make sure manually installed packages are marked so…
vpayno Mar 29, 2024
07700ed
ci(docker-build): add missing wrapper-library imports
vpayno Mar 29, 2024
8a20b40
ci(docker-build): stop forcefully removing x11 packages
vpayno Mar 29, 2024
c5fc501
ci(docker-build): add rstudio to r layer
vpayno Mar 29, 2024
7c9e027
ci(docker-build): add disk usage stats to layer_end()
vpayno Mar 29, 2024
a099e7f
ci(docker-build): split data science layers to new image
vpayno Mar 30, 2024
126d98f
ci(docker-build): rename ci-generic-base to ci-base-debian and relabe…
vpayno Mar 30, 2024
3cffa1e
ci(docker-test): update ci-generic-debian tests
vpayno Mar 30, 2024
8e254d5
ci(docker-test): add ci-anaconda-debian tests
vpayno Mar 30, 2024
02d3d49
ci(docker-build): add step to build base first, then generic and anac…
vpayno Mar 30, 2024
271f1e1
ci(tools): add /etc/profile.d/r.sh to ~/.bashrc in gh-setup-env
vpayno Mar 30, 2024
f9394b9
ci(tools): fix gh-setup-env to it works with split images
vpayno Mar 30, 2024
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
266 changes: 144 additions & 122 deletions .github/citools/common/gh-setup-env
Original file line number Diff line number Diff line change
Expand Up @@ -18,159 +18,181 @@ main() {

print_ruler

source /etc/profile.d/go.sh || track_errors

printf "Adding Go paths to GITHUB_PATH...\n"
printf "%s\n" "${GOPATH}/bin" | tee -a "${GITHUB_PATH}" || track_errors
printf "\n"

printf "Adding Go paths to GITHUB_ENV...\n"
printf "%s=%s\n" "GOROOT" "${GOROOT}" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOPATH" "${GOPATH}" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOBIN" "${GOPATH}/bin" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOSRC" "${GOPATH}/src" | tee -a "${GITHUB_ENV}" || track_errors
printf "\n"

if [ "${HOSTTYPE}" = x86_64 ]; then
printf "%s=%s\n" "GOARCH" "amd64" | tee -a "${GITHUB_ENV}" || track_errors
elif [ "${HOSTTYPE}" = i686 ]; then
printf "%s=%s\n" "GOARCH" "i386" | tee -a "${GITHUB_ENV}" || track_errors
elif [ "${HOSTTYPE}" = aarch64 ]; then
printf "%s=%s\n" "GOARCH" "arm64" | tee -a "${GITHUB_ENV}" || track_errors
if [[ -f /etc/profile.d/go.sh ]]; then
source /etc/profile.d/go.sh || track_errors

printf "Adding Go paths to GITHUB_PATH...\n"
printf "%s\n" "${GOPATH}/bin" | tee -a "${GITHUB_PATH}" || track_errors
printf "\n"

printf "Adding Go paths to GITHUB_ENV...\n"
printf "%s=%s\n" "GOROOT" "${GOROOT}" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOPATH" "${GOPATH}" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOBIN" "${GOPATH}/bin" | tee -a "${GITHUB_ENV}" || track_errors
printf "%s=%s\n" "GOSRC" "${GOPATH}/src" | tee -a "${GITHUB_ENV}" || track_errors
printf "\n"

if [ "${HOSTTYPE}" = x86_64 ]; then
printf "%s=%s\n" "GOARCH" "amd64" | tee -a "${GITHUB_ENV}" || track_errors
elif [ "${HOSTTYPE}" = i686 ]; then
printf "%s=%s\n" "GOARCH" "i386" | tee -a "${GITHUB_ENV}" || track_errors
elif [ "${HOSTTYPE}" = aarch64 ]; then
printf "%s=%s\n" "GOARCH" "arm64" | tee -a "${GITHUB_ENV}" || track_errors
fi
printf "\n"

printf "Setup Go symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d go ]]; then
ln -sv "${GOPATH}" go || track_errors
fi
if [[ ! -d sdk ]]; then
ln -sv "${GO_PREFIX}/go-sdk" sdk || track_errors
fi
ls -l ~/go ~/sdk
cd - || track_errors
printf "\n"

echo Adding source /etc/profile.d/go.sh to ~/.bashrc
echo '. /etc/profile.d/go.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

print_ruler
fi
printf "\n"

printf "Setup Go symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d go ]]; then
ln -sv "${GOPATH}" go || track_errors
if [[ -f /etc/profile.d/rust.sh ]]; then
source /etc/profile.d/rust.sh || track_errors

printf "Adding Rust paths to GITHUB_PATH...\n"
printf "%s\n" "${RUSTBIN}" | tee -a "${GITHUB_PATH}" || track_errors
printf "\n"

printf "Adding Go paths to GITHUB_ENV...\n"
if [[ -n ${RUSTC_WRAPPER} ]]; then
printf "%s=%s\n" "RUSTC_WRAPPER" "${RUSTC_WRAPPER}" | tee -a "${GITHUB_ENV}" || track_errors
fi
if [[ -n ${CARGO_REGISTRIES_CRATES_IO_PROTOCOL} ]]; then
printf "%s=%s\n" "CARGO_REGISTRIES_CRATES_IO_PROTOCOL" "${CARGO_REGISTRIES_CRATES_IO_PROTOCOL}" | tee -a "${GITHUB_ENV}" || track_errors
fi
printf "\n"

echo Adding source /etc/profile.d/rust.sh to ~/.bashrc
echo '. /etc/profile.d/rust.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

printf "Setup Rust symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .cargo ]]; then
ln -sv "${CARGO_HOME}" .cargo || track_errors
fi
if [[ ! -d .rustup ]]; then
ln -sv "${RUSTUP_HOME}" .rustup || track_errors
fi
ls -l ~/.cargo ~/.rustup
cd - || track_errors
printf "\n"

print_ruler
fi
if [[ ! -d sdk ]]; then
ln -sv "${GO_PREFIX}/go-sdk" sdk || track_errors
fi
ls -l ~/go ~/sdk
cd - || track_errors
printf "\n"

echo Adding source /etc/profile.d/go.sh to ~/.bashrc
echo '. /etc/profile.d/go.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

print_ruler

source /etc/profile.d/rust.sh || track_errors
if [[ -f /etc/profile.d/ruby.sh ]]; then
source /etc/profile.d/ruby.sh || track_errors

printf "Adding Rust paths to GITHUB_PATH...\n"
printf "%s\n" "${RUSTBIN}" | tee -a "${GITHUB_PATH}" || track_errors
printf "\n"
printf "Adding Ruby paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/rbenv/bin" "/usr/local/rbenv/shims" | tee -a "${GITHUB_PATH}"

printf "Adding Go paths to GITHUB_ENV...\n"
if [[ -n ${RUSTC_WRAPPER} ]]; then
printf "%s=%s\n" "RUSTC_WRAPPER" "${RUSTC_WRAPPER}" | tee -a "${GITHUB_ENV}" || track_errors
fi
if [[ -n ${CARGO_REGISTRIES_CRATES_IO_PROTOCOL} ]]; then
printf "%s=%s\n" "CARGO_REGISTRIES_CRATES_IO_PROTOCOL" "${CARGO_REGISTRIES_CRATES_IO_PROTOCOL}" | tee -a "${GITHUB_ENV}" || track_errors
fi
printf "\n"
echo Adding source /etc/profile.d/ruby.sh to ~/.bashrc
echo '. /etc/profile.d/ruby.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

echo Adding source /etc/profile.d/rust.sh to ~/.bashrc
echo '. /etc/profile.d/rust.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"
printf "Setup Ruby symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .rbenv ]]; then
ln -sv "/usr/local/rbenv" .rbenv || track_errors
fi
ls -l ~/.rbenv
cd - || track_errors
printf "\n"

printf "Setup Rust symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .cargo ]]; then
ln -sv "${CARGO_HOME}" .cargo || track_errors
print_ruler
fi
if [[ ! -d .rustup ]]; then
ln -sv "${RUSTUP_HOME}" .rustup || track_errors
fi
ls -l ~/.cargo ~/.rustup
cd - || track_errors
printf "\n"

print_ruler
if [[ -f /etc/profile.d/nodejs.sh ]]; then
source /etc/profile.d/nodejs.sh || track_errors

source /etc/profile.d/ruby.sh || track_errors
printf "Adding NodeJS paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/nodenv/bin" "/usr/local/nodenv/shims" | tee -a "${GITHUB_PATH}"

printf "Adding Ruby paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/rbenv/bin" "/usr/local/rbenv/shims" | tee -a "${GITHUB_PATH}"
echo Adding source /etc/profile.d/nodejs.sh to ~/.bashrc
echo '. /etc/profile.d/nodejs.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

echo Adding source /etc/profile.d/ruby.sh to ~/.bashrc
echo '. /etc/profile.d/ruby.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"
printf "Setup NodeJS symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .nodenv ]]; then
ln -sv "/usr/local/nodenv" .nodenv || track_errors
fi
ls -l ~/.nodenv
cd - || track_errors
printf "\n"

printf "Setup Ruby symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .rbenv ]]; then
ln -sv "/usr/local/rbenv" .rbenv || track_errors
print_ruler
fi
ls -l ~/.rbenv
cd - || track_errors
printf "\n"

print_ruler
if [[ -f /etc/profile.d/python.sh ]]; then
source /etc/profile.d/python.sh || track_errors

source /etc/profile.d/nodejs.sh || track_errors
printf "Adding Python paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/pyenv/bin" "/usr/local/pyenv/shims" | tee -a "${GITHUB_PATH}"

printf "Adding NodeJS paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/nodenv/bin" "/usr/local/nodenv/shims" | tee -a "${GITHUB_PATH}"
echo Adding source /etc/profile.d/python.sh to ~/.bashrc
echo '. /etc/profile.d/python.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

echo Adding source /etc/profile.d/nodejs.sh to ~/.bashrc
echo '. /etc/profile.d/nodejs.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"
printf "Setup Python symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .pyenv ]]; then
ln -sv "/usr/local/pyenv" .pyenv || track_errors
fi
ls -l ~/.pyenv
cd - || track_errors
printf "\n"

printf "Setup NodeJS symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .nodenv ]]; then
ln -sv "/usr/local/nodenv" .nodenv || track_errors
print_ruler
fi
ls -l ~/.nodenv
cd - || track_errors
printf "\n"

print_ruler
if [[ -f /etc/profile.d/gleam.sh ]]; then
source /etc/profile.d/gleam.sh || track_errors

source /etc/profile.d/python.sh || track_errors
printf "Adding Gleam paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/erlang/bin" "/usr/local/rebar3/bin" | tee -a "${GITHUB_PATH}"

printf "Adding Python paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/pyenv/bin" "/usr/local/pyenv/shims" | tee -a "${GITHUB_PATH}"
echo Adding source /etc/profile.d/gleam.sh to ~/.bashrc
echo '. /etc/profile.d/gleam.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

echo Adding source /etc/profile.d/python.sh to ~/.bashrc
echo '. /etc/profile.d/python.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"
printf "Setup Gleam symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .pyenv ]]; then
mkdir .cache || track_errors
ln -sv "/usr/local/rebar3" .cache/rebar3 || track_errors
fi
ls -l ~/.cache ~/.cache/rebar3
cd - || track_errors
printf "\n"

printf "Setup Python symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .pyenv ]]; then
ln -sv "/usr/local/pyenv" .pyenv || track_errors
print_ruler
fi
ls -l ~/.pyenv
cd - || track_errors
printf "\n"

print_ruler

source /etc/profile.d/gleam.sh || track_errors
if [[ -f /etc/profile.d/r.sh ]]; then
source /etc/profile.d/r.sh || track_errors

printf "Adding Gleam paths to GITHUB_PATH...\n"
printf "%s\n" "/usr/local/erlang/bin" "/usr/local/rebar3/bin" | tee -a "${GITHUB_PATH}"
echo Adding source /etc/profile.d/r.sh to ~/.bashrc
echo '. /etc/profile.d/r.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

echo Adding source /etc/profile.d/gleam.sh to ~/.bashrc
echo '. /etc/profile.d/gleam.sh' | tee -a "${HOME}/.bashrc" || track_errors
printf "\n"

printf "Setup Gleam symlinks for github user:\n"
cd "${HOME}" || track_errors
if [[ ! -d .pyenv ]]; then
mkdir .cache || track_errors
ln -sv "/usr/local/rebar3" .cache/rebar3 || track_errors
print_ruler
fi
ls -l ~/.cache ~/.cache/rebar3
cd - || track_errors
printf "\n"

print_ruler

tail -n 1000 -v "${GITHUB_PATH}"

Expand Down
30 changes: 30 additions & 0 deletions .github/citools/includes/wrapper-library
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,33 @@ show_tool_versions_gleam() {
# md_code_tag
printf "\n"
} # show_tool_versions_gleam()

show_tool_versions_r_short() {
# md_code_tag text
printf "R versions:\n"
printf "\n"
R --version | paste /dev/null -
printf "\n"
Rscript --version | paste /dev/null -
# md_code_tag
printf "\n"
} # show_tool_versions_r_short()

show_tool_versions_r() {
show_tool_versions_r_short

if [[ -z ${GITHUB_ACTIONS} ]]; then
return
fi

# md_code_tag text
printf "Installed R packages:\n"
printf "\n"
printf "null\n"
R --no-save <<-EOF
p <- available.packages()
p
EOF
# md_code_tag
printf "\n"
} # show_tool_versions_r()
10 changes: 10 additions & 0 deletions .github/citools/python/python-setup-install
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ main() {
zlib1g-dev
)

echo Running: sudo apt update
time sudo apt update || track_errors

print_ruler

echo Running: sudo apt install -y "${debs[@]}"
time sudo apt install -y "${debs[@]}" || track_errors

print_ruler

echo Running: sudo apt-mark manual "${debs[@]}"
time sudo apt-mark manual "${debs[@]}" || track_errors

print_ruler

echo Running: export PYTHON_CONFIGURE_OPTS="--enable-shared"
export PYTHON_CONFIGURE_OPTS="--enable-shared"

Expand Down
26 changes: 26 additions & 0 deletions .github/citools/r/r-lint-formatter
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# .github/citools/r/r-lint-formatter
#

# shellcheck disable=SC1091
source ../../.github/citools/includes/wrapper-library || exit

declare -i retval=0

main() {
printf "\nRunning R Formatter\n\n"

show_tool_versions_r_short

print_ruler

run_command rfmt

print_ruler

echo Exit code: "${retval}"
return "${retval}"
}

time main "${@}"
Loading
Loading