From e163d2dcb5c2b21a233b60f1f4822623145dc33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Almir=20Saraj=C4=8Di=C4=87?= Date: Wed, 20 Nov 2024 14:33:36 +0100 Subject: [PATCH 1/2] Support other Linux distributions --- .github/github_workflows.ex | 37 ++- .github/workflows/main.yml | 439 +++++++++++++++++++++++++++++++++--- .github/workflows/pr.yml | 439 +++++++++++++++++++++++++++++++++--- priv/script.sh | 100 +++++++- 4 files changed, 939 insertions(+), 76 deletions(-) diff --git a/.github/github_workflows.ex b/.github/github_workflows.ex index a3fbd8a8..f0cf4c1d 100644 --- a/.github/github_workflows.ex +++ b/.github/github_workflows.ex @@ -372,10 +372,17 @@ defmodule GithubWorkflows do end defp test_scripts_jobs do + linux_job = fn image, shell, install_command -> + {:"test_#{image}_#{shell}", test_linux_script_job(image, shell, install_command)} + end + Enum.reduce(@shells, [], fn shell, jobs -> jobs ++ [ - {:"test_linux_#{shell}", test_linux_script_job(shell)}, + linux_job.("ubuntu", shell, "apt-get install -y"), + linux_job.("fedora", shell, "dnf install -y"), + linux_job.("arch", shell, "pacman -Sy --noconfirm"), + linux_job.("alpine", shell, "apk add --no-cache"), {:"test_macos_#{shell}", test_macos_script_job(shell)} ] end) @@ -404,8 +411,8 @@ defmodule GithubWorkflows do id: "result_cache", with: [ key: - "${{ runner.os }}-#{shell}-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}", - path: "priv/static/#{os}.sh" + "#{os}-#{shell}-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}", + path: "priv/script.sh" ] ] ] ++ @@ -419,16 +426,16 @@ defmodule GithubWorkflows do ] ] ) ++ - if(os == "Linux", - do: [], - else: [ + if(os == "macOS", + do: [ [ name: "Disable password prompt for macOS", if: "steps.result_cache.outputs.cache-hit != 'true'", run: ~S ] - ] + ], + else: [] ) ++ [ [ @@ -468,14 +475,20 @@ defmodule GithubWorkflows do ] end - defp test_linux_script_job(shell) do + defp test_linux_script_job(image, shell, install_command) do test_shell_script_job( - expect_install_command: "sudo apt-get update && sudo apt-get install -y expect", - os: "Linux", + expect_install_command: "#{install_command} expect", + os: String.capitalize(image), runs_on: "ubuntu-latest", shell: shell, - shell_install_command: "sudo apt-get update && sudo apt-get install -y #{shell}" - ) + shell_install_command: "#{install_command} #{shell}" + ) ++ + [ + container: [ + image: "#{image}:latest", + options: "--user root" + ] + ] end defp test_macos_script_job(shell) do diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f521bfd4..363bde59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -262,8 +262,8 @@ jobs: env: MIX_ENV: test run: mix deps.unlock --check-unused - test_linux_bash: - name: Test Linux script with bash shell + test_ubuntu_bash: + name: Test Ubuntu script with bash shell runs-on: ubuntu-latest env: SHELL: bash @@ -275,11 +275,11 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Ubuntu-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -298,6 +298,126 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_bash: + name: Test Fedora script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_bash: + name: Test Arch script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_bash: + name: Test Alpine script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Alpine-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_bash: name: Test macOS script with bash shell runs-on: macos-latest @@ -311,8 +431,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Disable password prompt for macOS if: steps.result_cache.outputs.cache-hit != 'true' run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers' @@ -337,8 +457,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_linux_fish: - name: Test Linux script with fish shell + test_ubuntu_fish: + name: Test Ubuntu script with fish shell runs-on: ubuntu-latest env: SHELL: fish @@ -350,14 +470,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Ubuntu-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y fish + run: apt-get install -y fish - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -376,6 +496,135 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_fish: + name: Test Fedora script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_fish: + name: Test Arch script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_fish: + name: Test Alpine script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Alpine-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_fish: name: Test macOS script with fish shell runs-on: macos-latest @@ -389,8 +638,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' run: brew install fish @@ -418,8 +667,134 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_linux_zsh: - name: Test Linux script with zsh shell + test_ubuntu_zsh: + name: Test Ubuntu script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Ubuntu-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: apt-get install -y zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apt-get install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_zsh: + name: Test Fedora script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_zsh: + name: Test Arch script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_zsh: + name: Test Alpine script with zsh shell runs-on: ubuntu-latest env: SHELL: zsh @@ -431,14 +806,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Alpine-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y zsh + run: apk add --no-cache zsh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apk add --no-cache expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -457,6 +832,9 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_zsh: name: Test macOS script with zsh shell runs-on: macos-latest @@ -470,8 +848,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' run: brew install zsh @@ -512,11 +890,20 @@ jobs: - sobelow - test - unused_deps - - test_linux_bash + - test_ubuntu_bash + - test_fedora_bash + - test_arch_bash + - test_alpine_bash - test_macos_bash - - test_linux_fish + - test_ubuntu_fish + - test_fedora_fish + - test_arch_fish + - test_alpine_fish - test_macos_fish - - test_linux_zsh + - test_ubuntu_zsh + - test_fedora_zsh + - test_arch_zsh + - test_alpine_zsh - test_macos_zsh runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7be7f494..2b6890c1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -266,8 +266,8 @@ jobs: env: MIX_ENV: test run: mix deps.unlock --check-unused - test_linux_bash: - name: Test Linux script with bash shell + test_ubuntu_bash: + name: Test Ubuntu script with bash shell runs-on: ubuntu-latest env: SHELL: bash @@ -279,11 +279,11 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Ubuntu-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -302,6 +302,126 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_bash: + name: Test Fedora script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_bash: + name: Test Arch script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_bash: + name: Test Alpine script with bash shell + runs-on: ubuntu-latest + env: + SHELL: bash + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Alpine-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: bash -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: bash -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_bash: name: Test macOS script with bash shell runs-on: macos-latest @@ -315,8 +435,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Disable password prompt for macOS if: steps.result_cache.outputs.cache-hit != 'true' run: 'sudo sed -i "" "s/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g" /etc/sudoers' @@ -341,8 +461,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_linux_fish: - name: Test Linux script with fish shell + test_ubuntu_fish: + name: Test Ubuntu script with fish shell runs-on: ubuntu-latest env: SHELL: fish @@ -354,14 +474,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Ubuntu-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y fish + run: apt-get install -y fish - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -380,6 +500,135 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_fish: + name: Test Fedora script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_fish: + name: Test Arch script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_fish: + name: Test Alpine script with fish shell + runs-on: ubuntu-latest + env: + SHELL: fish + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Alpine-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache fish + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apk add --no-cache expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: fish -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: fish -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_fish: name: Test macOS script with fish shell runs-on: macos-latest @@ -393,8 +642,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' run: brew install fish @@ -422,8 +671,134 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_linux_zsh: - name: Test Linux script with zsh shell + test_ubuntu_zsh: + name: Test Ubuntu script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Ubuntu-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: apt-get install -y zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: apt-get install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: ubuntu:latest + options: --user root + test_fedora_zsh: + name: Test Fedora script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Fedora-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: dnf install -y expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: fedora:latest + options: --user root + test_arch_zsh: + name: Test Arch script with zsh shell + runs-on: ubuntu-latest + env: + SHELL: zsh + TZ: America/New_York + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Restore script result cache + uses: actions/cache@v3 + id: result_cache + with: + key: Arch-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh + - name: Install shell + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm zsh + - name: Install expect tool + if: steps.result_cache.outputs.cache-hit != 'true' + run: pacman -Sy --noconfirm expect + - name: Remove mise config files + run: rm -f .mise.toml .tool-versions + - name: Test the script + if: steps.result_cache.outputs.cache-hit != 'true' + run: cd test/scripts && expect script.exp + shell: zsh -l {0} + - name: Generate an app and start the server + if: steps.result_cache.outputs.cache-hit != 'true' + run: make -f test/scripts/Makefile serve + shell: zsh -l {0} + - name: Check HTTP status code + if: steps.result_cache.outputs.cache-hit != 'true' + uses: nick-fields/retry@v2 + with: + command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh + max_attempts: 7 + retry_wait_seconds: 5 + timeout_seconds: 1 + container: + image: arch:latest + options: --user root + test_alpine_zsh: + name: Test Alpine script with zsh shell runs-on: ubuntu-latest env: SHELL: zsh @@ -435,14 +810,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/Linux.sh + key: Alpine-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y zsh + run: apk add --no-cache zsh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: sudo apt-get update && sudo apt-get install -y expect + run: apk add --no-cache expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -461,6 +836,9 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 + container: + image: alpine:latest + options: --user root test_macos_zsh: name: Test macOS script with zsh shell runs-on: macos-latest @@ -474,8 +852,8 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/static/macOS.sh + key: macOS-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' run: brew install zsh @@ -516,11 +894,20 @@ jobs: - sobelow - test - unused_deps - - test_linux_bash + - test_ubuntu_bash + - test_fedora_bash + - test_arch_bash + - test_alpine_bash - test_macos_bash - - test_linux_fish + - test_ubuntu_fish + - test_fedora_fish + - test_arch_fish + - test_alpine_fish - test_macos_fish - - test_linux_zsh + - test_ubuntu_zsh + - test_fedora_zsh + - test_arch_zsh + - test_alpine_zsh - test_macos_zsh runs-on: ubuntu-latest permissions: write-all diff --git a/priv/script.sh b/priv/script.sh index 52ff06b4..03f228e9 100755 --- a/priv/script.sh +++ b/priv/script.sh @@ -51,10 +51,30 @@ esac # Add OS detection OS="$(uname -s)" +get_package_manager() { + if command -v apt-get >/dev/null; then + echo "apt" + elif command -v dnf >/dev/null; then + echo "dnf" + elif command -v pacman >/dev/null; then + echo "pacman" + elif command -v apk >/dev/null; then + echo "apk" + else + printf "Unsupported package manager. This script requires apt, dnf, pacman, or apk.\n" + exit 1 + fi +} + case "${OS}" in -Linux*) os_type=Linux ;; -Darwin*) os_type=macOS ;; -*) + Linux*) + os_type=Linux + package_manager=$(get_package_manager) + ;; + Darwin*) + os_type=macOS + ;; + *) printf "Unsupported OS: %s\n" "${OS}" exit 1 ;; @@ -97,8 +117,21 @@ install() { case "$1" in "Elixir") if [ "$os_type" = "Linux" ]; then - sudo apt-get update - sudo apt-get install -y unzip + case "$package_manager" in + "apt") + sudo apt-get update + sudo apt-get install -y unzip + ;; + "dnf") + sudo dnf install -y unzip + ;; + "pacman") + sudo pacman -Sy --noconfirm unzip + ;; + "apk") + sudo apk add --no-cache unzip + ;; + esac fi mise use -g -y elixir@$elixir_version @@ -113,18 +146,48 @@ install() { ulimit -n 1024 else - sudo apt-get update - sudo apt-get install -y build-essential automake autoconf libssl-dev libncurses5-dev + case "$package_manager" in + "apt") + sudo apt-get update + sudo apt-get install -y build-essential automake autoconf libssl-dev libncurses5-dev + ;; + "dnf") + sudo dnf groupinstall -y "Development Tools" + sudo dnf install -y openssl-devel ncurses-devel + ;; + "pacman") + sudo pacman -Sy --noconfirm base-devel openssl ncurses + ;; + "apk") + sudo apk add --no-cache build-base autoconf openssl-dev ncurses-dev + ;; + esac if [ ! -f ~/.kerlrc ]; then printf "KERL_CONFIGURE_OPTIONS=\"--without-javac\"\n" >~/.kerlrc fi fi mise use -g -y erlang@$erlang_version + ;; "git") - sudo apt-get update - sudo apt-get -y install git + if [ "$os_type" = "Linux" ]; then + case "$package_manager" in + "apt") + sudo apt-get update + sudo apt-get install -y git + ;; + "dnf") + sudo dnf install -y git + ;; + "pacman") + sudo pacman -Sy --noconfirm git + ;; + "apk") + sudo apk add --no-cache git + ;; + esac + fi ;; "Homebrew") NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" @@ -178,10 +241,23 @@ install() { if [ "$os_type" = "macOS" ]; then brew install gcc readline zlib curl ossp-uuid else - sudo apt-get update - sudo apt-get -y install linux-headers-generic build-essential libssl-dev libreadline-dev zlib1g-dev libcurl4-openssl-dev uuid-dev icu-devtools + case "$package_manager" in + "apt") + sudo apt-get update + sudo apt-get install -y linux-headers-generic build-essential libssl-dev libreadline-dev zlib1g-dev libcurl4-openssl-dev uuid-dev icu-devtools + ;; + "dnf") + sudo dnf groupinstall -y "Development Tools" + sudo dnf install -y kernel-headers openssl-devel readline-devel zlib-devel libcurl-devel libuuid-devel libicu-devel + ;; + "pacman") + sudo pacman -Sy --noconfirm linux-headers base-devel openssl readline zlib curl util-linux icu + ;; + "apk") + sudo apk add --no-cache linux-headers build-base openssl-dev readline-dev zlib-dev curl-dev util-linux-dev icu-dev + ;; + esac fi - mise use -g -y postgres@$postgres_version ;; "Xcode Command Line Tools") From 7a5a88cd8520fc9616260e8bcf70f3a2231dd811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Almir=20Saraj=C4=8Di=C4=87?= Date: Wed, 20 Nov 2024 14:40:56 +0100 Subject: [PATCH 2/2] Pray for the best --- .github/github_workflows.ex | 35 +-- .github/workflows/main.yml | 427 ++---------------------------------- .github/workflows/pr.yml | 427 ++---------------------------------- 3 files changed, 51 insertions(+), 838 deletions(-) diff --git a/.github/github_workflows.ex b/.github/github_workflows.ex index f0cf4c1d..01f65100 100644 --- a/.github/github_workflows.ex +++ b/.github/github_workflows.ex @@ -372,17 +372,10 @@ defmodule GithubWorkflows do end defp test_scripts_jobs do - linux_job = fn image, shell, install_command -> - {:"test_#{image}_#{shell}", test_linux_script_job(image, shell, install_command)} - end - Enum.reduce(@shells, [], fn shell, jobs -> jobs ++ [ - linux_job.("ubuntu", shell, "apt-get install -y"), - linux_job.("fedora", shell, "dnf install -y"), - linux_job.("arch", shell, "pacman -Sy --noconfirm"), - linux_job.("alpine", shell, "apk add --no-cache"), + {:"test_linux_#{shell}", test_linux_script_job(shell)}, {:"test_macos_#{shell}", test_macos_script_job(shell)} ] end) @@ -411,7 +404,7 @@ defmodule GithubWorkflows do id: "result_cache", with: [ key: - "#{os}-#{shell}-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}", + "${{ runner.os }}-#{shell}-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}", path: "priv/script.sh" ] ] @@ -426,16 +419,16 @@ defmodule GithubWorkflows do ] ] ) ++ - if(os == "macOS", - do: [ + if(os == "Linux", + do: [], + else: [ [ name: "Disable password prompt for macOS", if: "steps.result_cache.outputs.cache-hit != 'true'", run: ~S ] - ], - else: [] + ] ) ++ [ [ @@ -475,20 +468,14 @@ defmodule GithubWorkflows do ] end - defp test_linux_script_job(image, shell, install_command) do + defp test_linux_script_job(shell) do test_shell_script_job( - expect_install_command: "#{install_command} expect", - os: String.capitalize(image), + expect_install_command: "sudo apt-get update && sudo apt-get install -y expect", + os: "Linux", runs_on: "ubuntu-latest", shell: shell, - shell_install_command: "#{install_command} #{shell}" - ) ++ - [ - container: [ - image: "#{image}:latest", - options: "--user root" - ] - ] + shell_install_command: "sudo apt-get update && sudo apt-get install -y #{shell}" + ) end defp test_macos_script_job(shell) do diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 363bde59..3ac33b65 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -262,8 +262,8 @@ jobs: env: MIX_ENV: test run: mix deps.unlock --check-unused - test_ubuntu_bash: - name: Test Ubuntu script with bash shell + test_linux_bash: + name: Test Linux script with bash shell runs-on: ubuntu-latest env: SHELL: bash @@ -275,11 +275,11 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Ubuntu-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -298,126 +298,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_bash: - name: Test Fedora script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_bash: - name: Test Arch script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Arch-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_bash: - name: Test Alpine script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Alpine-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_bash: name: Test macOS script with bash shell runs-on: macos-latest @@ -431,7 +311,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Disable password prompt for macOS if: steps.result_cache.outputs.cache-hit != 'true' @@ -457,92 +337,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_ubuntu_fish: - name: Test Ubuntu script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Ubuntu-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_fish: - name: Test Fedora script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_fish: - name: Test Arch script with fish shell + test_linux_fish: + name: Test Linux script with fish shell runs-on: ubuntu-latest env: SHELL: fish @@ -554,14 +350,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Arch-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm fish + run: sudo apt-get update && sudo apt-get install -y fish - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -580,51 +376,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_fish: - name: Test Alpine script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Alpine-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_fish: name: Test macOS script with fish shell runs-on: macos-latest @@ -638,7 +389,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' @@ -667,134 +418,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_ubuntu_zsh: - name: Test Ubuntu script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Ubuntu-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_zsh: - name: Test Fedora script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_zsh: - name: Test Arch script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Arch-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_zsh: - name: Test Alpine script with zsh shell + test_linux_zsh: + name: Test Linux script with zsh shell runs-on: ubuntu-latest env: SHELL: zsh @@ -806,14 +431,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Alpine-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache zsh + run: sudo apt-get update && sudo apt-get install -y zsh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -832,9 +457,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_zsh: name: Test macOS script with zsh shell runs-on: macos-latest @@ -848,7 +470,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' @@ -890,20 +512,11 @@ jobs: - sobelow - test - unused_deps - - test_ubuntu_bash - - test_fedora_bash - - test_arch_bash - - test_alpine_bash + - test_linux_bash - test_macos_bash - - test_ubuntu_fish - - test_fedora_fish - - test_arch_fish - - test_alpine_fish + - test_linux_fish - test_macos_fish - - test_ubuntu_zsh - - test_fedora_zsh - - test_arch_zsh - - test_alpine_zsh + - test_linux_zsh - test_macos_zsh runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2b6890c1..ae8bcd6a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -266,8 +266,8 @@ jobs: env: MIX_ENV: test run: mix deps.unlock --check-unused - test_ubuntu_bash: - name: Test Ubuntu script with bash shell + test_linux_bash: + name: Test Linux script with bash shell runs-on: ubuntu-latest env: SHELL: bash @@ -279,11 +279,11 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Ubuntu-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -302,126 +302,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_bash: - name: Test Fedora script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_bash: - name: Test Arch script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Arch-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_bash: - name: Test Alpine script with bash shell - runs-on: ubuntu-latest - env: - SHELL: bash - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Alpine-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: bash -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: bash -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_bash: name: Test macOS script with bash shell runs-on: macos-latest @@ -435,7 +315,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Disable password prompt for macOS if: steps.result_cache.outputs.cache-hit != 'true' @@ -461,92 +341,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_ubuntu_fish: - name: Test Ubuntu script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Ubuntu-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_fish: - name: Test Fedora script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_fish: - name: Test Arch script with fish shell + test_linux_fish: + name: Test Linux script with fish shell runs-on: ubuntu-latest env: SHELL: fish @@ -558,14 +354,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Arch-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm fish + run: sudo apt-get update && sudo apt-get install -y fish - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -584,51 +380,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_fish: - name: Test Alpine script with fish shell - runs-on: ubuntu-latest - env: - SHELL: fish - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Alpine-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache fish - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: fish -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: fish -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_fish: name: Test macOS script with fish shell runs-on: macos-latest @@ -642,7 +393,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' @@ -671,134 +422,8 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - test_ubuntu_zsh: - name: Test Ubuntu script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Ubuntu-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: apt-get install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: ubuntu:latest - options: --user root - test_fedora_zsh: - name: Test Fedora script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Fedora-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: dnf install -y expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: fedora:latest - options: --user root - test_arch_zsh: - name: Test Arch script with zsh shell - runs-on: ubuntu-latest - env: - SHELL: zsh - TZ: America/New_York - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Restore script result cache - uses: actions/cache@v3 - id: result_cache - with: - key: Arch-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} - path: priv/script.sh - - name: Install shell - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm zsh - - name: Install expect tool - if: steps.result_cache.outputs.cache-hit != 'true' - run: pacman -Sy --noconfirm expect - - name: Remove mise config files - run: rm -f .mise.toml .tool-versions - - name: Test the script - if: steps.result_cache.outputs.cache-hit != 'true' - run: cd test/scripts && expect script.exp - shell: zsh -l {0} - - name: Generate an app and start the server - if: steps.result_cache.outputs.cache-hit != 'true' - run: make -f test/scripts/Makefile serve - shell: zsh -l {0} - - name: Check HTTP status code - if: steps.result_cache.outputs.cache-hit != 'true' - uses: nick-fields/retry@v2 - with: - command: INPUT_SITES='["http://localhost:4000"]' INPUT_EXPECTED='[200]' ./test/scripts/check_status_code.sh - max_attempts: 7 - retry_wait_seconds: 5 - timeout_seconds: 1 - container: - image: arch:latest - options: --user root - test_alpine_zsh: - name: Test Alpine script with zsh shell + test_linux_zsh: + name: Test Linux script with zsh shell runs-on: ubuntu-latest env: SHELL: zsh @@ -810,14 +435,14 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: Alpine-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache zsh + run: sudo apt-get update && sudo apt-get install -y zsh - name: Install expect tool if: steps.result_cache.outputs.cache-hit != 'true' - run: apk add --no-cache expect + run: sudo apt-get update && sudo apt-get install -y expect - name: Remove mise config files run: rm -f .mise.toml .tool-versions - name: Test the script @@ -836,9 +461,6 @@ jobs: max_attempts: 7 retry_wait_seconds: 5 timeout_seconds: 1 - container: - image: alpine:latest - options: --user root test_macos_zsh: name: Test macOS script with zsh shell runs-on: macos-latest @@ -852,7 +474,7 @@ jobs: uses: actions/cache@v3 id: result_cache with: - key: macOS-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} + key: ${{ runner.os }}-zsh-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }} path: priv/script.sh - name: Install shell if: steps.result_cache.outputs.cache-hit != 'true' @@ -894,20 +516,11 @@ jobs: - sobelow - test - unused_deps - - test_ubuntu_bash - - test_fedora_bash - - test_arch_bash - - test_alpine_bash + - test_linux_bash - test_macos_bash - - test_ubuntu_fish - - test_fedora_fish - - test_arch_fish - - test_alpine_fish + - test_linux_fish - test_macos_fish - - test_ubuntu_zsh - - test_fedora_zsh - - test_arch_zsh - - test_alpine_zsh + - test_linux_zsh - test_macos_zsh runs-on: ubuntu-latest permissions: write-all