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 22841c0
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/tests/generic_tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
inputs:
name:
description: 'Your name'
default: 'No name provided'
runs:
using: "composite"
steps:
- run: echo Hello ${{ inputs.name }}.
shell: bash
- run: echo "Nice to meet you!"
shell: pwsh
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
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

# jobs:
- name: Run generic tests
uses: luchihoratiu/debug-via-ssh/.github/tests/generic_tests@dev
with:
name: OctoCat
testing:
uses: luchihoratiu/debug-via-ssh/.github/workflows/generic_tests.yml@dev
with:
os: Ubuntu
27 changes: 27 additions & 0 deletions .github/workflows/ubuntu-20.04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ubuntu 20.04

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

on:
push:

jobs:
generic_tests:
name: Generic tests
runs-on: ubuntu-20.04
steps:
- name: Run debug-via-ssh
id: dvs
uses: luchihoratiu/debug-via-ssh@dev
with:
SSH_PASS: ${{ secrets.SSH_PASS }}
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
- name: Get address
run: |
echo ${{steps.dvs.outputs.ssh_address}}
29 changes: 29 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,8 @@ runs:
sleep 10
time=$((time-10))
echo "ssh_address=ok" >> $GITHUB_OUTPUT
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 22841c0

Please sign in to comment.