From 35d2a650fa7e9f86996584761d95047606cb61b2 Mon Sep 17 00:00:00 2001 From: ManuelLerchner Date: Wed, 1 Nov 2023 16:18:13 +0100 Subject: [PATCH] improve github actions --- .github/labeler.yml | 12 ++++++++ .github/workflows/build-docs.yml | 5 ++++ .github/workflows/build-project.yml | 16 +++++++---- .github/workflows/check-submission.yml | 34 +++++++++++++++++++++++ .github/workflows/clang-format.yml | 15 +++++++++- .github/workflows/pullrequest-labeler.yml | 11 ++++++++ 6 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/check-submission.yml create mode 100644 .github/workflows/pullrequest-labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..cae4413f9 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,12 @@ +tests: + - tests/**/* + +presentation: + - sheet*/**/* + +dependencies: + - libs/**/* + +repo: + - .github/**/* + - * diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 46b359af0..44dc3d454 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -4,6 +4,11 @@ on: push: branches: - master + paths: + - "src/**" + - "Doxyfile" + - "README.md" + - ".github/workflows/build-docs.yml" workflow_dispatch: diff --git a/.github/workflows/build-project.yml b/.github/workflows/build-project.yml index 6ce921150..4c8a133aa 100644 --- a/.github/workflows/build-project.yml +++ b/.github/workflows/build-project.yml @@ -2,12 +2,16 @@ name: Build Project on: pull_request: - branches: "*" - types: - - labeled - - synchronize + paths: + - "src/**" + - "CMakeLists.txt" + - ".github/workflows/build.yml" push: - branches: "*" + branches: "master" + paths: + - "src/**" + - "CMakeLists.txt" + - ".github/workflows/build.yml" workflow_dispatch: jobs: @@ -16,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install + - name: Install run: | sudo apt update sudo apt install libxerces-c-dev -y diff --git a/.github/workflows/check-submission.yml b/.github/workflows/check-submission.yml new file mode 100644 index 000000000..11ef875bd --- /dev/null +++ b/.github/workflows/check-submission.yml @@ -0,0 +1,34 @@ +name: Check Submissions + +on: + push: + branches: + - presentations + + workflow_dispatch: + +jobs: + check-submission: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Checkout 'presentations' branch + run: git checkout presentations + + # Check for all sheet[num] folders if they contain a submission folder + # Each submission folder should contain atleast a `GroupC_Assignment[num].pdf` and `README.md` file + - name: Check Submissions + run: | + for i in $(find . -type d -name "sheet*"); do + if [ -d "$i/submission" ]; then + if [ ! $(find $i/submission -type f -name "README.md" | wc -l) -eq 1 ]; then + echo "Missing README.md in $i/submission" + exit 1 + fi + if [ ! $(find $i/submission -type f -name "GroupC_Assignment*.pdf" | wc -l) -eq 1 ]; then + echo "Missing GroupC_Assignment*.pdf in $i/submission" + exit 1 + fi + fi + done diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d32bd90e0..a4d1b711a 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -1,5 +1,18 @@ name: clang-format Check -on: [push, pull_request] +on: + pull_request: + paths: + - "src/**" + - ".clang-format" + - ".github/workflows/build.yml" + push: + branches: "master" + paths: + - "src/**" + - ".clang-format" + - ".github/workflows/build.yml" + workflow_dispatch: + jobs: formatting-check: name: Formatting Check diff --git a/.github/workflows/pullrequest-labeler.yml b/.github/workflows/pullrequest-labeler.yml new file mode 100644 index 000000000..149e516dc --- /dev/null +++ b/.github/workflows/pullrequest-labeler.yml @@ -0,0 +1,11 @@ +name: Pull Request Labeler +on: [pull_request_target] + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true