Skip to content

update

update #4

Workflow file for this run

name: GitHub Classroom Workflow
on:
push:
branches: [ main ]
paths-ignore:
- 'README.md'
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
TZ: Asia/Shanghai # 设置时区
jobs:
build:
name: Autograding
runs-on: ubuntu-latest
outputs:
details: ${{ steps.autograding.outputs.details }}
points: ${{ steps.autograding.outputs.points}}
env:
OUTPUT: .github/result/check_result.json
SUMMARY: .github/result/summary.json
steps:
- uses: actions/checkout@v3
- name: Run tests
run: cargo test --test cicv --verbose
- uses: yfblock/os-autograding@master
id: autograding
with:
outputFile: ${{ env.OUTPUT }}
- name: Generate summary JSON
run: |
# 提取需要的值
total_exercations=$(jq '.statistics.total_exercations' $OUTPUT)
total_succeeds=$(jq '.statistics.total_succeeds' $OUTPUT)
# 生成新的 JSON 内容
new_json=$(jq -n \
--arg channel "github" \
--argjson courseId "${{ secrets.RUSTLINGS_2025_AUTUMN_COURSE_ID }}" \
--arg ext "aaa" \
--arg name "${{ github.actor }}" \
--argjson score "$total_succeeds" \
--argjson totalScore "$total_exercations" \
'{channel: $channel, courseId: $courseId, ext: $ext, name: $name, score: $score, totalScore: $totalScore}')
# 保存新的 JSON 文件
echo "$new_json" > $SUMMARY
# 打印新的 JSON 文件到终端
cat $SUMMARY
- name: Post summary JSON to remote API
run: |
curl -X POST "${{ secrets.COURSE_POST_API }}" \
-H "accept: application/json;charset=utf-8" \
-H "Content-Type: application/json" \
-H "token: ${{ secrets.RUSTLINGS_2025_AUTUMN_TOKEN }}" \
-d @$SUMMARY \
-v