Skip to content

Commit 63fa355

Browse files
committed
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
1 parent f1b4766 commit 63fa355

5 files changed

Lines changed: 66 additions & 32 deletions

File tree

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
name: CI
1+
name: Build and Publish
22

3-
on: [push, pull_request]
3+
on: [push]
44

55
env:
66
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
88

9-
jobs:
10-
# linux:
11-
# runs-on: ubuntu-latest
12-
# timeout-minutes: 10
13-
14-
# steps:
15-
# - uses: actions/checkout@v4
16-
17-
# - name: Setup dotnet
18-
# uses: actions/setup-dotnet@v4
19-
# with:
20-
# dotnet-version: |
21-
# 6.0.x
22-
# 8.0.x
23-
# 10.0.x
9+
concurrency:
10+
group: build-publish-${{ github.ref }}
11+
cancel-in-progress: true
2412

25-
# - name: Build
26-
# run: ./build.sh
27-
28-
windows:
13+
jobs:
14+
whitespace-check:
15+
uses: ./.github/workflows/trailing-whitespace-check.yml
16+
17+
integration-tests:
18+
needs: whitespace-check
19+
uses: ./.github/workflows/integration-tests.yml
20+
21+
publish:
22+
needs: [whitespace-check, integration-tests]
2923
runs-on: windows-latest
3024
timeout-minutes: 10
3125

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PR Validation
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: pr-validation-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
whitespace-check:
11+
uses: ./.github/workflows/trailing-whitespace-check.yml
12+
secrets: inherit
13+
14+
integration-tests:
15+
needs: whitespace-check
16+
uses: ./.github/workflows/integration-tests.yml
17+
secrets: inherit
18+
19+
build:
20+
needs: [whitespace-check, integration-tests]
21+
runs-on: windows-latest
22+
timeout-minutes: 10
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup dotnet
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: |
31+
6.0.x
32+
8.0.x
33+
10.0.x
34+
35+
- name: Build
36+
run: .\build.ps1

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
name: Tests
22

33
on:
4-
push:
5-
branches: [ develop, main ]
6-
pull_request:
7-
branches: [ develop, main ]
8-
9-
concurrency:
10-
group: integration-tests-${{ github.ref }}
11-
cancel-in-progress: true
4+
workflow_call:
5+
permissions:
6+
actions: read
7+
contents: read
8+
checks: write
9+
pull-requests: write
1210

1311
jobs:
1412
tests:

.github/workflows/trailing-whitespace-check.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
name: Trailing Whitespace Check
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, reopened]
4+
workflow_call:
5+
permissions:
6+
actions: read
7+
contents: read
8+
checks: write
9+
pull-requests: write
610

711
jobs:
812
check-trailing-whitespace:

src/ElectronNET.sln

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test Apps", "Test Apps", "{
4141
EndProject
4242
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{985D39A7-5216-4945-8167-2FD0CB387BD8}"
4343
ProjectSection(SolutionItems) = preProject
44-
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
44+
..\.github\workflows\Build and Publish.yml = ..\.github\workflows\Build and Publish.yml
4545
..\.github\workflows\integration-tests.yml = ..\.github\workflows\integration-tests.yml
46+
..\.github\workflows\PR Validation.yml = ..\.github\workflows\PR Validation.yml
4647
..\.github\workflows\pr-comment.yml = ..\.github\workflows\pr-comment.yml
4748
..\.github\workflows\publish-wiki.yml = ..\.github\workflows\publish-wiki.yml
49+
..\.github\workflows\retry-test-jobs.yml.yml = ..\.github\workflows\retry-test-jobs.yml.yml
4850
..\.github\workflows\trailing-whitespace-check.yml = ..\.github\workflows\trailing-whitespace-check.yml
4951
EndProjectSection
5052
EndProject

0 commit comments

Comments
 (0)