Skip to content

Commit ae23ca5

Browse files
init project and change CI
1 parent 445635f commit ae23ca5

File tree

117 files changed

+36
-6393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+36
-6393
lines changed

.github/workflows/rust.yml

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches: [ main ]
66
paths-ignore:
77
- 'README.md'
8-
# - '.github/**'
98
pull_request:
109
branches: [ main ]
1110
workflow_dispatch:
@@ -30,42 +29,38 @@ jobs:
3029
id: autograding
3130
with:
3231
outputFile: .github/result/check_result.json
33-
deploy:
34-
name: Deploy to pages
35-
needs: build
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v3
39-
continue-on-error: true
40-
with:
41-
ref: 'gh-pages'
42-
- name: Save Log File
43-
run: |
44-
mkdir autograding_logs
45-
cd autograding_logs
46-
if [ -f "../latest.json" ]; then
47-
cp ../latest.json older.json
48-
else
49-
echo "{}" > older.json
50-
fi
51-
FILE_NAME=`date +%Y_%m_%d_%H_%M_%S`.txt
52-
echo -ne "${{ needs.build.outputs.details }}\n" > $FILE_NAME
53-
echo -ne "Points: ${{ needs.build.outputs.points }}" >> $FILE_NAME
54-
cat older.json | jq ".default |= \"$FILE_NAME\"" > latest.json
55-
rm older.json
56-
echo -ne "# Got Points\n" > README.md
57-
echo "![Points bar](../../blob/gh-pages/points-badge.svg)" >> README.md
58-
- name: Make points svg
59-
uses: markpatterson27/points-bar@v1
60-
with:
61-
points: '${{ needs.build.outputs.points }}'
62-
path: 'autograding_logs/points-badge.svg'
63-
type: 'badge'
64-
- name: GitHub Pages
65-
uses: crazy-max/ghaction-github-pages@v3
66-
with:
67-
target_branch: gh-pages
68-
build_dir: autograding_logs
69-
keep_history: true
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Generate summary JSON
33+
run: |
34+
outfile=".github/result/check_result.json"
35+
summary_file=".github/result/summary.json"
36+
37+
# 提取需要的值
38+
total_exercations=$(jq '.statistics.total_exercations' $outfile)
39+
total_succeeds=$(jq '.statistics.total_succeeds' $outfile)
40+
github_user="${{ github.actor }}"
41+
42+
# 生成新的 JSON 内容
43+
new_json=$(jq -n \
44+
--arg channel "github" \
45+
--argjson courseId 1558 \
46+
--arg ext "aaa" \
47+
--arg name "$github_user" \
48+
--argjson score "$total_succeeds" \
49+
--argjson totalScore "$total_exercations" \
50+
'{channel: $channel, courseId: $courseId, ext: $ext, name: $name, score: $score, totalScore: $totalScore}')
51+
52+
# 保存新的 JSON 文件
53+
echo "$new_json" > $summary_file
54+
55+
# 打印新的 JSON 文件到终端
56+
cat $summary_file
57+
- name: Post summary JSON to remote API
58+
run: |
59+
summary_file=".github/result/summary.json"
60+
61+
# 发送 POST 请求
62+
curl -X POST "https://api.learningcamp.cn/web/api/courseRank/createByThird" \
63+
-H "accept: application/json;charset=utf-8" \
64+
-H "Content-Type: application/json" \
65+
-d "$(cat $summary_file)" \
66+
-v

exercises/algorithm/algorithm1.rs

Lines changed: 0 additions & 173 deletions
This file was deleted.

exercises/algorithm/algorithm10.rs

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)