diff --git a/.github/workflows/get-changed-examples-matrix.yml b/.github/workflows/get-changed-examples-matrix.yml index 529ce8d3a..bcbf7085e 100644 --- a/.github/workflows/get-changed-examples-matrix.yml +++ b/.github/workflows/get-changed-examples-matrix.yml @@ -34,7 +34,6 @@ jobs: examples/** !examples/cargo-make/** !examples/gtk/** - !examples/hackernews_js_fetch/** !examples/Makefile.toml !examples/*.md json: true diff --git a/.github/workflows/run-cargo-make-task.yml b/.github/workflows/run-cargo-make-task.yml index 8aa6c879e..818274506 100644 --- a/.github/workflows/run-cargo-make-task.yml +++ b/.github/workflows/run-cargo-make-task.yml @@ -107,6 +107,11 @@ jobs: fi done + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + # Run Cargo Make Task - name: ${{ inputs.cargo_make_task }} run: | diff --git a/examples/cargo-make/client-process.toml b/examples/cargo-make/client-process.toml index 3eb8554a4..90ee511f0 100644 --- a/examples/cargo-make/client-process.toml +++ b/examples/cargo-make/client-process.toml @@ -3,32 +3,36 @@ [tasks.stop-client] condition = { env_set = ["CLIENT_PROCESS_NAME"] } script = ''' - if [ ! -z $(pidof ${CLIENT_PROCESS_NAME}) ]; then + if pidof -q ${CLIENT_PROCESS_NAME}; then + echo " Stopping ${CLIENT_PROCESS_NAME}" pkill -ef ${CLIENT_PROCESS_NAME} + else + echo " ${CLIENT_PROCESS_NAME} is already stopped" fi ''' [tasks.client-status] condition = { env_set = ["CLIENT_PROCESS_NAME"] } script = ''' - if [ -z $(pidof ${CLIENT_PROCESS_NAME}) ]; then - echo " ${CLIENT_PROCESS_NAME} is not running" - else + if pidof -q ${CLIENT_PROCESS_NAME}; then echo " ${CLIENT_PROCESS_NAME} is up" + else + echo " ${CLIENT_PROCESS_NAME} is not running" fi ''' [tasks.maybe-start-client] condition = { env_set = ["CLIENT_PROCESS_NAME"] } script = ''' - if [ -z $(pidof ${CLIENT_PROCESS_NAME}) ]; then + if pidof -q ${CLIENT_PROCESS_NAME}; then + echo " ${CLIENT_PROCESS_NAME} is already started" + else echo " Starting ${CLIENT_PROCESS_NAME}" - if [ -z ${SPAWN_CLIENT_PROCESS} ];then + if [ -n "${SPAWN_CLIENT_PROCESS}" ];then + echo "Spawning process..." cargo make start-client ${@} & else cargo make start-client ${@} fi - else - echo " ${CLIENT_PROCESS_NAME} is already started" fi ''' diff --git a/examples/cargo-make/deno-build.toml b/examples/cargo-make/deno-build.toml new file mode 100644 index 000000000..30b5f4da2 --- /dev/null +++ b/examples/cargo-make/deno-build.toml @@ -0,0 +1,24 @@ +[tasks.build] +clear = true +command = "deno" +args = ["task", "build"] + +[tasks.start-client] +command = "deno" +args = ["task", "start"] + +[tasks.check] +clear = true +dependencies = ["check-debug", "check-release"] + +[tasks.check-debug] +toolchain = "nightly-2024-01-29" +command = "cargo" +args = ["check-all-features"] +install_crate = "cargo-all-features" + +[tasks.check-release] +toolchain = "nightly-2024-01-29" +command = "cargo" +args = ["check-all-features", "--release"] +install_crate = "cargo-all-features" diff --git a/examples/cargo-make/scripts/web-report.sh b/examples/cargo-make/scripts/web-report.sh index 9359f159a..591b79052 100755 --- a/examples/cargo-make/scripts/web-report.sh +++ b/examples/cargo-make/scripts/web-report.sh @@ -5,7 +5,7 @@ set -emu BOLD="\e[1m" ITALIC="\e[3m" YELLOW="\e[1;33m" -RED="\e[1;36m" +BLUE="\e[1;36m" RESET="\e[0m" function web { #task: only include examples with web cargo-make configuration @@ -87,28 +87,34 @@ function print_crate_tags { *"cargo-make/cargo-leptos.toml"*) crate_tags=$crate_tags"L" ;; + *"cargo-make/deno-build.toml"*) + crate_tags=$crate_tags"D" + ;; esac done <"./Makefile.toml" # Sort tags - local sorted_crate_symbols - sorted_crate_symbols=$(echo "$crate_tags" | grep -o . | sort | tr -d "\n") + local keys + keys=$(echo "$crate_tags" | grep -o . | sort | tr -d "\n") # Find leptos projects that are not configured to build with cargo-leptos - sorted_crate_symbols=${sorted_crate_symbols//"LM"/"L"} + keys=${keys//"LM"/"L"} + + # Find leptos projects that are not configured to build with deno + keys=${keys//"DM"/"D"} # Maybe print line local crate_line=$path if [ -n "$crate_tags" ]; then local color=$YELLOW - case $sorted_crate_symbols in + case $keys in *"M"*) - color=$RED + color=$BLUE ;; esac - crate_line="$crate_line ➤ ${color}$sorted_crate_symbols${RESET}" + crate_line="$crate_line ➤ ${color}$keys${RESET}" echo -e "$crate_line" elif [ "$#" -gt 0 ]; then crate_line="${BOLD}$crate_line${RESET}" @@ -129,16 +135,17 @@ function find_makefile_lines { function print_footer { c="${BOLD}${YELLOW}C${RESET} = Cucumber Test Runner" - d="${BOLD}${YELLOW}F${RESET} = Fantoccini WebDriver" + d="${BOLD}${YELLOW}D${RESET} = Deno" + f="${BOLD}${YELLOW}F${RESET} = Fantoccini WebDriver" l="${BOLD}${YELLOW}L${RESET} = Cargo Leptos" - m="${BOLD}${RED}M${RESET} = Cargo Leptos Metadata Only (${ITALIC}ci is not configured to build with cargo-leptos${RESET})" + m="${BOLD}${BLUE}M${RESET} = Cargo Leptos Metadata Only (${ITALIC}ci is not configured to build with cargo-leptos or deno${RESET})" n="${BOLD}${YELLOW}N${RESET} = Node" p="${BOLD}${YELLOW}P${RESET} = Playwright Test" t="${BOLD}${YELLOW}T${RESET} = Trunk" w="${BOLD}${YELLOW}W${RESET} = WASM Test" echo - echo -e "${ITALIC}Report Keys:${RESET}\n $c\n $d\n $l\n $m\n $n\n $p\n $t\n $w" + echo -e "${ITALIC}Report Keys:${RESET}\n $c\n $d\n $f\n $l\n $m\n $n\n $p\n $t\n $w" echo } diff --git a/examples/cargo-make/server-process.toml b/examples/cargo-make/server-process.toml index d4e323d72..eaae1983e 100644 --- a/examples/cargo-make/server-process.toml +++ b/examples/cargo-make/server-process.toml @@ -3,18 +3,21 @@ [tasks.stop-server] condition = { env_set = ["SERVER_PROCESS_NAME"] } script = ''' - if [ ! -z $(pidof ${SERVER_PROCESS_NAME}) ]; then + if pidof -q ${SERVER_PROCESS_NAME}; then + echo " Stopping ${SERVER_PROCESS_NAME}" pkill -ef ${SERVER_PROCESS_NAME} + else + echo " ${SERVER_PROCESS_NAME} is already stopped" fi ''' [tasks.server-status] condition = { env_set = ["SERVER_PROCESS_NAME"] } script = ''' - if [ -z $(pidof ${SERVER_PROCESS_NAME}) ]; then - echo " ${SERVER_PROCESS_NAME} is not running" - else + if pidof -q ${SERVER_PROCESS_NAME}; then echo " ${SERVER_PROCESS_NAME} is up" + else + echo " ${SERVER_PROCESS_NAME} is not running" fi ''' @@ -24,11 +27,11 @@ script = ''' YELLOW="\e[0;33m" RESET="\e[0m" - if [ -z $(pidof ${SERVER_PROCESS_NAME}) ]; then + if pidof -q ${SERVER_PROCESS_NAME}; then + echo " ${SERVER_PROCESS_NAME} is already started" + else echo " Starting ${SERVER_PROCESS_NAME}" echo " ${YELLOW}>> Run cargo make stop to end process${RESET}" cargo make start-server ${@} & - else - echo " ${SERVER_PROCESS_NAME} is already started" fi ''' diff --git a/examples/cargo-make/webdriver.toml b/examples/cargo-make/webdriver.toml index 57d155c86..b5e4370fb 100644 --- a/examples/cargo-make/webdriver.toml +++ b/examples/cargo-make/webdriver.toml @@ -6,25 +6,33 @@ script = ''' RESET="\e[0m" if command -v chromedriver; then - if [ -z $(pidof chromedriver) ]; then + if pidof -q chromedriver; then + echo " chromedriver is already started" + else + echo "Starting chomedriver" chromedriver --port=4444 & fi else - echo "${RED}${BOLD}ERROR${RESET} - chromedriver is required by this task" + echo "${RED}${BOLD}ERROR${RESET} - chromedriver not found" exit 1 fi ''' [tasks.stop-webdriver] script = ''' - pkill -f "chromedriver" + if pidof -q chromedriver; then + echo " Stopping chromedriver" + pkill -ef "chromedriver" + else + echo " chromedriver is already stopped" + fi ''' [tasks.webdriver-status] script = ''' - if [ -z $(pidof chromedriver) ]; then - echo chromedriver is not running - else + if pidof -q chromedriver; then echo chromedriver is up + else + echo chromedriver is not running fi ''' diff --git a/examples/gtk/Makefile.toml b/examples/gtk/Makefile.toml deleted file mode 100644 index d8bf0a68d..000000000 --- a/examples/gtk/Makefile.toml +++ /dev/null @@ -1,8 +0,0 @@ -[env] -VERIFY_GTK = false - -[tasks.verify-flow] -condition = { env_set = ["VERIFY_GTK"] } - -[tasks.verify] -condition = { env_set = ["VERIFY_GTK"] } diff --git a/examples/hackernews_js_fetch/Makefile.toml b/examples/hackernews_js_fetch/Makefile.toml index 6fe53288a..6d2dcf0bf 100644 --- a/examples/hackernews_js_fetch/Makefile.toml +++ b/examples/hackernews_js_fetch/Makefile.toml @@ -1 +1,8 @@ -extend = [{ path = "../cargo-make/main.toml" }] +extend = [ + { path = "../cargo-make/main.toml" }, + { path = "../cargo-make/deno-build.toml" }, +] + +[env] + +CLIENT_PROCESS_NAME = "deno"