Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
betoyou23 authored May 3, 2024
0 parents commit ef08401
Show file tree
Hide file tree
Showing 46 changed files with 2,047 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/_exercice_version_prof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update student files | _exercice_version_prof,py

on:
workflow_dispatch:
push:
paths:
- _exercice_version_prof.py

jobs:
run:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Update student files | _exercice_version_prof,py
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
python3 -m classroom_tools.student_repositories.sync_with_template_repository \
--template_repo_fullname="$GITHUB_REPOSITORY" \
--token="${{ secrets.REPO_WORKFLOW_PAT }}" \
--org_name="$org_name" \
--repo_filter="$repo_filter" \
--files_to_update _exercice_version_prof.py
69 changes: 69 additions & 0 deletions .github/workflows/exercise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
28 changes: 28 additions & 0 deletions .github/workflows/update_student_repositories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update students repos

on:
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Update students repos
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
#python3 -m classroom_tools.student_repositories.delete_workflows \
# --token=${{ secrets.REPO_WORKFLOW_PAT }} \
# --org_name="$org_name" \
# --repo_filter="$repo_filter"
python3 -m classroom_tools.student_repositories.sync_with_template_repository \
--template_repo_fullname="$GITHUB_REPOSITORY" \
--token="${{ secrets.REPO_WORKFLOW_PAT }}" \
--org_name="$org_name" \
--repo_filter="$repo_filter"
28 changes: 28 additions & 0 deletions .github/workflows/update_template_repositories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update derived template repos

on:
workflow_dispatch:
inputs:
repo_filter:
description: "Prefix to filter repositories"
required: true
files_to_update:
description: "File paths to overwrite in template repos (space separated)"
required: true
jobs:
run:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Update derived template repos
run: |
python3 -m pip install -q setuptools
python3 -m pip install -q git+"${{ secrets.CLASSROOM_TOOLS_URL }}"
python3 -m classroom_tools.student_repositories.sync_with_template_repository \
--template_repo_fullname="$GITHUB_REPOSITORY" \
--token="${{ secrets.REPO_WORKFLOW_PAT }}" \
--org_name="$(basename $(dirname $GITHUB_REPOSITORY))" \
--repo_filter=${{ github.event.inputs.repo_filter }} \
--files_to_update ${{ github.event.inputs.files_to_update }}
115 changes: 115 additions & 0 deletions .github/workflows/verifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Verifications

on:
workflow_dispatch:

jobs:
Secrets:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Verify secrets
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
python3 -m classroom_tools.verifications.access_to_github_secrets \
--token=${{ secrets.REPO_ADMIN_PAT }} \
--repo_fullname="$GITHUB_REPOSITORY"
Files_to_update:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Verify files to update
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
python3 -m classroom_tools.verifications.files_to_update \
--token=${{ secrets.REPO_WORKFLOW_PAT }} \
--template_repo_fullname="$GITHUB_REPOSITORY"
Testing_files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Verify test file and test_associations.json
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
python3 -m classroom_tools.verifications.grading_tests \
--test_file_path="$test_file" \
--test_associations_path="$test_associations_path"
is_template:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Verify that repo is a template
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
python3 -m classroom_tools.verifications.repo_is_template \
--token=${{ secrets.REPO_WORKFLOW_PAT }} \
--repo_fullname="$GITHUB_REPOSITORY"
Variables:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Verify that settings/variables.txt exists
run: |
if [[ ! -f "settings/variables.txt" ]]
then
printf "File not found: settings/variables.txt\n"
exit 1
fi
- uses: actions/checkout@v2
- name: Verify test_file from settings/variables.txt
run: |
source settings/variables.txt
if [[ ! -f "$test_file" ]]
then
printf "File not found: $test_file\n"
exit 1
fi
- uses: actions/checkout@v2
- name: Verify test_associations_path from settings/variables.txt
run: |
source settings/variables.txt
if [[ ! -f "$test_associations_path" ]]
then
printf "File not found: $test_associations_path\n"
exit 1
fi
- uses: actions/checkout@v2
- name: Verify template_repo_fullname from settings/variables.txt
run: |
source settings/variables.txt
if [[ "$GITHUB_REPOSITORY" != "$template_repo_fullname" ]]
then
printf "Variable template_repo_fullname from settings/variables.txt:\n"
printf "\t$template_repo_fullname\n"
printf "doesn't match this repository's fullname:\n"
printf "\t$GITHUB_REPOSITORY\n"
exit 1
fi
- uses: actions/checkout@v2
- name: Verify classroom_tools_url from settings/variables.txt
run: |
source settings/variables.txt
python3 -m pip install -q setuptools
python3 -m pip install -q git+"$classroom_tools_url"
Loading

0 comments on commit ef08401

Please sign in to comment.