node-api/.gitea/workflows/unittests.yml

50 lines
1.4 KiB
YAML
Raw Normal View History

2023-11-25 18:16:53 +00:00
name: Unittests
on:
push:
branches: [main]
workflow_dispatch: {}
jobs:
unittests:
runs-on: [amd64, moon]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Test
run: |
make test
2023-11-25 18:29:29 +00:00
services:
minio:
image: minio/minio:latest
env:
MINIO_ROOT_USER: test
MINIO_ROOT_PASSWORD: testtest
ports:
- 9001:9001
options: server /data --console-address :9001
2023-11-25 18:16:53 +00:00
deploy-dev:
2023-11-25 18:19:49 +00:00
runs-on: [amd64, moon]
env:
NODES: 192.168.1.236 192.168.1.220
steps:
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"
2023-11-25 18:19:49 +00:00
2023-11-25 18:16:53 +00:00
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