-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (47 loc) · 1.46 KB
/
run-tests-with-ssh.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Run tests (aimed at SSH server)
on:
workflow_dispatch:
workflow_run:
workflows: ["Run Tests - Unit"]
types:
- completed
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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 ""
chmod 600 /tmp/ssh_key
- name: Start Docker container
run: |
docker run -d -p 22222:22 --name test_container -e AUTHORIZED_KEYS="$(cat /tmp/ssh_key.pub)" diniscruz/python_with_ssh
- name: Install test dependencies
run: |
pip install pytest
pip install -e .
- name: Run tests (targeted at 'python_with_ssh' docker container) )
env:
SSH__HOST: localhost
SSH__PORT: 22222
SSH__KEY_FILE: /tmp/ssh_key
SSH__USER: root
run: |
pytest tests/helpers/ssh
- name: Viewing docker logs
run: |
echo ======= docker logs =======
docker logs test_container
echo ======= docker logs =======
- name: Run tests (all in osbot-utils)
run: |
pytest tests
- name: Stop and remove Docker container
run: |
docker stop test_container
docker rm test_container