From 95997076162ef394aad2f500e7fdb7d885fc6fb6 Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 10:48:53 +0000 Subject: [PATCH 1/7] Create codeql.yml --- .github/workflows/codeql.yml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ce7f9f8 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,46 @@ +name: "CodeQL" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '16 23 * * 4' + +jobs: + analyze: + name: Analyze + # Avoid running for Draft pull requests + if: github.event.pull_request.draft == false + runs-on: 'ubuntu-latest' + timeout-minutes: 360 + permissions: + security-events: write + actions: read + contents: read + + strategy: + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: 'csharp' + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Build + run: dotnet build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:csharp" From b064e588465f8a54586b0c50faa5a652f65cd9a4 Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:17:48 +0000 Subject: [PATCH 2/7] Upload test artifacts and add check for do-not-merge label --- .github/workflows/build.yml | 17 +++++++++++------ .github/workflows/labels.yml | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/labels.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f53e8cd..6b148bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v3 with: @@ -25,16 +25,21 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - name: Build - run: dotnet build + run: dotnet build --no-incremental - name: Test - run: dotnet test --no-build --verbosity normal - + run: dotnet test --no-build --verbosity normal --logger trx --results-directory "TestResults" + - name: Upload test results + uses: actions/upload-artifact@v3 + with: + name: dotnet-results + path: TestResults + if: ${{ always() }} pack: runs-on: ubuntu-latest needs: @@ -43,7 +48,7 @@ jobs: if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v3 with: diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..0df762a --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,18 @@ +name: Check PR Labels + +on: + pull_request: + types: + - opened + - labeled + - unlabeled + +jobs: + check_labels: + runs-on: ubuntu-latest + steps: + - name: Check for "do-not-merge" label + if: contains(github.event.pull_request.labels.*.name, 'do-not-merge') + run: | + echo "This PR should not be merged." + exit 1 From 7460144a95279ada6c6eb3e8a2e48bdc3b9767ea Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:20:19 +0000 Subject: [PATCH 3/7] Improved check labels job --- .github/workflows/labels.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 0df762a..91c8f8b 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -8,11 +8,11 @@ on: - unlabeled jobs: - check_labels: + check: runs-on: ubuntu-latest steps: - - name: Check for "do-not-merge" label - if: contains(github.event.pull_request.labels.*.name, 'do-not-merge') + - name: Check for "do not merge" label + if: contains(github.event.pull_request.labels.*.name, 'do not merge') run: | echo "This PR should not be merged." exit 1 From 21518c0c1ad2530c047ecd330f810a9773c57eee Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:22:58 +0000 Subject: [PATCH 4/7] Fixed labelss job --- .github/workflows/labels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 91c8f8b..c429f90 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -4,6 +4,8 @@ on: pull_request: types: - opened + - synchronize + - reopened - labeled - unlabeled From fca8bbbdd651809850508bbc0a2cdcd9af9d0eb8 Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:27:23 +0000 Subject: [PATCH 5/7] Fixed CodeQL schedule --- .github/workflows/codeql.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ce7f9f8..f7702e2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -5,7 +5,13 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + types: + - opened + - synchronize + - reopened + - ready_for_review schedule: + # Run every week, at a randomly picked time and day - cron: '16 23 * * 4' jobs: From b5621bf0745ddef1edb8ca5213f9eb8bbf8ab0f8 Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:30:37 +0000 Subject: [PATCH 6/7] Tweak lables check --- .github/workflows/labels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index c429f90..3c92bbc 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -4,7 +4,6 @@ on: pull_request: types: - opened - - synchronize - reopened - labeled - unlabeled From 8979813a84432da0e1ea75fa760c99be602958d9 Mon Sep 17 00:00:00 2001 From: Alessio Franceschelli Date: Fri, 19 Jan 2024 14:34:21 +0000 Subject: [PATCH 7/7] Revert "Tweak lables check" This reverts commit b5621bf0745ddef1edb8ca5213f9eb8bbf8ab0f8. --- .github/workflows/labels.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 3c92bbc..c429f90 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -4,6 +4,7 @@ on: pull_request: types: - opened + - synchronize - reopened - labeled - unlabeled