63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
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: start minio
|
|
run: |
|
|
docker run -d --rm --name nodeapi_minio -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=test -e MINIO_ROOT_PASSWORD=testtest minio/minio:latest server /data --console-address :9001
|
|
- name: deps
|
|
run: apt update && apt install -y tar zstd
|
|
- name: Test
|
|
run: |
|
|
make test
|
|
- name: stop minio
|
|
if: always()
|
|
run: |
|
|
docker stop nodeapi_minio
|
|
# TODO: probably not supported by Gitea workflows yet
|
|
# services:
|
|
# minio:
|
|
# image: minio/minio:latest
|
|
# env:
|
|
# MINIO_ROOT_USER: test
|
|
# MINIO_ROOT_PASSWORD: testtest
|
|
# ports:
|
|
# - 9001:9001
|
|
# options: server /data --console-address :9001
|
|
deploy-dev:
|
|
runs-on: [amd64, moon]
|
|
env:
|
|
NODES: "192.168.1.236"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: deploy
|
|
run: |
|
|
# echo LS1
|
|
# ls
|
|
docker run --rm --privileged -ti -v `pwd`:/srv golang:1.20-buster /bin/sh -c "cd /srv && go build"
|
|
# docker run --rm --privileged -ti -v `pwd`:/srv golang:1.20-buster /bin/sh -c "cd /srv && echo LS2 && ls"
|
|
|
|
for NODE in $NODES; do
|
|
echo "\033[0;32mDeploying $NODE\033[0m"
|
|
echo "\033[1;33m.. scanning SSH keys\033[0m"
|
|
ssh -o "StrictHostKeyChecking=no" root@$NODE echo "Setting up key"
|
|
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
|
|
|