Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
almirsarajcic committed Sep 17, 2024
1 parent c28e0a7 commit 2d8398f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 147 deletions.
8 changes: 7 additions & 1 deletion .github/github_workflows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ 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", "fish", "zsh"]
# @shells ["bash", "fish", "zsh"]
@shells ["zsh"]

def get do
%{
Expand Down Expand Up @@ -444,6 +445,11 @@ defmodule GithubWorkflows do
run: "source #{config_file} && make -f test/scripts/Makefile serve",
shell: "/bin/#{shell} -l {0}"
],
[
name: "Setup upterm session",
uses: "lhotari/action-upterm@v1",
if: "always()"
],
[
name: "Check HTTP status code",
if: "steps.result_cache.outputs.cache-hit != 'true'",
Expand Down
76 changes: 3 additions & 73 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,77 +6,6 @@ on:
- main

jobs:
test_linux_bash:
name: Test Linux script with bash shell
runs-on: ubuntu-latest
env:
SHELL: /bin/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: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/static/Linux.sh') }}
path: priv/static/Linux.sh
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y expect
- 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}
- name: Generate an app and start the server
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.bashrc && make -f test/scripts/Makefile serve
shell: /bin/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: /bin/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/static/Linux.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: Test the script
if: steps.result_cache.outputs.cache-hit != 'true'
run: cd test/scripts && expect script.exp Linux.sh
shell: /bin/fish -l {0}
- name: Generate an app and start the server
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.config/fish/config.fish && make -f test/scripts/Makefile serve
shell: /bin/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_linux_zsh:
name: Test Linux script with zsh shell
runs-on: ubuntu-latest
Expand Down Expand Up @@ -106,6 +35,9 @@ jobs:
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.zshrc && make -f test/scripts/Makefile serve
shell: /bin/zsh -l {0}
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: always()
- name: Check HTTP status code
if: steps.result_cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand All @@ -117,8 +49,6 @@ jobs:
deploy_production_app:
name: Deploy production app
needs:
- test_linux_bash
- test_linux_fish
- test_linux_zsh
runs-on: ubuntu-latest
steps:
Expand Down
76 changes: 3 additions & 73 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,77 +10,6 @@ on:
- synchronize

jobs:
test_linux_bash:
name: Test Linux script with bash shell
runs-on: ubuntu-latest
env:
SHELL: /bin/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: ${{ runner.os }}-bash-script-${{ hashFiles('test/scripts/script.exp') }}-${{ hashFiles('priv/static/Linux.sh') }}
path: priv/static/Linux.sh
- name: Install expect tool
if: steps.result_cache.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y expect
- 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}
- name: Generate an app and start the server
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.bashrc && make -f test/scripts/Makefile serve
shell: /bin/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: /bin/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/static/Linux.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: Test the script
if: steps.result_cache.outputs.cache-hit != 'true'
run: cd test/scripts && expect script.exp Linux.sh
shell: /bin/fish -l {0}
- name: Generate an app and start the server
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.config/fish/config.fish && make -f test/scripts/Makefile serve
shell: /bin/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_linux_zsh:
name: Test Linux script with zsh shell
runs-on: ubuntu-latest
Expand Down Expand Up @@ -110,6 +39,9 @@ jobs:
if: steps.result_cache.outputs.cache-hit != 'true'
run: source ~/.zshrc && make -f test/scripts/Makefile serve
shell: /bin/zsh -l {0}
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: always()
- name: Check HTTP status code
if: steps.result_cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
Expand All @@ -121,8 +53,6 @@ jobs:
deploy_preview_app:
name: Deploy preview app
needs:
- test_linux_bash
- test_linux_fish
- test_linux_zsh
runs-on: ubuntu-latest
permissions: write-all
Expand Down
2 changes: 2 additions & 0 deletions test/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SHELL := /bin/zsh

.ONESHELL:
.SHELLFLAGS := -euo pipefail -c

serve:
initdb -D ~/pgdata -U postgres
Expand Down

0 comments on commit 2d8398f

Please sign in to comment.