Skip to content

[chore] update ci link #4

[chore] update ci link

[chore] update ci link #4

Workflow file for this run

name: auto-grading
on: [push]
env:
CARGO_TERM_COLOR: always
rust-toolchain: nightly
qemu-version: 9.2.1
jobs:
basic-test:
if: github.repository != 'arceos-org/oscamp'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [riscv64]
outputs:
basic_points: ${{ steps.basic_points.outputs.basic_points}}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
components: rust-src
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- uses: ./.github/workflows/actions/setup-qemu
with:
qemu-version: ${{ env.qemu-version }}
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Run basic
id : basic_points
run: |
chmod -R +x scripts/
./scripts/total-test.sh ${{ matrix.arch }} > tmp.txt
score=$(cat tmp.txt | tail -n1)
echo $score
rm tmp.txt -f
echo "basic_points=$score" >> $GITHUB_OUTPUT
deploy:
if: github.repository != 'arceos-org/oscamp'
name: Report Score to Server
needs: basic-test
runs-on: ubuntu-latest
steps:
- name : Deploy basic to pages
env :
course_id: ${{ secrets.ARCEOS_2025_SPRING_COURSE_ID }}
post_api: ${{ secrets.ARCEOS_2025_SPRING_POST_API }}
token: ${{ secrets.ARCEOS_2025_SPRING_TOKEN }}
github_user: ${{ github.actor }}
basic_score: ${{ needs.basic-test.outputs.basic_points }}
run : |
echo "Basic: $basic_score"
total_score=600
score_json=$(jq -n \
--arg channel "github" \
--arg courseId "$course_id" \
--arg name "$github_user" \
--arg score "$basic_score" \
--arg totalScore "$total_score" \
--arg ext "{}" \
'{channel: $channel, courseId: $courseId, name: $name, score: ($score | tonumber), totalScore: ($totalScore | tonumber), ext: $ext}')
response=$(curl -X POST "$post_api" \
-H "accept: application/json;charset=utf-8" \
-H "Content-Type: application/json" \
-H "token: $token" \
-d "$score_json" \
-s)
if echo "$response" | grep -q '"result":1'; then
echo "成功:测试数据已发送"
else
echo "失败:接口返回异常"
exit 1
fi