-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad01304
commit c6830eb
Showing
2 changed files
with
93 additions
and
88 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,117 @@ | ||
name: Autograding Tests | ||
'on': | ||
push: | ||
# Only run on main branch to avoid triggering infinitely, | ||
# when points bar branch is updated (see update-points-bar job below) | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
repository_dispatch: | ||
permissions: | ||
checks: write | ||
actions: read | ||
contents: write | ||
contents: read | ||
jobs: | ||
run-autograding-tests: | ||
runs-on: ubuntu-latest | ||
if: github.actor != 'github-classroom[bot]' | ||
outputs: | ||
# Setup outputs for update-points-bar job below | ||
points: ${{ steps.autograder.outputs.points }} | ||
steps: | ||
- name: Set Locale | ||
run: | | ||
sudo apt-get update && sudo apt-get install tzdata locales -y | ||
sudo locale-gen ru_RU.UTF-8 | ||
sudo locale-gen ru_RU | ||
locale -a | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run ShellCheck | ||
uses: ludeeus/action-shellcheck@master | ||
- name: 'Task #1' | ||
id: task-1 | ||
uses: classroom-resources/autograding-command-grader@v1 | ||
with: | ||
scandir: './.test' | ||
test-name: 'Task #1' | ||
setup-command: '' # (Optional) Run before the test is run. | ||
command: ./.test/task1/validate | ||
timeout: 1 # The amount of minutes the test is allowed to run before it is killed. Maximum 60 minutes. | ||
max-score: 1 # (Optional) The amount of points awarded if the test passes. | ||
|
||
- uses: actions/checkout@v3 | ||
- name: 'Task #2' | ||
id: task-2 | ||
uses: classroom-resources/autograding-command-grader@v1 | ||
with: | ||
fetch-depth: 0 | ||
test-name: 'Task #2' | ||
setup-command: '' # (Optional) Run before the test is run. | ||
command: ./.test/task2/validate | ||
timeout: 1 # The amount of minutes the test is allowed to run before it is killed. Maximum 60 minutes. | ||
max-score: 2 # (Optional) The amount of points awarded if the test passes. | ||
|
||
- uses: education/autograding@v1 | ||
id: autograder | ||
- name: 'Task #3' | ||
id: task-3 | ||
uses: classroom-resources/autograding-command-grader@v1 | ||
with: | ||
test-name: 'Task #3' | ||
setup-command: '' # (Optional) Run before the test is run. | ||
command: ./.test/task3/validate | ||
timeout: 1 # The amount of minutes the test is allowed to run before it is killed. Maximum 60 minutes. | ||
max-score: 2 # (Optional) The amount of points awarded if the test passes. | ||
|
||
- name: 'Task #4' | ||
id: task-4 | ||
uses: classroom-resources/autograding-command-grader@v1 | ||
with: | ||
test-name: 'Task #4' | ||
setup-command: '' # (Optional) Run before the test is run. | ||
command: ./.test/task4/validate | ||
timeout: 1 # The amount of minutes the test is allowed to run before it is killed. Maximum 60 minutes. | ||
max-score: 2 # (Optional) The amount of points awarded if the test passes. | ||
|
||
############################ | ||
# Generate points bar badge | ||
- name: 'Task #5' | ||
id: task-5 | ||
uses: classroom-resources/autograding-command-grader@v1 | ||
with: | ||
test-name: 'Task #5' | ||
setup-command: '' # (Optional) Run before the test is run. | ||
command: ./.test/task5/validate | ||
timeout: 1 # The amount of minutes the test is allowed to run before it is killed. Maximum 60 minutes. | ||
max-score: 3 # (Optional) The amount of points awarded if the test passes. | ||
|
||
############################# | ||
# Autograding reporter | ||
# | ||
# Note: will run even if autograding failed | ||
# thanks to `if: success() || failure()`. | ||
# IMPORTANT: update env variables and runners below to use actual tests defined above! | ||
# | ||
- run: git checkout badges || git checkout -b badges | ||
if: success() || failure() | ||
- name: points bar | ||
uses: markpatterson27/points-bar@v1 | ||
- name: Autograding Reporter | ||
id: autograder | ||
uses: liontiger23/autograding-grading-reporter@v1 | ||
env: | ||
TASK-1_RESULTS: "${{steps.task-1.outputs.result}}" | ||
TASK-2_RESULTS: "${{steps.task-2.outputs.result}}" | ||
TASK-3_RESULTS: "${{steps.task-3.outputs.result}}" | ||
TASK-4_RESULTS: "${{steps.task-4.outputs.result}}" | ||
TASK-5_RESULTS: "${{steps.task-5.outputs.result}}" | ||
with: | ||
points: ${{ steps.autograder.outputs.points }} | ||
path: '.github/badges/points-bar.svg' | ||
label: 'Баллы' | ||
if: success() || failure() | ||
- name: Commit changes to points bar | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git add '.github/badges/points-bar.svg' | ||
git commit -m "Add/Update points bar" || exit 0 | ||
git push origin badges | ||
if: success() || failure() | ||
runners: task-1,task-2,task-3,task-4,task-5 | ||
|
||
############################ | ||
# Generate points bar badge | ||
# | ||
# Add badge to README.md with | ||
# | ||
# ![Points](../../blob/badges/.github/badges/points-bar.svg) | ||
# | ||
# or if you want to float it to the right: | ||
# | ||
# <img alt="Points" align="right" height="36" src="../../blob/badges/.github/badges/points-bar.svg" /> | ||
# | ||
# Note: will run even if autograding failed thanks to `if: success() || failure()`. | ||
# | ||
update-points-bar: | ||
needs: run-autograding-tests | ||
if: ${{ (success() || failure()) && needs.run-autograding-tests.outputs.points }} | ||
uses: markpatterson27/points-bar/.github/workflows/reusable-workflow.yml@main | ||
permissions: | ||
contents: write | ||
with: | ||
points: ${{ needs.run-autograding-tests.outputs.points }} | ||
path: '.github/badges/points-bar.svg' | ||
label: 'Баллы' | ||
branch: badges | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} |