Skip to content

Commit 237b979

Browse files
committed
up
1 parent 5c572b6 commit 237b979

19 files changed

Lines changed: 1388 additions & 0 deletions

.github/labeler.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
demo:
2+
- changed-files:
3+
- any-glob-to-any-file: 'contributions/demo/**'
4+
5+
contribution_to_opensource:
6+
- changed-files:
7+
- any-glob-to-any-file: 'contributions/open-source/**'
8+
9+
feedback:
10+
- changed-files:
11+
- any-glob-to-any-file: 'contributions/feedback/**'
12+
13+
presentation:
14+
- changed-files:
15+
- any-glob-to-any-file: 'contributions/presentation/**'
16+
17+
scientific-paper:
18+
- changed-files:
19+
- any-glob-to-any-file: 'contributions/scientific-paper/**'
20+
21+
tutorial:
22+
- changed-files:
23+
- any-glob-to-any-file: 'contributions/executable-tutorial/**'

.github/pull_request_template.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
**The pull request must both contain a README.md and have description following the template below. This README.md must be the only file affected by the PR, and its contents must match the PR description exactly. The pull request must be created 3 business days before the actual delivery.**
2+
3+
**The README.md file must be located in the directory**:
4+
5+
`contributions/<category>/[<week>/]<kth-id-1>-<kth-id-2>/README.md`
6+
7+
# Assignment Proposal
8+
9+
## Title
10+
11+
_The title of your proposal_
12+
13+
## Names and KTH ID
14+
15+
- Student name 1 (student123@kth.se)
16+
- Student name 2 (student321@kth.se)
17+
18+
## Deadline
19+
20+
_Selected deadline for the assignment_
21+
22+
_If contribution is a **demo** or **presentation** or **scientific-paper** pick one of the following:_
23+
- Week 2
24+
- Week 3
25+
- Week 4
26+
- Week 5
27+
- Week 6
28+
- Week 7
29+
30+
_Else pick one of the following:_
31+
- Task 1
32+
- Task 2
33+
- Task 3
34+
35+
## Category
36+
37+
_Category of your proposal_
38+
39+
_Pick one of the following:_
40+
- Demo
41+
- Presentation
42+
- Executable tutorial
43+
- Scientific paper
44+
- Open source
45+
- Feedback
46+
47+
## Description
48+
49+
_Description of your proposal_
50+
51+
**Relevance**
52+
53+
_Motivate the relevance of your proposal with respect to DevOps_
54+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Statistic Information for Each Assignment Category
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the 2021 branch
8+
push:
9+
branches:
10+
- "2025"
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
# This workflow contains a single job called "build"
18+
count-assignments:
19+
# The type of runner that the job will run on
20+
runs-on: ubuntu-latest
21+
22+
# Steps represent a sequence of tasks that will be executed as part of the job
23+
steps:
24+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25+
- uses: actions/checkout@v2
26+
27+
# Setup Python
28+
- name: Setup Python
29+
uses: actions/setup-python@v2.2.1
30+
with:
31+
python-version: '3.x'
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
if [ -f ./tools/requirements.txt ]; then pip install -r ./tools/requirements.txt; fi
37+
38+
# Set timezone to Europe/Stockholm
39+
- name: Set timezone
40+
run: sudo timedatectl set-timezone Europe/Stockholm
41+
42+
# Runs a single command using the runners shell
43+
- name: Update the statistic issue
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
REPO_FULLNAME: ${{ github.repository }}
47+
CONTRIBUTIONS_PATH: ${{ secrets.ASSIGNMENT_STAT_CONTRIBUTIONS_PATH }}
48+
ISSUE_NUMBER: ${{ secrets.ASSIGNMENT_STAT_ISSUE_NUMBER }}
49+
run: python ./tools/stat_submissions.py -p $CONTRIBUTIONS_PATH --printInMarkdown --printStudentStat --publish

.github/workflows/check_task.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Check task
2+
3+
# Controls when the workflow will run
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- reopened # good to check canvas again to see if eligibility changed
9+
- edited # we need to check the new description against the README
10+
- synchronize
11+
branches:
12+
- 2025
13+
paths:
14+
- contributions/**
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
check-affected-files:
19+
name: Check affected files
20+
runs-on: ubuntu-latest
21+
outputs:
22+
affected_file: ${{ steps.check-affected-files.outputs.affected_file }}
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
ref: ${{ github.event.pull_request.head.sha }}
27+
28+
- name: Get changed files
29+
id: changed-files
30+
uses: tj-actions/changed-files@v45
31+
32+
- name: Check affected files
33+
id: check-affected-files
34+
env:
35+
# get all affected files (created, modified, deleted, etc.)
36+
FILES: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
37+
FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_and_modified_files_count }}
38+
run: |
39+
for file in "$FILES"; do
40+
echo "Info: $file was changed"
41+
done
42+
if [ "$FILES_COUNT" -ne 1 ]; then
43+
echo "Error: More than one file affected ($FILES_COUNT)"
44+
exit 1
45+
fi
46+
if [[ "$FILES" =~ ^contributions\/(executable-tutorial|feedback|open-source)\/[^\/]+\/README\.md$ ]]; then
47+
echo "Info: Matches async task"
48+
elif [[ "$FILES" =~ ^contributions\/(demo|presentation|scientific-paper)\/week[2-7]\/[^\/]+\/README\.md$ ]]; then
49+
echo "Info: Matches sync task"
50+
else
51+
echo "Error: File in wrong directory ($FILES)"
52+
exit 1
53+
fi
54+
55+
echo "affected_file=$FILES" >> "$GITHUB_OUTPUT"
56+
57+
check-pr-description:
58+
name: Check whether Pull Request description matches affected file
59+
needs: check-affected-files
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
with:
64+
ref: ${{ github.event.pull_request.head.sha }}
65+
66+
- name: Install wdiff
67+
# we use wdiff (word-diff) instead of plain diff (line-based) to ensure
68+
# that we only enforce *content* to be the same rather than specific
69+
# file formatting that would otherwise be ignored when the markdown is
70+
# rendered. e.g., wdiff allows the README to break lines at col 80 for
71+
# readability while still having the PR description without mid-sentence
72+
# breaks (since GitHub descriptions don't support them)
73+
run: |
74+
sudo apt update
75+
sudo apt install -y wdiff
76+
77+
- name: Check PR description
78+
env:
79+
AFFECTED_FILE: ${{ needs.check-affected-files.outputs.affected_file }}
80+
PR_BODY: ${{ github.event.pull_request.body }}
81+
run: |
82+
BODY_FILE="$(mktemp)"
83+
echo "$PR_BODY" > $BODY_FILE
84+
if wdiff "$AFFECTED_FILE" "$BODY_FILE"; then
85+
echo "Info: PR description matches affected file"
86+
else
87+
echo "Error: PR description does not match affected file!"
88+
exit 1
89+
fi
90+
91+
check-canvas:
92+
name: Check proposal is compatible with previous student task registrations
93+
94+
# The type of runner that the job will run on
95+
runs-on: ubuntu-latest
96+
97+
# Steps represent a sequence of tasks that will be executed as part of the job
98+
steps:
99+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
100+
- uses: actions/checkout@v2
101+
with:
102+
ref: ${{ github.event.pull_request.head.sha }}
103+
104+
- name: 'Get tools'
105+
uses: actions/checkout@v2.3.4
106+
with:
107+
repository: KTH/github-canvas-integration-devops
108+
ref: main
109+
path: canvas-code
110+
111+
# Setup Python
112+
- name: Setup Python
113+
uses: actions/setup-python@v2.2.1
114+
with:
115+
python-version: '3.x'
116+
117+
- name: Install dependencies
118+
run: |
119+
python -m pip install --upgrade pip
120+
if [ -f ./canvas-code/requirements.txt ]; then pip install -r ./canvas-code/requirements.txt; fi
121+
# Runs a single command using the runners shell
122+
- name: Update grading in canvas
123+
env:
124+
CANVAS_TOKEN: ${{ secrets.CANVAS_TOKEN }}
125+
CANVAS_COURSE_ID: ${{ secrets.CANVAS_COURSE_ID }}
126+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
127+
GH_REPO_FULLNAME: ${{ secrets.GH_REPO_FULLNAME }}
128+
run: |
129+
export PYTHONPATH="$PWD/canvas-code/utils"
130+
python ./canvas-code/update_task.py --mode check --pr ${{github.event.number}}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Essay Word Count
2+
'on':
3+
pull_request:
4+
workflow_dispatch: {}
5+
jobs:
6+
check-essay:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Install xpdf
11+
run: >
12+
sudo apt-get update;
13+
sudo apt-get install -y xpdf
14+
- id: file_changes
15+
uses: trilom/file-changes-action@v1.2.3
16+
- name: Check the submitted essays
17+
run: >
18+
added_files='${{ steps.file_changes.outputs.files_added }},${{ steps.file_changes.outputs.files_modified }}';
19+
added_files=${added_files//\"/};
20+
added_files=${added_files//[/};
21+
added_files=${added_files//]/};
22+
added_files=${added_files// /;};
23+
added_files=${added_files//,/ };
24+
for item in ${added_files[@]}; do
25+
added_file=${item//;/ };
26+
echo "Checking file: $added_file"
27+
if [[ "$added_file" == *"contributions/essay/"* ]] && [[ "$added_file" == *"pdf" ]] ; then
28+
words_with_periods=$(sudo pdftotext "${added_file}" - | wc -w)
29+
words_without_periods=$(sudo pdftotext "${added_file}" - | tr -d '.' | wc -w)
30+
echo "File $added_file has $words_with_periods words with periods and $words_without_periods without periods"
31+
if [[ ($words_with_periods -lt 2400 || $words_with_periods -gt 2600) && ($words_without_periods -lt 2400 || $words_without_periods -gt 2600) ]]; then
32+
exit 1
33+
fi
34+
fi
35+
done

.github/workflows/labeler.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pull Request Labeler
2+
on:
3+
- pull_request_target
4+
5+
jobs:
6+
labeler:
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
13+
with:
14+
sync-labels: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lecture Participation Information
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
track-participation:
12+
if: >
13+
github.event.issue.number == 2697 &&
14+
github.event.comment.author_association != 'COLLABORATOR' &&
15+
github.event.comment.author_association != 'OWNER' &&
16+
github.event.comment.author_association != 'MEMBER'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Python
22+
uses: actions/setup-python@v5.2.0
23+
with:
24+
python-version: '3.11.8'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
if [ -f ./tools/requirements.txt ]; then pip install -r ./tools/requirements.txt; fi
30+
31+
- name: Update participation tracker
32+
working-directory: tools
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
REPO_FULLNAME: ${{ github.repository }}
36+
TRACKER_ISSUE_NUMBER: ${{ github.event.issue.number }}
37+
38+
run: python track_participation.py --printMarkdown --publish

0 commit comments

Comments
 (0)