mirror of
https://github.com/Lifailon/lazyjournal.git
synced 2026-11-11 01:09:46 +01:00
128 lines
2.7 KiB
YAML
128 lines
2.7 KiB
YAML
env:
|
|
GIT_URL: https://github.com/Lifailon/lazyjournal
|
|
|
|
networks:
|
|
dev:
|
|
hosts:
|
|
- lifailon@192.168.3.101:2121
|
|
bsd:
|
|
hosts:
|
|
- root@192.168.3.102:22
|
|
- root@192.168.3.103:22
|
|
|
|
commands:
|
|
install:
|
|
desc: Install Go
|
|
run: |
|
|
if command -v go > /dev/null 2>&1; then
|
|
go version
|
|
else
|
|
if [ "$(uname -s)" = "FreeBSD" ]; then
|
|
pkg update
|
|
pkg install -y go
|
|
elif [ "$(uname -s)" = "OpenBSD" ]; then
|
|
pkg_add -u
|
|
yes | pkg_add go
|
|
fi
|
|
fi
|
|
|
|
clone:
|
|
desc: Clone repository
|
|
run: |
|
|
rm -rf lazyjournal
|
|
git clone $GIT_URL
|
|
|
|
creat:
|
|
desc: Creat directory for upload files
|
|
run: |
|
|
rm -rf lazyjournal
|
|
mkdir lazyjournal
|
|
|
|
copy:
|
|
desc: Upload all files to remote hosts
|
|
upload:
|
|
- src: \*
|
|
dst: lazyjournal
|
|
|
|
ls:
|
|
desc: Check directory
|
|
run: ls -lh lazyjournal
|
|
|
|
prep:
|
|
desc: Install dependencies and code preparation
|
|
run: |
|
|
cd lazyjournal
|
|
go fmt ./...
|
|
go vet ./...
|
|
go get ./...
|
|
go mod tidy
|
|
go mod verify
|
|
go build -o /dev/null -v ./...
|
|
|
|
test:
|
|
desc: Run unit tests
|
|
run: |
|
|
cd lazyjournal
|
|
go test -v -cover --run "TestUnixFiles|TestColor|TestFilter|TestFlags|TestCommandColor|TestMainInterface|TestMockInterface"
|
|
|
|
docker:
|
|
desc: Run docker containers test
|
|
run: |
|
|
cd lazyjournal
|
|
go test -v -cover --run "TestDockerContainer"
|
|
|
|
remove:
|
|
desc: Remove files on remote hosts
|
|
run: |
|
|
rm -rf lazyjournal
|
|
ls -l lazyjournal 2> /dev/null || echo "lazyjournal removed"
|
|
|
|
bin:
|
|
desc: Install binary from GitHub
|
|
run: curl -sS https://raw.githubusercontent.com/Lifailon/lazyjournal/main/install.sh | bash
|
|
|
|
flags:
|
|
desc: Check flags from release
|
|
run: |
|
|
if [ "$(uname -s)" = "FreeBSD" ]; then
|
|
. ~/.shrc
|
|
elif [ "$(uname -s)" = "OpenBSD" ]; then
|
|
. ~/.kshrc
|
|
fi
|
|
lazyjournal -v
|
|
mkdir -p /opt
|
|
echo test > /opt/test.log
|
|
lazyjournal -a
|
|
rm /opt/test.log
|
|
time cat /var/log/messages | lazyjournal -c > /dev/null
|
|
|
|
tmux:
|
|
desc: Check run interface from release
|
|
run: |
|
|
if [ "$(uname -s)" = "FreeBSD" ]; then
|
|
. /root/.shrc
|
|
elif [ "$(uname -s)" = "OpenBSD" ]; then
|
|
. /root/.kshrc
|
|
fi
|
|
tmux new-session -d -s test-session "lazyjournal"
|
|
sleep 2
|
|
tmux capture-pane -p
|
|
tmux send-keys -t test-session "$(echo -e '\t\t')"
|
|
tmux send-keys -t test-session "$(echo -e '\r')"
|
|
sleep 2
|
|
tmux capture-pane -p
|
|
tmux kill-session -t test-session
|
|
|
|
targets:
|
|
testing:
|
|
- install
|
|
- creat
|
|
- copy
|
|
- ls
|
|
- prep
|
|
- test
|
|
- remove
|
|
release:
|
|
- bin
|
|
- flags
|
|
- tmux |