-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·135 lines (103 loc) · 4.12 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
set -e
# install nightly rust
rustup toolchain install $OS_CHECKER_RUST_TOOLCHAIN --allow-downgrade --profile minimal --component clippy,rustfmt
rustup default $OS_CHECKER_RUST_TOOLCHAIN
rustup show
rustc -vV
cargo +nightly-2021-10-21 rudra --help
cargo +nightly-2024-02-05 mirai --help
cargo +nightly-2024-10-05 lockbud --help
cargo +nightly-2024-10-12 rap --help
cargo audit --version
cargo outdated --version
cargo geiger --version
cargo semver-checks --version
# Install os-checker related
# Shared folder for cargo install. The folder will be deleted in the end.
export INSTALL=/os_checker/install
export CARGO_TARGET_DIR=$INSTALL/target
mkdir -p $CARGO_TARGET_DIR
echo "install os-checker & os-checker-database"
cargo install --git https://github.com/os-checker/os-checker.git os-checker os-checker-database 2>/dev/null
echo "install os-checker-plugin-github-api"
cargo install --git https://github.com/os-checker/plugin-github-api.git 2>/dev/null
echo "install os-checker-plugin-cargo"
cargo install --git https://github.com/os-checker/plugin-cargo.git 2>/dev/null
echo "install os-checker-plugin-docs"
cargo install --git https://github.com/os-checker/docs.git 2>/dev/null
# Install web ui
git clone https://github.com/os-checker/os-checker.github.io.git $INSTALL/webui
cd $INSTALL/webui/os-checks
echo "build webui"
npm install 2>/dev/null && npm run generate 2>/dev/null 1>/dev/null && cp -LR dist /os_checker/
#Remove $INSTALL dir since we don't need them and the disk space needs to reduce
tree -L 3 -h $INSTALL
rm $INSTALL -rf
unset CARGO_TARGET_DIR
os-checker --help
which os-checker-database
which os-checker-plugin-docs
which os-checker-plugin-cargo
which os-checker-plugin-github-api
ls -alh /os_checker
mv /os_checker/dist $CHECK_DIR
cd $CHECK_DIR
ls -alh
git lfs install --skip-smudge # 如果 lfs 下载不了大文件,跳过下载
# wget https://raw.githubusercontent.com/os-checker/os-checker/refs/heads/main/assets/repos-ui.json
# gh release download -R os-checker/database cache-v8.redb -p repos-default.json
# wget https://github.com/os-checker/os-checker/raw/refs/heads/main/assets/repos.json
# echo '{"os-checker/os-checker-test-suite":{}}' >repos.json
# export OS_CHECKER_CONFIGS="repos-default.json repos-ui.json"
# export OS_CHECKER_CONFIGS="repos.json"
# Download cache.redb
gh release download -R $DATABASE_REPO cache -p cache.redb || true
# Run checker
os-checker db --start cache.redb
os-checker run --emit batch/single.json --db cache.redb
os-checker db --done cache.redb
# Upload cache.redb
gh release create -R $DATABASE_REPO cache --draft --notes 'Cached checking results in a database file.' || true
gh release upload -R $DATABASE_REPO cache --clobber cache.redb
# Generate JSON results
os-checker-database
# Generate api info
os-checker-plugin-github-api
# Generate cargo info
os-checker-plugin-cargo
# Generate rustdocs
os-checker-plugin-docs
# deploy -> $CHECK_DIR/dist/docs (WebUI should not define docs page/route)
# tar: ./docs/os-checker/os-checker-test-suite/.lock: Cannot open: Permission denied
find deploy -type f -name ".lock" -delete
mv deploy dist/docs
git config --global user.name $GIT_AUTHOR
git config --global user.email $GIT_EMAIL
git config --global committer.name $GIT_AUTHOR
git config --global committer.email $GIT_EMAIL
echo "正在 clone" $DATABASE_REPO
gh repo clone $DATABASE_REPO $DATABASE_REPO
gh auth setup-git
echo "成功 clone" $DATABASE_REPO
# clean ui
rm $DATABASE_REPO/ui -rf
# ui -> $DATABASE_REPO/ui
mv ui $DATABASE_REPO
# clean old plugin dir
rm $DATABASE_REPO/plugin -rf
# cargo -> $DATABASE_REPO/plugin/cargo/info
mkdir -p $DATABASE_REPO/plugin/cargo
mv cargo $DATABASE_REPO/plugin/cargo/info
# github-api -> $DATABASE_REPO/plugin/github-api
mv github-api $DATABASE_REPO/plugin
# commit & push changes
cd $DATABASE_REPO
echo "update plugin folder for" $DATABASE_REPO
export branch=$(git branch --show-current)
git status
git add .
echo "正在提交:$(git status --porcelain)"
git commit -m "[bot] update plugin dir from os-checker-plugin-github-api repo"
echo "提交成功,正在推送到 database 仓库(分支:$branch)"
git push
echo "成功推送到 database 仓库(分支:$branch)"