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

Webassembly day01 #295

Merged
merged 19 commits into from
Nov 4, 2023
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
66 changes: 46 additions & 20 deletions .github/citools/includes/wrapper-library
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ get_rust_package_name() {

show_tool_versions_rust_short() {
# md_code_tag text
printf "Rust version:\n"
printf "Rust versions:\n"
printf "\n"
rustc --version | paste /dev/null -
rustup --version | paste /dev/null -
Expand All @@ -52,12 +52,7 @@ show_tool_versions_rust_short() {
} # show_tool_versions_rust_short()

show_tool_versions_rust() {
# md_code_tag text
printf "Rust version:\n"
printf "\n"
rustc --version | paste /dev/null -
# md_code_tag
printf "\n"
show_tool_versions_rust_short

if [[ -z ${GITHUB_ACTIONS} ]]; then
return
Expand Down Expand Up @@ -102,12 +97,7 @@ show_tool_versions_go_short() {
} # show_tool_versions_go_short()

show_tool_versions_go() {
# md_code_tag text
printf "Go version:\n"
printf "\n"
go version | paste /dev/null -
# md_code_tag
printf "\n"
show_tool_versions_go_short

if [[ -z ${GITHUB_ACTIONS} ]]; then
return
Expand All @@ -133,7 +123,7 @@ show_tool_versions_go() {

show_tool_versions_ruby_short() {
# md_code_tag text
printf "Ruby version:\n"
printf "Ruby versions:\n"
printf "\n"
ruby --version | paste /dev/null -
rbenv --version | paste /dev/null -
Expand All @@ -142,22 +132,58 @@ show_tool_versions_ruby_short() {
} # show_tool_versions_ruby_short()

show_tool_versions_ruby() {
show_tool_versions_ruby_short

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

# md_code_tag text
printf "Ruby version:\n"
printf "Installed Gem packages:\n"
printf "\n"
ruby --version | paste /dev/null -
rbenv --version | paste /dev/null -
gem list | paste /dev/null -
# md_code_tag
printf "\n"
} # show_tool_versions_ruby()

show_tool_versions_node_short() {
# md_code_tag text
printf "Node versions:\n"
printf "\n"
{
printf "nodejs: "
nodejs --version
} | paste /dev/null -
{
printf " npm: "
npm --version
} | paste /dev/null -
{
printf " yarn: "
yarn --version
} | paste /dev/null -
# md_code_tag
printf "\n"
} # show_tool_versions_node_short()

show_tool_versions_node() {
show_tool_versions_node_short

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

# md_code_tag text
printf "Installed Gem packages:\n"
printf "Installed npm packages:\n"
printf "\n"
gem list | paste /dev/null -
npm list --global | paste /dev/null -
# md_code_tag
printf "\n"
} # show_tool_versions_ruby()

# md_code_tag text
printf "Installed yarn packages:\n"
printf "\n"
yarn global list | paste /dev/null -
# md_code_tag
printf "\n"
} # show_tool_versions_node()
29 changes: 29 additions & 0 deletions .github/citools/wasm/wasm-lint-formatter
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
#
# .github/citools/wasm/wasm-lint-formatter
#

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

declare -i retval=0

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

show_tool_versions_node_short

print_ruler

# https://github.com/beautify-web/js-beautify
# https://github.com/prettier/eslint-config-prettier

run_command js-beautify ./*.js

print_ruler

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

time main "${@}"
24 changes: 24 additions & 0 deletions .github/citools/wasm/wasm-setup-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# .github/citools/wasm/wasm-setup-config
#

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

declare -i retval=0

main() {
printf "Setup WebAssembly Environment\n\n"

print_ruler

../../.github/citools/common/gh-setup-env || track_errors

print_ruler

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

time main "${@}"
58 changes: 58 additions & 0 deletions .github/citools/wasm/wasm-setup-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
#
# .github/citools/wasm/wasm-setup-install
#

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

declare -i retval=0

main() {
printf "WebAssembly Installation\n\n"

print_ruler

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

print_ruler

local -a debs
debs=(
nodejs
npm
yarn
)

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

print_ruler

show_tool_versions_node_short

print_ruler

local -a npm_pkgs
npm_pkgs=(
eslint
eslint-config-prettier
js-beautify
prettier
)

echo Running: npm install --global "${npm_pkgs[@]}"
time npm install --global "${npm_pkgs[@]}" || track_errors

print_ruler

show_tool_versions_node_short

print_ruler

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

time main "${@}"
59 changes: 59 additions & 0 deletions .github/citools/wasm/wasm-setup-verify
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
#
# .github/citools/wasm/wasm-setup-verify
#

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

declare -i retval=0

declare -A wasm_cmds

wasm_cmds=(
[npm]=$(
command -v npm >&/dev/null
echo "$?"
)
[nodejs]=$(
command -v nodejs >&/dev/null
echo "$?"
)
[yarn]=$(
command -v yarn >&/dev/null
echo "$?"
)
)

main() {
printf "Verifying WebAssembly Installation\n\n"

print_ruler

printf "RBENV_SHELL=%s\n" "${RBENV_SHELL}"
printf "PATH=%s\n" "${PATH}"

print_ruler

for key in "${!wasm_cmds[@]}"; do
if [[ ${wasm_cmds[${key}]} -ne 0 ]]; then
printf "ERROR: command [%s] not found.\n" "${key}"
((retval++))
fi
done

if [[ ${retval} -ne 0 ]]; then
return "${retval}"
fi

print_ruler

show_tool_versions_node

print_ruler

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

time main "${@}"
38 changes: 38 additions & 0 deletions .github/citools/wasm/wasm-test-with-coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# .github/citools/wasm/wasm-test-with-coverage
#

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

declare -i retval=0

main() {
printf "\nRunning WebAssembly Tests With Coverage\n\n"

show_tool_versions_node_short

print_ruler

run_command rm -rf ./coverage

print_ruler

run_command npm run test -- --coverage || ((retval++))

print_ruler

run_command lcov --list ./coverage/lcov.info

print_ruler

run_command lcov --summary ./coverage/lcov.info

print_ruler

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

time main "${@}"
44 changes: 44 additions & 0 deletions .github/docker/layer-02.00-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
#
# .github/docker/layer-02.00-git.sh
#

set -o pipefail

# this path from for the container
# shellcheck disable=SC1091
. /.github/docker/include

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

main() {
declare -i retval=0

layer_begin "${0}" "$@"

declare -a PACKAGES
PACKAGES=(
gh
git-all
git-crypt
git-extras
gitlab-cli
gitlint
)

echo Running: apt update
time apt update || track_errors
printf "\n"

echo Running: apt install -y "${PACKAGES[@]}"
time apt install -y "${PACKAGES[@]}" || track_errors
printf "\n"

layer_end "${0}" "$@"

echo Running: return "${retval}"
return "${retval}"
}

main "${@}" |& tee "${HOME}"/layer-02.00-git.log
Loading
Loading