Combine and separate workflows

- Separate between PR and Push execution (with and without secrets)
- Turn tests into re-usable workflows and call them from the main ones
This commit is contained in:
softworkz
2025-12-12 01:22:36 +01:00
parent f1b4766360
commit 5a7cbd972f
7 changed files with 65 additions and 36 deletions

View File

@@ -1,33 +1,25 @@
name: CI
name: Build and Publish
on: [push, pull_request]
on: [push]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
concurrency:
group: build-publish-${{ github.ref }}
cancel-in-progress: true
jobs:
# linux:
# runs-on: ubuntu-latest
# timeout-minutes: 10
Integration-Tests:
uses: ./.github/workflows/integration-tests.yml
name: '1'
# steps:
# - uses: actions/checkout@v4
# - name: Setup dotnet
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: |
# 6.0.x
# 8.0.x
# 10.0.x
# - name: Build
# run: ./build.sh
windows:
Publish:
needs: [Integration-Tests]
runs-on: windows-latest
timeout-minutes: 10
name: '2 / Publish'
steps:
- uses: actions/checkout@v4

39
.github/workflows/PR Validation.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: PR Validation
on: [pull_request]
concurrency:
group: pr-validation-${{ github.ref }}
cancel-in-progress: true
jobs:
Whitespace-Check:
uses: ./.github/workflows/trailing-whitespace-check.yml
secrets: inherit
name: '1'
Tests:
needs: Whitespace-Check
uses: ./.github/workflows/integration-tests.yml
secrets: inherit
name: '2'
build:
needs: [Whitespace-Check, Tests]
runs-on: windows-latest
timeout-minutes: 10
name: '3 / Build'
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x
- name: Build
run: .\build.ps1

View File

@@ -1,10 +1,7 @@
name: Tests
name: Tests
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
workflow_call:
concurrency:
group: integration-tests-${{ github.ref }}
@@ -12,7 +9,7 @@ concurrency:
jobs:
tests:
name: Integration Tests (${{ matrix.os }} / Electron ${{ matrix.electronVersion }})
name: ${{ matrix.os }} API-${{ matrix.electronVersion }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false

View File

@@ -2,7 +2,7 @@ name: Create PR Comments
on:
workflow_run:
workflows: ["Tests"]
workflows: [ "PR Validation" ]
types: [completed]
permissions:
@@ -14,7 +14,7 @@ jobs:
pr-comment:
name: Post Test Result as PR comment
runs-on: ubuntu-24.04
if: github.event.workflow_run.event == 'pull_request'
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion != 'cancelled'
steps:
- name: Download CTRF artifact

View File

@@ -1,8 +1,8 @@
name: Tests auto-rerun
name: Tests auto-rerun
on:
workflow_run:
workflows: [ "Tests" ]
workflows: [ "PR Validation", "Build and Publish" ]
types: [ completed ]
jobs:
@@ -35,7 +35,7 @@ jobs:
failed_matrix_jobs=$(echo "$jobs_json" | jq '
[ .jobs[]
| select(.conclusion == "failure"
and (.name | startswith("Integration Tests (")))
and (.name | contains(" API-")))
]
| length
')

View File

@@ -1,11 +1,10 @@
name: Trailing Whitespace Check
name: Whitespace Check
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
check-trailing-whitespace:
check-whitespace:
runs-on: ubuntu-latest
permissions:
contents: read