Skip to content
Merged
10 changes: 5 additions & 5 deletions .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule GithubWorkflows do
@preview_app_name "#{@app_name_prefix}-#{@environment_name}"
@preview_app_host "#{@preview_app_name}.fly.dev"
@repo_name "phx_tools"
@shells ["bash", "zsh"]
@shells ["bash", "fish", "zsh"]

def get do
%{
Expand Down Expand Up @@ -392,7 +392,7 @@ defmodule GithubWorkflows do
name: "Test #{os} script with #{shell} shell",
"runs-on": runs_on,
env: [
SHELL: "/bin/#{shell}",
SHELL: shell,
TZ: "America/New_York"
],
steps:
Expand Down Expand Up @@ -443,14 +443,14 @@ defmodule GithubWorkflows do
[
name: "Test the script",
if: "steps.result_cache.outputs.cache-hit != 'true'",
run: "cd test/scripts && expect script.exp #{os}.sh",
shell: "/bin/#{shell} -l {0}"
run: "cd test/scripts && expect script.exp",
shell: "#{shell} -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: "/bin/#{shell} -l {0}"
shell: "#{shell} -l {0}"
],
[
name: "Check HTTP status code",
Expand Down
115 changes: 99 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ jobs:
name: Test Linux script with bash shell
runs-on: ubuntu-latest
env:
SHELL: /bin/bash
SHELL: bash
TZ: America/New_York
steps:
- name: Checkout
Expand All @@ -284,12 +284,12 @@ jobs:
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 Linux.sh
shell: /bin/bash -l {0}
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: /bin/bash -l {0}
shell: bash -l {0}
- name: Check HTTP status code
if: steps.result_cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand All @@ -302,7 +302,7 @@ jobs:
name: Test macOS script with bash shell
runs-on: macos-latest
env:
SHELL: /bin/bash
SHELL: bash
TZ: America/New_York
steps:
- name: Checkout
Expand All @@ -323,12 +323,93 @@ jobs:
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 macOS.sh
shell: /bin/bash -l {0}
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: /bin/bash -l {0}
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
test_linux_fish:
name: Test Linux 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: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/static/Linux.sh
- name: Install shell
if: steps.result_cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo 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
- 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
test_macos_fish:
name: Test macOS script with fish shell
runs-on: macos-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: ${{ runner.os }}-fish-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/script.sh') }}
path: priv/static/macOS.sh
- name: Install shell
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install fish
- 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'
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: brew install 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
Expand All @@ -341,7 +422,7 @@ jobs:
name: Test Linux script with zsh shell
runs-on: ubuntu-latest
env:
SHELL: /bin/zsh
SHELL: zsh
TZ: America/New_York
steps:
- name: Checkout
Expand All @@ -362,12 +443,12 @@ jobs:
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 Linux.sh
shell: /bin/zsh -l {0}
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: /bin/zsh -l {0}
shell: zsh -l {0}
- name: Check HTTP status code
if: steps.result_cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand All @@ -380,7 +461,7 @@ jobs:
name: Test macOS script with zsh shell
runs-on: macos-latest
env:
SHELL: /bin/zsh
SHELL: zsh
TZ: America/New_York
steps:
- name: Checkout
Expand All @@ -404,12 +485,12 @@ jobs:
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 macOS.sh
shell: /bin/zsh -l {0}
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: /bin/zsh -l {0}
shell: zsh -l {0}
- name: Check HTTP status code
if: steps.result_cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand All @@ -433,6 +514,8 @@ jobs:
- unused_deps
- test_linux_bash
- test_macos_bash
- test_linux_fish
- test_macos_fish
- test_linux_zsh
- test_macos_zsh
runs-on: ubuntu-latest
Expand Down
Loading
Loading