Merge pull request #977 from softworkz/submit_revertnet6

Combine and separate workflows
This commit is contained in:
Florian Rappl
2025-12-12 07:23:26 +01:00
committed by GitHub
7 changed files with 119 additions and 33 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
@@ -45,6 +42,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Random delay (0-20 seconds)
shell: bash
run: |
DELAY=$((RANDOM % 21))
echo "Waiting for $DELAY seconds..."
sleep $DELAY
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:

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

50
.github/workflows/retry-test-jobs.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Tests auto-rerun
on:
workflow_run:
workflows: [ "PR Validation", "Build and Publish" ]
types: [ completed ]
jobs:
rerun-failed-matrix-jobs-once:
if: >
${{
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.run_attempt == 1
}}
runs-on: ubuntu-24.04
permissions:
actions: write
contents: read
steps:
- name: Decide whether to rerun (only if matrix jobs failed)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id }}
run: |
echo "Inspecting jobs of workflow run $RUN_ID in $REPO"
jobs_json="$(gh api repos/$REPO/actions/runs/$RUN_ID/jobs)"
echo "Jobs and conclusions:"
echo "$jobs_json" | jq '.jobs[] | {name: .name, conclusion: .conclusion}'
failed_matrix_jobs=$(echo "$jobs_json" | jq '
[ .jobs[]
| select(.conclusion == "failure"
and (.name | contains(" API-")))
]
| length
')
echo "Failed Integration Tests matrix jobs: $failed_matrix_jobs"
if [ "$failed_matrix_jobs" -gt 0 ]; then
echo "Detected failing Integration Tests jobs re-running failed jobs for this run."
gh run rerun "$RUN_ID" --failed
else
echo "Only non-matrix jobs (like Test Results) failed not auto-rerunning."
fi

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

View File

@@ -41,10 +41,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Apps", "Test Apps", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{985D39A7-5216-4945-8167-2FD0CB387BD8}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
..\.github\workflows\Build and Publish.yml = ..\.github\workflows\Build and Publish.yml
..\.github\workflows\integration-tests.yml = ..\.github\workflows\integration-tests.yml
..\.github\workflows\PR Validation.yml = ..\.github\workflows\PR Validation.yml
..\.github\workflows\pr-comment.yml = ..\.github\workflows\pr-comment.yml
..\.github\workflows\publish-wiki.yml = ..\.github\workflows\publish-wiki.yml
..\.github\workflows\retry-test-jobs.yml = ..\.github\workflows\retry-test-jobs.yml
..\.github\workflows\trailing-whitespace-check.yml = ..\.github\workflows\trailing-whitespace-check.yml
EndProjectSection
EndProject