chore(CI): Add testing
This commit is contained in:
parent
4a03da89e5
commit
2673bdf5f5
30
.github/workflows/testing.yml
vendored
Normal file
30
.github/workflows/testing.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
testing:
|
||||
runs-on: ubuntu-latest
|
||||
container: golang:1.20-alpine
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup sshd server
|
||||
run: |
|
||||
apk add git make curl perl bash build-base zlib-dev ucl-dev
|
||||
make ssh-server
|
||||
|
||||
- name: executing remote ssh commands using password
|
||||
uses: ./
|
||||
with:
|
||||
host: 127.0.0.1
|
||||
username: drone-ssh
|
||||
password: 1234
|
||||
port: 22
|
||||
script: whoami
|
||||
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
ssh-server:
|
||||
adduser -h /home/drone-ssh -s /bin/sh -D -S drone-ssh
|
||||
echo drone-ssh:1234 | chpasswd
|
||||
mkdir -p /home/drone-ssh/.ssh
|
||||
chmod 700 /home/drone-ssh/.ssh
|
||||
cat tests/.ssh/id_rsa.pub >> /home/drone-ssh/.ssh/authorized_keys
|
||||
cat tests/.ssh/test.pub >> /home/drone-ssh/.ssh/authorized_keys
|
||||
chmod 600 /home/drone-ssh/.ssh/authorized_keys
|
||||
chown -R drone-ssh /home/drone-ssh/.ssh
|
||||
# install ssh and start server
|
||||
apk add --update openssh openrc
|
||||
rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key
|
||||
sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
|
||||
sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config
|
||||
./tests/entrypoint.sh /usr/sbin/sshd -D &
|
Loading…
Reference in New Issue
Block a user