2023-11-25 18:16:53 +00:00
|
|
|
name: Unittests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
workflow_dispatch: {}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
unittests:
|
|
|
|
runs-on: [amd64, moon]
|
|
|
|
env:
|
|
|
|
NODES: 192.168.1.236 192.168.1.220
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: 1.21
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
make test
|
|
|
|
deploy-dev:
|
2023-11-25 18:18:40 +00:00
|
|
|
- name: deploy
|
2023-11-25 18:16:53 +00:00
|
|
|
run: |
|
|
|
|
docker run --rm --privileged -ti -v ${shell pwd}:/srv golang:1.20-buster /bin/sh -c "cd /srv && go build"
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new root@$HOST echo "Setting up host keys"
|
|
|
|
for NODE in $NODES; do
|
|
|
|
echo "\033[0;32mDeploying $NODE\033[0m"
|
|
|
|
echo "\033[1;33m.. scanning SSH keys\033[0m"
|
|
|
|
ssh-keyscan $NODE > ~/.ssh/known_hosts
|
|
|
|
echo "\033[1;33m.. copying the binary\033[0m"
|
|
|
|
scp node-api root@$NODE:/usr/local/bin/node-api_
|
|
|
|
echo "\033[1;33m.. replacing the binary\033[0m"
|
|
|
|
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
|
|
|
|
echo "\033[1;33m.. restarting service\033[0m"
|
|
|
|
ssh root@$NODE systemctl restart node-api
|
|
|
|
done
|
|
|
|
|