generated from INF1007-Gabarits/revision_final
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.87 KB
/
exercise.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Exercise workflow
on:
repository_dispatch:
branches: master
workflow_dispatch:
branches: master
push:
branches: master
paths:
- exercice.py
- README.md
- logs/*
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Exercise workflow
run: |
source settings/variables.txt
firebase_real_time_db_url="${{ secrets.FIREBASE_DB_URL }}"
function run_tests() {
python3 "$test_file"
git add logs/tests_results.txt
}
function extract_grades() {
python3 -m classroom_tools.grading.create_grades \
--test_associations_path="$test_associations_path"
git add logs/grades.json
}
function show_grades() {
python3 -m classroom_tools.grading.show_grades_in_readme
git add README.md
}
function push_modifications() {
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -a -m "Updated autograding results"
git pull -v --rebase=true
git push -v
}
function patch_db() {
python3 -m classroom_tools.grading.patch_db \
--access_token="" \
--firebase_real_time_db_url="$firebase_real_time_db_url" \
--github_repo="$(basename $(pwd))"
}
if [[ $GITHUB_REPOSITORY =~ $org_name/$repo_filter ]]
then
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
run_tests
extract_grades
show_grades
push_modifications
patch_db
else
exit 1
fi