Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B1 New Version - with Features #371

Merged
merged 19 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/main'
  • Loading branch information
asliprinter committed Jul 13, 2024
commit ae475dcbde5967ac63df62af395456cbbad6bb46
63 changes: 63 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

### Opening a Pull Request to Update your Project

I've started a documentation on how we should use the forking workflow here:

[https://github.com/htw-imi-showtime/showtime-website/blob/documentation/doc/forking-workflow/index.md](https://github.com/htw-imi-showtime/showtime-website/blob/documentation/doc/forking-workflow/index.md)
(will not be merged to main due to file sizes)

Please follow these Steps & Guidelines for your Pull Request:

#### Before you Request a Review Check and Tick these Boxes:

[] make sure that the hugo site build works and check the result visually.
[] merge your local branch with upstream/main (see [update doc](https://github.com/htw-imi-showtime/showtime-website/blob/main/doc/update.md))
[] Deploy the Site on your github pages by activating the "Deploy Page using GH-Actions" Workflow in "gh-pages-action.yml"
[] make sure that your PR contains only files / file changes within your project subdirectory.
[] make sure that all your file names consist only of lower case letters, numbers, or [-_.] - with only one . for the file extension
[] delete all unnecessary files from your PR (including cat.jpg and kitty.jpg)
[] check the image file sizes. All Images have to be as small as possible. See [./doc/disk_usage.md](https://github.com/htw-imi-showtime/showtime-website/blob/main/doc/disk_usage.md) about this issues, there's a script: [./bin/images-smaller.sh](https://github.com/htw-imi-showtime/showtime-website/blob/main/bin/images-smaller.sh)

**Note that if you fail to do so, I may simply reduce the file sizes brute force using
the script above - WITHOUT CHECKING THE QUALITY**

[] if everythings seems fine, request a review by bkleinen on github. (on the upper right)

#### Fill out this Information:

1. Change the PR Title to: <project-id> <describe your changes> (e.g. B0 - update techstack.md) and describe your changes:


2. URL of your Preview Site Containing the Changes:


3. When did your Project Supervisor review your changes? (Date/Note or require review for PR):


4. If your disk usage exceeds 500K, provide a reason while you want to include so many images or why certain images need to be that big:


#### IMPORTANT: if you run into trouble / If the checks fail...

- if you cannot figure out why a check fails or you think that it may be wrong,
don't hesitate to contact me! (e.g. by requesting a review and commenting in the pr)

- run the checks locally with:

./bin/check-project-update-pr/run-all.sh <project_id>

#### All good?

If all checks run successfully the PR will be reviewed and, if no
further changes are requested, merged and closed.
(this is the time to update and start a new branch!)

### More Information

We are using the Forking Workflow.

- [Best Practices for Pull Requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started/best-practices-for-pull-requests)
- Atlassian Git Tutorial: [Forking Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow)
- GitHub Docs: [Collaborating with pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests)
- Documentation in [README.MD](https://github.com/htw-imi-showtime/showtime-website/blob/main/README.MD) and [/doc](https://github.com/htw-imi-showtime/showtime-website/blob/main/doc)

25 changes: 19 additions & 6 deletions .github/workflows/build_pr.yml → .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: pull request
name: Build Hugo and Check Title

on:
pull_request:

workflow_dispatch:

jobs:
deploy:
hugo-build:
if: github.repository == 'htw-imi-showtime/showtime-website'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: false
- name: Get Theme
run: |
git submodule update --init themes/showtime-theme-2021

- name: Hugo setup
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.0'
extended: true
@@ -29,4 +28,18 @@ jobs:
--environment staging \
--baseURL "https://htw-imi-showtime.github.io/tryout/" \
--buildDrafts


check-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1
- name: check pr title starts with project id or "STW"
id: extract_pid
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
./bin/check-project-update-pr/check-title.sh "$PR_TITLE"

229 changes: 229 additions & 0 deletions .github/workflows/check-project-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Check Project Update PR

on:
pull_request:
paths:
- 'content/ss24/**'
workflow_dispatch:

jobs:

check-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1
- name: check pr title starts with project id
id: extract_pid
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
./bin/check-project-update-pr/check-title.sh "$PR_TITLE"

check_disk_usage:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
needs: check-title
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1

- name: check disk usage
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
PID=$(bin/check-project-update-pr/extract_pid_from_pr_title.sh "$PR_TITLE")
./bin/check-project-update-pr/disk-usage.sh $PID


get_files_in_pr:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
name: "Download changed files list"
needs: check-title
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 1

- name: extract project id
id: extract_pid
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
project_id=$(bin/check-project-update-pr/extract_pid_from_pr_title.sh "$PR_TITLE")
pid_ok=$?
echo "project_id=$project_id" >> $GITHUB_OUTPUT
echo "pid_ok=$pid_ok" >> $GITHUB_OUTPUT
exit 0

- name: 'download changed files from gh api'
uses: dorny/paths-filter@v3
id: filter
with:
list-files: 'shell'
filters: |
in_project:
- 'content/**/${{ steps.extract_pid.outputs.project_id }}-*/**'
other_files:
- '!content/**/${{ steps.extract_pid.outputs.project_id }}-*/**'
with_spaces:
- '**/*\ *'

- name: create artifact dir and empty files
run: |
mkdir changed_files
touch changed_files/files-project.txt
touch changed_files/files-other.txt
touch changed_files/files-with-spaces.txt

- name: 'fail if pr contains files with spaces'
if: (steps.filter.outputs.with_spaces == 'true')
env:
all_files: ${{ steps.filter.outputs.with_spaces_files }}
run: |
echo "--------- PR contains files with spaces in their name - EXITING."
echo $all_files | tr ' ' '\n'
exit 101

- name: write changed files
if: (steps.filter.outputs.in_project == 'true')
env:
all_files: ${{ steps.filter.outputs.in_project_files }}
run: |
echo "--------- project_files:"
pr_adds_files=$(bin/check-project-update-pr/remove_deleted_files.sh $all_files)
echo $pr_adds_files | tr ' ' '\n'
echo $pr_adds_files > changed_files/files-project.txt

- name: 'files outside of project folder'
if: (steps.filter.outputs.other_files == 'true')
env:
all_files: ${{ steps.filter.outputs.other_files_files }}
run: |
echo "--------- non_project_files (may not be part of project update PR!):"
pr_adds_files=$(bin/check-project-update-pr/remove_deleted_files.sh $all_files)
echo $pr_adds_files | tr ' ' '\n'
echo $pr_adds_files > changed_files/files-other.txt


- name: list artifact files
run: |
ls -lart changed_files
echo "------------ changed_files/files-project.txt"
cat changed_files/files-project.txt | tr ' ' '\n'
echo "------------ changed_files/files-other.txt"
cat changed_files/files-other.txt | tr ' ' '\n'

- name: Upload changed-files.txt
uses: actions/upload-artifact@v4
with:
name: changed_files
path: changed_files/
retention-days: 1


check_artifact:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
name: "look for artifact files"
needs: get_files_in_pr
runs-on: ubuntu-latest
steps:
- name: Download changed_files.txt
uses: actions/download-artifact@v4
with:
name: changed_files

- name: list artifact files
run: |
tree
ls -lart
echo "------------ files-project.txt"
cat files-project.txt | tr ' ' '\n'
echo "------------ files-other.txt"
cat files-other.txt | tr ' ' '\n'



check_files_in_pr:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
name: "check for files outside of project folder"
needs: get_files_in_pr
runs-on: ubuntu-latest
steps:
- name: Download changed_files.txt
uses: actions/download-artifact@v4
with:
name: changed_files
- name: 'check for files outside the project folder'
run: |
FILES="$(cat files-other.txt)"
if ! [ -z "$FILES" ]; then
echo "--------- non_project_files found in PR:"
echo $FILES | tr ' ' '\n'
echo "ERROR: these files may not be changed within a project update PR!"
exit 14
else
echo "none found -> ok!"
fi



check_for_cats_download:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
name: "check for cat template files"
needs: get_files_in_pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: Download changed_files.txt
uses: actions/download-artifact@v4
with:
name: changed_files

- name: check for template cat images
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
FILES="$(cat files-project.txt)"
./bin/check-project-update-pr/check-for-cats-based-on-filenames.sh "$FILES"


check_file_name_convention:
if: ${{ ! startsWith(github.event.pull_request.title, 'STW') }}
name: "check file name conventions"
needs: get_files_in_pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: Download changed_files.txt
uses: actions/download-artifact@v4
with:
name: changed_files

- name: check name conventions
run: |
echo "----------------"
cat files-project.txt
echo "----------------"
FILES="$(cat files-project.txt)"
./bin/check-project-update-pr/check-file-names.sh "$FILES"


2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
git submodule update --init themes/showtime-theme-2021

- name: Hugo setup
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.0'
extended: true
2 changes: 1 addition & 1 deletion .github/workflows/deploy-production-without-archive.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ jobs:
run: |
git submodule update --init themes/showtime-theme-2021
- name: Hugo setup
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.0'
extended: true
4 changes: 2 additions & 2 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -14,9 +14,9 @@ jobs:
with:
submodules: true
- name: Hugo setup
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.01'
hugo-version: '0.128.0'
extended: true

- name: Build
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
git submodule update --init themes/showtime-theme-2021

- name: Hugo setup
uses: peaceiris/actions-hugo@v2
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.128.0'
extended: true
Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.