Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-classroom[bot] authored Feb 27, 2024
0 parents commit 5c635b5
Show file tree
Hide file tree
Showing 19 changed files with 990 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/activity-icons/activity1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .github/activity-icons/activity2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .github/activity-icons/activity3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions .github/activity-icons/points-bar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .github/activity-icons/quiz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 84 additions & 0 deletions .github/classroom/autograding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"tests": [
{
"name": "Activity 1 - Accept assignment",
"setup": "",
"run": "[ -e .github/results/activity1.txt ] && exit 0 || exit 1",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 5
},
{
"name": "Activity 2 - Make commit",
"setup": "",
"run": "[ -e .github/results/activity2.txt ] && exit 0 || exit 1",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 5
},
{
"name": "Activity 3 - Comment on PR",
"setup": "",
"run": "[ -e .github/results/activity3.txt ] && exit 0 || exit 1",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 5
},
{
"name": "Quiz - Question 1",
"setup": "",
"run": "/bin/bash .github/grading-scripts/quiz.sh 1",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
},
{
"name": "Quiz - Question 2",
"setup": "",
"run": "/bin/bash .github/grading-scripts/quiz.sh 2",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
},
{
"name": "Quiz - Question 3",
"setup": "",
"run": "/bin/bash .github/grading-scripts/quiz.sh 3",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
},
{
"name": "Quiz - Question 4",
"setup": "",
"run": "/bin/bash .github/grading-scripts/quiz.sh 4",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
},
{
"name": "Quiz - Question 5",
"setup": "",
"run": "/bin/bash .github/grading-scripts/quiz.sh 5",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
}
]
}
48 changes: 48 additions & 0 deletions .github/grading-scripts/quiz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
#
# param
# $1 - question number

expected=(2 2 3 4 3)
# echo ${#expected[@]}

# check quiz file exists
if [ ! -e quiz.md ]; then
echo "Error: quiz file missing"
exit 1
fi

# IFS_backup=$IFS
# IFS=$'\n'
answers=($(grep -e "^Answer:" quiz.md | cut -d ':' -f 2 | tr -d "[:blank:]" | sed 's/.*/"&"/'))
# IFS=$IFS_backup
# echo ${#answers[@]}

if [[ ${#answers[@]} != 5 ]]; then
echo "Error: wrong number of answers in quiz file"
exit 1
fi

score=0
incorrect=''
if [ $1 ]; then
if [[ $(echo ${answers[$1 - 1]} | xargs) == "${expected[$1 - 1]}"* ]]; then
echo "Question $1 answered correctly."
echo "pass"
else
echo "Question $1 incorrect."
exit 1
fi
else
for i in "${!expected[@]}"; do
if [[ $(echo ${answers[$i]} | xargs) == "${expected[$i]}"* ]]; then
echo "Question $(( $i+1 )) answered correctly."
((score+=1))
else
incorrect="$incorrect$(( $i+1 )) "
echo "Question $(( $i+1 )) incorrect."
fi
done
echo "::set-output name=quiz_score::$score"
echo "::set-output name=incorrect_answers::$incorrect"
fi
5 changes: 5 additions & 0 deletions .github/scripts/escape.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
text="$1"
text="${text//$'%'/%25}"
text="${text//$'\n'/'%0A'}"
text="${text//$'\r'/%0D}"
echo "$text"
14 changes: 14 additions & 0 deletions .github/templates/activity-completed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .github/templates/activity-incomplete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/templates/pr_body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This pull request was created as a place for your teacher to leave feedback on your work.
69 changes: 69 additions & 0 deletions .github/templates/pr_feedback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
status-success: ':white_check_mark:'
status-fail: ':x:'
activity1-success:
activity1-fail: |
This assignment is designed to be run via [GitHub Classroom](https://classroom.github.com). If you got here without being given an assignment URL from your teacher, please speak to your teacher about setting up a [Classroom assignment](https://docs.github.com/en/education/manage-coursework-with-github-classroom/teach-with-github-classroom/create-an-individual-assignment).
If your teacher did give you an assignment URL and you still got this message, there is probably a bug in the marking code. Please submit an issue to https://github.com/markpatterson27/GitHub-Classroom-Introductory-Assignment/issues describing the issue (preferably including a link back to _your_ assignment repo).
activity2-success: Yay. You made a commit.
activity2-fail: |
A commit authored by you has not been found.
<details>
<summary>How to make a git commit</summary>
**Clone** - [Clone](https://github.com/git-guides/git-clone) the repository to your local machine.
\`\`\`
git clone https://github.com/${GITHUB_REPOSITORY}.git
\`\`\`
**Edit** - Edit and save the files.
\`\`\`
cd ${REPO_NAME}
code editme.md
\`\`\`
**Add** - [Add](https://github.com/git-guides/git-add) the changes to staging.
\`\`\`
git add editme.md
\`\`\`
**Commit** - [Commit](https://github.com/git-guides/git-commit) the changes to the git repo.
\`\`\`
git commit -m \"asked a question in editme.md\"
\`\`\`
**Push** - [Push](https://github.com/git-guides/git-push) the new commits back to the remote repository.
\`\`\`
git push origin main
\`\`\`
</details>
activity3-success: Interesting comment.
activity3-fail: Leave a comment below.
quiz-success: Five out of five. All questions answered correctly. Well done.
---

## Auto-Feedback

### ${status-activity1} Activity 1 - Accept assignment

${fb-activity1}

### ${status-activity2} Activity 2 - Make commit

${fb-activity2}

### ${status-activity3} Activity 3 - Comment on Feedback PR

${fb-activity3}

### ${status-quiz} Quiz

${fb-quiz}

Autograding Score: ${points}
5 changes: 5 additions & 0 deletions .github/templates/quiz.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions .github/templates/quiz5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5c635b5

Please sign in to comment.