mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-10-23 05:08:16 +08:00
ci: better structure (#13)
* struct ci; staged * seems good * ci try macos * debug * debug * debug * debug * debug * debug * debug * debug * debug * debug
This commit is contained in:
@@ -7,7 +7,7 @@ logging.basicConfig(level=logging.INFO, format="[%(filename)s:%(lineno)d][%(leve
|
||||
try:
|
||||
import requests
|
||||
except ImportError:
|
||||
logging.fatal("Please install requests module")
|
||||
logging.critical("Please install requests module")
|
||||
exit(1)
|
||||
|
||||
|
||||
@@ -57,17 +57,17 @@ if __name__ == "__main__":
|
||||
content=content.strip()
|
||||
if not content:
|
||||
logging.error("empty log content")
|
||||
exit(1)
|
||||
exit(0)
|
||||
resp = post_log(url, hostname, uuid, content)
|
||||
if resp.status_code == 200:
|
||||
logging.info("200 ok")
|
||||
exit(0)
|
||||
elif resp.status_code == 403:
|
||||
logging.warning("403 forbidden")
|
||||
logging.error("403 forbidden")
|
||||
logging.info("you may need to register your hostname and uuid")
|
||||
logging.info(f"hostname: {hostname}, uuid: {uuid}")
|
||||
exit(0)
|
||||
else:
|
||||
logging.error("unknown error ")
|
||||
logging.critical("unknown error ")
|
||||
logging.error(f"{resp.status_code}: {resp.text}")
|
||||
exit(1)
|
||||
|
||||
27
tools/test.zsh
Normal file
27
tools/test.zsh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/false "This script should be sourced in a shell, not executed directly"
|
||||
|
||||
set -ex
|
||||
|
||||
# check files
|
||||
cd /
|
||||
dfs cd
|
||||
pwd
|
||||
test -f .zshrc2
|
||||
diff -q ./.ssh/authorized_keys2 ~/.ssh/authorized_keys2
|
||||
grep -q ".zshrc2" ~/.zshrc
|
||||
|
||||
# check scripts and functions
|
||||
dfs version
|
||||
dfs log 1
|
||||
l
|
||||
dogo
|
||||
tools/common.sh get_os_type
|
||||
tools/common.sh get_linux_dist
|
||||
|
||||
# check alias
|
||||
alias p114 > /dev/null
|
||||
|
||||
# check update
|
||||
dfs update
|
||||
dfs version
|
||||
test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id`
|
||||
Reference in New Issue
Block a user