Skip to content

Commit 456ab61

Browse files
authored
Merge pull request #29 from dataplat/testsonPR
lets run some tests on PR
2 parents ff43d7b + edce5ba commit 456ab61

File tree

1 file changed

+175
-0
lines changed

1 file changed

+175
-0
lines changed

.github/workflows/pr.yml

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

0 commit comments

Comments
 (0)