From 2d8398f137fb3bb44f54efefaecf2eb2a62cfc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Almir=20Saraj=C4=8Di=C4=87?= Date: Tue, 17 Sep 2024 19:38:39 +0200 Subject: [PATCH] Try again --- .github/github_workflows.ex | 8 +++- .github/workflows/main.yml | 76 ++----------------------------------- .github/workflows/pr.yml | 76 ++----------------------------------- test/scripts/Makefile | 2 + 4 files changed, 15 insertions(+), 147 deletions(-) diff --git a/.github/github_workflows.ex b/.github/github_workflows.ex index f4351cfb..0a7056e8 100644 --- a/.github/github_workflows.ex +++ b/.github/github_workflows.ex @@ -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 %{ @@ -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'", diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 417b9992..abfaef70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 @@ -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: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9693fd8b..4ab38960 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -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 @@ -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 @@ -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 diff --git a/test/scripts/Makefile b/test/scripts/Makefile index f22f3ce9..1e4c3fb4 100644 --- a/test/scripts/Makefile +++ b/test/scripts/Makefile @@ -1,5 +1,7 @@ SHELL := /bin/zsh + .ONESHELL: +.SHELLFLAGS := -euo pipefail -c serve: initdb -D ~/pgdata -U postgres