Skip to content

Commit e0ce817

Browse files
committed
WIP: testing CI
1 parent 0987d24 commit e0ce817

File tree

4 files changed

+52
-20
lines changed

4 files changed

+52
-20
lines changed

.github/workflows/linux-tests.yml

+34-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
linux_tests:
4545
needs: build_container
4646
runs-on: ubuntu-latest
47+
if: false
4748
container:
4849
image: ghcr.io/${{ github.repository_owner }}/conan-tests:${{ needs.build_container.outputs.image_tag }}
4950
options: --user conan
@@ -90,13 +91,13 @@ jobs:
9091
tests: test/${{ matrix.test-type }}
9192
duration: 20
9293

93-
linux_docker_tests:
94+
linux_runner_tests:
9495
needs: build_container
9596
runs-on: ubuntu-latest
9697
strategy:
9798
matrix:
9899
python-version: [3.12, 3.9]
99-
name: Docker Runner Tests (${{ matrix.python-version }})
100+
name: Runner Tests (${{ matrix.python-version }})
100101
steps:
101102
- name: Set up Python ${{ matrix.python-version }}
102103
uses: actions/setup-python@v5
@@ -113,12 +114,42 @@ jobs:
113114
pip install -r conans/requirements_dev.txt
114115
pip install -r conans/requirements_server.txt
115116
pip install -r conans/requirements_runner.txt
117+
sudo apt-get update && sudo apt-get install -y openssh-server
116118
117-
- name: Run tests
119+
- name: Install OpenSSH Server
120+
run: sudo apt-get update && sudo apt-get install -y openssh-server
121+
122+
- name: Configure SSH Daemon
123+
run: |
124+
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
125+
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
126+
sudo systemctl restart ssh
127+
128+
- name: Generate SSH Keys & Configure Access
129+
run: |
130+
mkdir -p ~/.ssh
131+
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa
132+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
133+
chmod 600 ~/.ssh/authorized_keys
134+
ssh-keyscan localhost >> ~/.ssh/known_hosts
135+
136+
- name: Test SSH Connection
137+
run: ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no localhost "echo 'SSH Connection Successful!'"
138+
139+
- name: Run docker tests
118140
uses: ./.github/actions/test-coverage
119141
with:
120142
python-version: ${{ matrix.python-version }}
121143
test-type: docker
122144
tests: '-m docker_runner -rs'
123145
duration: 20
124146
workers: 1
147+
148+
- name: Run ssh tests
149+
uses: ./.github/actions/test-coverage
150+
with:
151+
python-version: ${{ matrix.python-version }}
152+
test-type: ssh
153+
tests: '-m ssh_runner -rs'
154+
duration: 20
155+
workers: 1

.github/workflows/main.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ jobs:
2020
uses: ./.github/workflows/linux-tests.yml
2121
name: Linux test suite
2222

23-
osx_suite:
24-
uses: ./.github/workflows/osx-tests.yml
25-
name: OSX test suite
26-
27-
windows_suite:
28-
uses: ./.github/workflows/win-tests.yml
29-
name: Windows test suite
23+
# osx_suite:
24+
# uses: ./.github/workflows/osx-tests.yml
25+
# name: OSX test suite
26+
#
27+
# windows_suite:
28+
# uses: ./.github/workflows/win-tests.yml
29+
# name: Windows test suite
3030

3131
code_coverage:
3232
runs-on: ubuntu-latest
3333
name: Code coverage
3434
if: github.ref == 'refs/heads/develop2' # Only measure code coverage on main branch
35-
needs: [linux_suite, osx_suite, windows_suite]
35+
# needs: [linux_suite, osx_suite, windows_suite]
36+
needs: [linux_suite]
3637
steps:
3738
- name: Checkout code
3839
uses: actions/checkout@v4

conan/internal/runner/ssh.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _update_local_cache(self, json_result: str):
259259
if stdout.channel.recv_exit_status() != 0:
260260
raise ConanException("Unable to save remote conan cache state")
261261

262-
with tempfile.TemporaryDirectory(delete=False) as tmp:
262+
with tempfile.TemporaryDirectory() as tmp:
263263
local_cache_tgz = os.path.join(tmp, 'cache.tgz')
264264
self.remote_conn.get(conan_cache_tgz, local_cache_tgz)
265265
self.logger.verbose("Retrieved local cache: " + local_cache_tgz)

test/functional/command/ssh_runner_test.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from pathlib import Path
12
import pytest
23
import textwrap
34
from conan.test.utils.tools import TestClient
@@ -40,8 +41,8 @@ def test_create_ssh_runner_only_host():
4041

4142
assert "[100%] Built target example" in client.out
4243
assert "Restore: pkg/1.0 in pkgc8bc87152b946" in client.out
43-
assert "Restore: pkg/1.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 in b/pkg8070ba4308584/p" in client.out
44-
assert "Restore: pkg/1.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 metadata in b/pkg8070ba4308584/d/metadata" in client.out
44+
assert "Restore: pkg/1.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
45+
assert "Restore: pkg/1.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe metadata" in client.out
4546

4647
@pytest.mark.ssh_runner
4748
def test_create_ssh_runner_with_config():
@@ -88,11 +89,10 @@ def test_create_ssh_runner_with_config():
8889

8990
assert "[100%] Built target example" in client.out
9091
assert "Restore: pkg/2.0 in pkgc6abef0178849" in client.out
91-
assert "Restore: pkg/2.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 in b/pkgc1542b12b96fb/p" in client.out
92-
assert "Restore: pkg/2.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 metadata in b/pkgc1542b12b96fb/d/metadata" in client.out
92+
assert "Restore: pkg/2.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
93+
assert "Restore: pkg/2.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe metadata" in client.out
9394

94-
95-
client.save({".ssh/config": ssh_config}, path='~')
95+
client.save({"config": ssh_config}, path=Path.home() / ".ssh")
9696
profile_host = textwrap.dedent(f"""\
9797
[settings]
9898
arch={{{{ detect_api.detect_arch() }}}}
@@ -113,5 +113,5 @@ def test_create_ssh_runner_with_config():
113113

114114
assert "[100%] Built target example" in client.out
115115
assert "Restore: pkg/2.0 in pkgc6abef0178849" in client.out
116-
assert "Restore: pkg/2.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 in b/pkgc1542b12b96fb/p" in client.out
117-
assert "Restore: pkg/2.0:746e4557a2789d2071a4b9fb6b4960d7d548ced9 metadata in b/pkgc1542b12b96fb/d/metadata" in client.out
116+
assert "Restore: pkg/2.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
117+
assert "Restore: pkg/2.0:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe metadata" in client.out

0 commit comments

Comments
 (0)