Skip to content

Fail CI when points are not full score #20

Fail CI when points are not full score

Fail CI when points are not full score #20

Workflow file for this run

name: Jobs
on: [push]
env:
CARGO_TERM_COLOR: always
rust_toolchain: nightly
jobs:
basic-test:
runs-on: ubuntu-latest
outputs:
points: ${{ steps.end.outputs.points}}
container:
image: alicesama/rcore-ci:2024a
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
qemu-system-riscv64 --version
rustup target add riscv64gc-unknown-none-elf
git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
git clone https://github.com/LearningOS/rCore-Tutorial-Checker.git ci-user
git clone https://github.com/LearningOS/rCore-Tutorial-Test.git ci-user/user
ID=`git rev-parse --abbrev-ref HEAD | grep -oP 'ch\K[0-9]'`
cd ci-user && make test CHAPTER=$ID passwd=${{ secrets.BASE_TEST_TOKEN }} OFFLINE=1 > ../output.txt
cat ../output.txt
- name: end
id: end
run: |
cat output.txt | grep "Test passed" | grep -oP "\d{1,}/\d{1,}" | xargs -i echo "points={}"
cat output.txt | grep "Test passed" | grep -oP "\d{1,}/\d{1,}" | xargs -i echo "points={}" >> $GITHUB_OUTPUT
- name: Require full points
run: |
POINTS='${{ steps.end.outputs.points }}'
if [ -z "$POINTS" ]; then
echo "points is empty"
exit 1
fi
GOT="${POINTS%%/*}"
TOTAL="${POINTS##*/}"
if [ "$GOT" != "$TOTAL" ]; then
echo "points is not full score: $POINTS"
exit 1
fi
echo "points is full score: $POINTS"