Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
luchihoratiu authored and Luchi committed Apr 17, 2023
1 parent a47bd4a commit a2b21a8
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/generic_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Generic tests

on:
workflow_call:
inputs:
os:
description: Operating system
required: true
type: string

jobs:
generic_tests:
name: Generic tests
runs-on: ubuntu-latest
steps:
- name: step1
run: |
echo 'Hello, ${{ inputs.os }}!'
ls
exit 1
11 changes: 11 additions & 0 deletions .github/workflows/steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on:
push:

jobs:
my-job:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: echo
run: echo "yes"
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Tests the action

on:
push:

jobs:
run_action:
runs-on: ubuntu-latest
name: Run action
steps:
- id: yay
uses: luchihoratiu/debug-via-ssh@dev
with:
SSH_PASS: ${{ secrets.SSH_PASS }}
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
- name: Disable workflow commands
run: |
echo '::warning:: This is a warning message, to demonstrate that commands are being processed.'
stopMarker=$(uuidgen)
echo "::stop-commands::$stopMarker"
echo '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.'
echo "::$stopMarker::"
echo '::warning:: This is a warning again, because stop-commands has been turned off.'
echo "### Hello world! :rocket:" >> $GITHUB_STEP_SUMMARY
- name: sleep
run: |
no="${{ steps.yay.outputs.ssh_address_bad }}"
echo $no
yes="${{ steps.yay.outputs.ssh_address_good }}"
echo $yes
echo "This is the lead in sentence for the list" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY # this is a blank line
echo "- Lets add a bullet point" >> $GITHUB_STEP_SUMMARY
echo "- Lets add a second bullet point" >> $GITHUB_STEP_SUMMARY
echo "- How about a third one?" >> $GITHUB_STEP_SUMMARY
testing:
uses: luchihoratiu/debug-via-ssh/.github/workflows/generic_tests.yml@dev
with:
os: Ubuntu
10 changes: 10 additions & 0 deletions .github/yes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: My Workflowz
on:
push:

jobs:
my-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: luchihoratiu/debug-via-ssh/.github/workflows/steps.yml@dev
31 changes: 31 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,35 @@ inputs:
NGROK_TIMEOUT:
description: 'Timeout in seconds for ngrok session'
default: 21500
outputs:
ssh_address:
value: ${{ steps.end.outputs.ssh_address }}
runs:
using: "composite"
steps:
- name: Add scripts path
run: |
# mkdir -p ~/work/_actions/luchihoratiu/debug-via-ssh/otherversion/.github
pattern=~/work/_actions/luchihoratiu/debug-via-ssh/**/scripts
paths=( $pattern )
path="${paths[0]}"
chmod +x "${path}"/**
echo "$path" >> $GITHUB_PATH
shell: bash
- name: Check bash
run: |
echo $PATH
test.sh
shell: bash
- name: Check pwsh
run: |
test.ps1
shell: pwsh

# - name: STOP
# run: exit 1
# shell: bash

- name: Check inputs
run: |
if [ -z "${{ inputs.SSH_PASS }}" ]
Expand Down Expand Up @@ -104,6 +130,7 @@ runs:
shell: bash

- name: Start ngrok
id: end
run: |
printf "# Starting ngrok..."
./ngrok tcp 22 --log ".ngrok.log" --region "${{ inputs.NGROK_REGION }}" &
Expand Down Expand Up @@ -145,6 +172,10 @@ runs:
sleep 10
time=$((time-10))
echo ::set-output name=ssh_address_bad::$ssh_string
echo "{ssh_address_new}={$ssh_string}" >> $GITHUB_STATE
ls
exit 0
done
echo "# SSH session terminated. Allowing workflow to continue..."
Expand Down
1 change: 1 addition & 0 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Write-Output "This works with *.ps1 script!"
1 change: 1 addition & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "This works with *.sh script!"

0 comments on commit a2b21a8

Please sign in to comment.