Skip to content

Commit 24a437b

Browse files
Merge pull request #30 from dataplat/testBranch
Adding tests on PR
2 parents 076cda7 + f04f593 commit 24a437b

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed

.github/workflows/pr.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
- sampler # temporary branch for testing
6+
- develop
7+
paths-ignore:
8+
- CHANGELOG.md
9+
env:
10+
buildFolderName: output
11+
buildArtifactName: output
12+
testResultFolderName: testResults
13+
jobs:
14+
Build_Stage_Package_Module:
15+
name: Package Module
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{github.event.pull_request.head.ref}}
22+
repository: ${{github.event.pull_request.head.repo.full_name}} # checkout the correct branch name
23+
fetch-depth: 0
24+
- name: Install GitVersion
25+
uses: gittools/actions/gitversion/setup@v0.9.15
26+
with:
27+
versionSpec: 5.x
28+
- name: Evaluate Next Version
29+
uses: gittools/actions/gitversion/execute@v0.9.15
30+
with:
31+
configFilePath: GitVersion.yml
32+
- name: Build & Package Module
33+
shell: pwsh
34+
run: ./build.ps1 -ResolveDependency -tasks pack -Verbose
35+
env:
36+
ModuleVersion: ${{ env.gitVersion.NuGetVersionV2 }}
37+
- name: Publish Build Artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: ${{ env.buildArtifactName }}
41+
path: ${{ env.buildFolderName }}/
42+
Test_Stage_test_linux:
43+
name: Linux
44+
runs-on: ubuntu-latest
45+
needs:
46+
- Build_Stage_Package_Module
47+
steps:
48+
- name: Checkout Code
49+
uses: actions/checkout@v3
50+
with:
51+
ref: ${{github.event.pull_request.head.ref}}
52+
repository: ${{github.event.pull_request.head.repo.full_name}} # checkout the correct branch name
53+
fetch-depth: 0
54+
- name: Download Build Artifact
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: ${{ env.buildArtifactName }}
58+
path: ${{ env.buildFolderName }}
59+
- name: Run Tests
60+
shell: pwsh
61+
run: ./build.ps1 -tasks noop ; ./build.ps1 -tasks test
62+
- name: Publish Test Artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
66+
name: CodeCoverageLinux
67+
if: success() || failure()
68+
Test_Stage_test_windows_core:
69+
name: Windows (PowerShell)
70+
runs-on: windows-2019
71+
needs:
72+
- Build_Stage_Package_Module
73+
steps:
74+
- name: Checkout Code
75+
uses: actions/checkout@v3
76+
with:
77+
ref: ${{github.event.pull_request.head.ref}}
78+
repository: ${{github.event.pull_request.head.repo.full_name}} # checkout the correct branch name
79+
fetch-depth: 0
80+
- name: Download Build Artifact
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: ${{ env.buildArtifactName }}
84+
path: ${{ env.buildFolderName }}
85+
- name: Run Tests
86+
shell: pwsh
87+
run: ./build.ps1 -tasks noop; ./build.ps1 -tasks test
88+
89+
- name: Publish Test Artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
93+
name: CodeCoverageWinPS7
94+
if: success() || failure()
95+
Test_Stage_test_windows_ps:
96+
name: Windows (Windows PowerShell)
97+
runs-on: windows-2019
98+
needs:
99+
- Build_Stage_Package_Module
100+
steps:
101+
- name: Checkout Code
102+
uses: actions/checkout@v3
103+
with:
104+
ref: ${{github.event.pull_request.head.ref}}
105+
repository: ${{github.event.pull_request.head.repo.full_name}} # checkout the correct branch name
106+
fetch-depth: 0
107+
- name: Download Build Artifact
108+
uses: actions/download-artifact@v4
109+
with:
110+
name: ${{ env.buildArtifactName }}
111+
path: ${{ env.buildFolderName }}
112+
- name: Run Tests
113+
shell: pwsh
114+
run: ./build.ps1 -ResolveDependency -tasks test
115+
- name: Publish Test Artifact
116+
uses: actions/upload-artifact@v4
117+
with:
118+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
119+
name: CodeCoverageWinPS51
120+
if: success() || failure()
121+
Test_Stage_Code_Coverage:
122+
name: Publish Code Coverage
123+
if: success() || failure()
124+
runs-on: ubuntu-latest
125+
needs:
126+
- Build_Stage_Package_Module
127+
- Test_Stage_test_linux
128+
- Test_Stage_test_windows_core
129+
- Test_Stage_test_windows_ps
130+
steps:
131+
- name: Checkout Code
132+
uses: actions/checkout@v3
133+
with:
134+
ref: ${{github.event.pull_request.head.ref}} # checkout the correct branch name
135+
repository: ${{github.event.pull_request.head.repo.full_name}} # checkout the correct branch name
136+
fetch-depth: 0
137+
138+
- name: Download Test Artifact Linux
139+
uses: actions/download-artifact@v4
140+
with:
141+
name: CodeCoverageLinux
142+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/
143+
- name: Download Test Artifact Windows (PS 5.1)
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: CodeCoverageWinPS51
147+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/
148+
- name: Download Test Artifact Windows (PS7)
149+
uses: actions/download-artifact@v4
150+
with:
151+
name: CodeCoverageWinPS7
152+
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/
153+
154+
- name: Publish Linux Test Results
155+
id: linux-test-results
156+
uses: EnricoMi/publish-unit-test-result-action@v2
157+
if: always()
158+
with:
159+
nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageLinux/NUnit*.xml
160+
check_name: Linux Test Results
161+
- name: Publish WinPS51 Test Results
162+
id: winps51-test-results
163+
uses: EnricoMi/publish-unit-test-result-action@v2
164+
if: always()
165+
with:
166+
nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS51/NUnit*.xml
167+
check_name: WinPS51 Test Results
168+
- name: Publish WinPS71 Test Results
169+
id: winps71-test-results
170+
uses: EnricoMi/publish-unit-test-result-action@v2
171+
if: always()
172+
with:
173+
nunit_files: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/CodeCoverageWinPS7/NUnit*.xml
174+
check_name: WinPS71 Test Results

0 commit comments

Comments
 (0)