-
Notifications
You must be signed in to change notification settings - Fork 13
59 lines (48 loc) · 1.43 KB
/
go-test.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
59
name: Go
on: [push, pull_request]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Ensure ssh is installed
run: sudo apt update; sudo apt -y install openssh-server
- name: Check config
run: |
cat > sshd_config <<EOF
SyslogFacility AUTHPRIV
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
ChallengeResponseAuthentication no
PubkeyAuthentication yes
EOF
cat > ssh_config <<EOF
StrictHostKeyChecking no
EOF
sudo mv sshd_config /etc/ssh/sshd_config
sudo mv ssh_config /etc/ssh/ssh_config
sudo systemctl restart ssh
- name: Create ssh key
run: >
ssh-keygen -t rsa -f ~/.ssh/id_rsa
- name: Add key to auth file
run: >
cat ~/.ssh/id_rsa.pub | tee -a ~/.ssh/authorized_keys
ssh-add ~/.ssh/id_rsa
- name: Ensure the owner of the key is correct
run: |
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
sudo chmod -c 0755 ~/
ls -la ~/.ssh
- name: Go Build
run: go build -v ./...
- name: Go Test
run: go test -v ./...
- name: Check auth.log log on failure
if: ${{ failure() }}
run: cat /var/log/auth.log