Merge actions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Push Docker Image
|
name: Build, Test and Push Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,8 +6,36 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
e2e-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t ssh-server-test .
|
||||||
|
|
||||||
|
- name: Run SSH server
|
||||||
|
run: |
|
||||||
|
docker run --rm -d --name ssh-server-test -p 2223:22 -e COMMAND="echo 'SSH connection successful'" ssh-server-test
|
||||||
|
|
||||||
|
- name: Wait for server to start
|
||||||
|
run: sleep 5
|
||||||
|
|
||||||
|
- name: Test SSH connection
|
||||||
|
run: |
|
||||||
|
output=$(ssh -p 2223 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost "echo test")
|
||||||
|
if [ "$output" = "test" ]; then
|
||||||
|
echo "SSH connection test passed"
|
||||||
|
else
|
||||||
|
echo "SSH connection test failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: e2e-test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
name: E2E Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
e2e-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
run: docker build -t ssh-server-test .
|
|
||||||
|
|
||||||
- name: Run SSH server
|
|
||||||
run: |
|
|
||||||
docker run -d --name ssh-server-test -p 2223:22 -e COMMAND="echo 'SSH connection successful'" ssh-server-test
|
|
||||||
|
|
||||||
- name: Wait for server to start
|
|
||||||
run: sleep 5
|
|
||||||
|
|
||||||
- name: Test SSH connection
|
|
||||||
run: |
|
|
||||||
output=$(ssh -p 2223 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost "echo test")
|
|
||||||
if [ "$output" = "test" ]; then
|
|
||||||
echo "SSH connection test passed"
|
|
||||||
else
|
|
||||||
echo "SSH connection test failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Cleanup
|
|
||||||
run: docker stop ssh-server-test
|
|
||||||
Reference in New Issue
Block a user