# Github Classroom

# ? PET Academy Cookbook

## 1. Organisation erstellen

1. Gehe zu: https://github.com/organizations/new
2. Organisation Name: `pet-academy-test`
3. Plan: Free
4. Keine Mitglieder hinzufügen
5. Fertig!

---

## 2. GitHub Classroom erstellen

1. Besuche: https://classroom.github.com
2. Klick auf **“New classroom”**
3. Name: z. B. `Pet Academy Test - Spring 2025 - Introduction to Privacy Tech`
4. Organisation: `pet-academy-test`
5. LMS: **“I don't use an LMS”**, dann einfach auf **“Continue”** klicken
   ???TBD TUWel Integration - Moodle
---

## 3. Assignment erstellen

1. Im Classroom: **“New assignment”**
2. Name: `Hello Python`
3. Assignment type: **Individual assignment**
4. Starter code: leer lassen (Template-Repo kommt erst)
5. Repository visibility: **Public**
6. Student admin access: ❌ deaktivieren
7. Feedback pull requests: ✅ aktivieren
8. Autograding tests: ? später (wir verwenden GitHub Actions)

---

## 4. Template-Repository vorbereiten

### Name: `hello-python-template`  
Ort: In der Organisation `pet-academy-test` (oder später transferieren)

**hello.py**
```python
def hallo(name):
    return f"Hallo, {name}!"

if __name__ == "__main__":
    print(hallo("PET Academy"))
```

**test_hello.py**
```python
from hello import hallo

def test_hallo():
    assert hallo("Alice") == "Hallo, Alice!"
    assert hallo("Bob") == "Hallo, Bob!"
    print("✅ Alle Tests bestanden.")

if __name__ == "__main__":
    test_hallo()
```

**.github/workflows/tests.yml**
```yaml
name: Python Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install pytest
      - run: pytest
```

**README.md**
```markdown
# Hello Python – PET Academy Assignment

Welcome to your first assignment at the **PET Academy**!

## Task
Implement the function `hallo(name)` in `hello.py`.

### Example
```python
>>> hallo("Alice")
'Hallo, Alice!'
```

## Run the tests
```bash
python test_hello.py
```

## Autograding
Tests run automatically using GitHub Actions.

## Tips
- Stick to the function signature
- Return a string
- Don’t break the tests ;)

### Einstellungen:
- Template-Repo aktivieren in den Settings
- In die Organisation `pet-academy-test` verschieben (falls es im persönlichen Account war)

---

## 5. Template eintragen & Assignment synchronisieren

1. Gehe zur Aufgabe → **Edit assignment**
2. Trage das Template ein: `pet-academy-test/hello-python-template`
3. Speichern
4. **“Sync assignment”** erscheint, sobald mind. 1 Studi beigetreten ist
   eventuell geht es auch automagisch
5. Klick → erzeugt Pull Requests in Studi-Repos mit dem Starter-Code

---

## 6. Studis einladen

1. Im Assignment → **Copy invitation link**
2. An Studis mailen
3. Studis klicken → erhalten automatisch ihr Repo mit Starter-Code

---

## 7. Autograding: Was triggert GitHub Actions?

| Aktion                   | Startet Autograding |
|--------------------------|---------------------|
| Commit auf `main`        | Ja               |
| PR mergen (Sync)         | Ja               |
| Datei im Web ändern      | Ja               |
| Nur Repo beitreten       | Nein             |

Wenn nichts läuft: Mini-Änderung machen (z. B. Leerzeichen) und committen.

---

## 8. Neue Studis später?

Wenn neue Studis beitreten **nachdem das Template verknüpft wurde**:
- Sie bekommen direkt den aktuellen Starter-Code
- Kein „Sync assignment“ nötig

Wenn man das Template **später ändert**:
- Dann „Sync assignment“ erneut → PR mit den Änderungen wird erstellt

---
