Skip to content

Commit

Permalink
starting adding support for running tests targeted at an ssh host run…
Browse files Browse the repository at this point in the history
…ning inside GH Action
  • Loading branch information
DinisCruz committed May 30, 2024
1 parent ab7eb73 commit 342be48
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/run-tests-with-ssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run tests (aimed at SSH server)

on:
push

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3


- name: Generate SSH key
id: ssh-key
run: |
ssh-keygen -t rsa -b 4096 -f /tmp/ssh_key -N ""
echo "::set-output name=private_key::$(cat /tmp/ssh_key)"
echo "::set-output name=public_key::$(cat /tmp/ssh_key.pub)"
- name: Start Docker container
run: |
docker run -d --name test_container -e AUTHORIZED_KEYS="$(cat /tmp/ssh_key.pub)" diniscruz/python_with_ssh
- name: Wait for Docker container to be ready
run: sleep 10

- name: Run a simple SSH command
run: |
ssh -o StrictHostKeyChecking=no -i /tmp/ssh_key root@localhost -p 2222 echo "SSH connection successful"
# - name: Run tests
# run: |
# # Add your test commands here
# docker exec test_container <your_test_command>

- name: Stop and remove Docker container
run: |
docker stop test_container
docker rm test_container
4 changes: 2 additions & 2 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name : Run Tests - Unit
on:
push:
#pull_request:
#push:
pull_request:


jobs:
Expand Down

0 comments on commit 342be48

Please sign in to comment.