Skip to content

Commit

Permalink
Github: run tests on push/pull/trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffie committed Dec 18, 2023
1 parent 376f462 commit c6671a4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run tests

on:
push:
pull:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.19'

- name: Build
run: go build -v

- name: Test
run: go test -v ./...

- name: Integration test
run: |
cd loadtest
make prepare
make run-webserver &
make run-sshified &
sleep 10
make run-loadtest
18 changes: 9 additions & 9 deletions loadtest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
USER = sshified-test

prepare:
mkdir -p conf/
id $(USER) || sudo useradd $(USER) -s /bin/false -m
ssh-keygen -f conf/id_rsa -N ""
sudo -u $(USER) mkdir -p /home/$(USER)/.ssh/
sudo -u $(USER) tee /home/$(USER)/.ssh/authorized_keys < conf/id_rsa.pub
sudo -u $(USER) chmod 700 /home/$(USER)/.ssh/
sudo -u $(USER) chmod 600 /home/$(USER)/.ssh/authorized_keys
ssh-keyscan 127.0.0.1 > conf/known_hosts
ssh-keyscan localhost >> conf/known_hosts
mkdir -p conf/
id $(USER) || sudo useradd $(USER) -s /bin/false -m
ssh-keygen -f conf/id_rsa -N ""
sudo -u $(USER) mkdir -p /home/$(USER)/.ssh/
sudo -u $(USER) tee /home/$(USER)/.ssh/authorized_keys < conf/id_rsa.pub
sudo -u $(USER) chmod 700 /home/$(USER)/.ssh/
sudo -u $(USER) chmod 600 /home/$(USER)/.ssh/authorized_keys
ssh-keyscan 127.0.0.1 > conf/known_hosts
ssh-keyscan localhost >> conf/known_hosts

cleanup:
rm -rf conf/
Expand Down

0 comments on commit c6671a4

Please sign in to comment.