1- name : Build and test
1+ name : Build and Test
22
33on :
44 push :
55 branches : [ "master" ]
66 pull_request :
77 branches : [ "master" ]
88
9+ env :
10+ BUILD_DIR : src\Build\Bin
11+ MSBUILD_TOOLSET : v143
12+ ARTIFACT_PREFIX : NppJSONViewer_
13+
914jobs :
1015 build :
11-
1216 runs-on : windows-latest
1317 strategy :
1418 fail-fast : false
@@ -17,45 +21,60 @@ jobs:
1721 build_platform : [Win32, x64, ARM64]
1822
1923 steps :
20- # Step 1: Check out the code from the repo
21- - name : Checkout repo
22- uses : actions/checkout@v4
23- with :
24+ # Step 1: Check out the code from the repo
25+ - name : Checkout repo
26+ uses : actions/checkout@v4
27+ with :
2428 submodules : recursive
2529
26- # Step 2: Prepare for build
27- - name : Pre Build
28- uses : microsoft/setup-msbuild@v2
30+ # Step 2: Prepare for build
31+ - name : Setup MSBuild
32+ uses : microsoft/setup-msbuild@v2
2933
30- # Step 3: Build projects and unit test
31- - name : Build
32- working-directory : src
33- run : msbuild NppJSONViewer.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="v143"
34-
35- # Step 4: Upload build binary artifacts
36- - name : Archive binaries artifacts
37- uses : actions/upload-artifact@v4
38- with :
39- name : ${{ matrix.build_platform}}_${{ matrix.build_configuration}}
40- path : src\Build\Bin\${{ matrix.build_configuration}}\${{ matrix.build_platform}}\NPPJSONViewer.dll
41-
42- # Step 5: Upload build pdb artifacts
43- - name : Archive symbols artifacts
44- uses : actions/upload-artifact@v4
45- with :
46- name : ${{ matrix.build_platform}}_${{ matrix.build_configuration}}_pdb
47- path : src\Build\Bin\${{ matrix.build_configuration}}\${{ matrix.build_platform}}\NPPJSONViewer.pdb
48-
49- # Step 6: Run unit tests for x86 | Release
50- - name : Run tests x86 | Release
51- if : matrix.build_platform == 'Win32' && matrix.build_configuration == 'Release'
52- run : |
53- cd src\Build\Bin\Release\Win32
54- ./UnitTest.exe
55-
56- # Step 7: Run unit tests for x64 | Release
57- - name : Run tests x64 | Release
58- if : matrix.build_platform == 'x64' && matrix.build_configuration == 'Release'
59- run : |
60- cd src\Build\Bin\Release\x64
61- ./UnitTest.exe
34+ # Step 3: Build projects and unit test
35+ - name : Build code
36+ working-directory : src
37+ run : msbuild NppJSONViewer.sln /m /p:configuration="${{matrix.build_configuration}}" /p:platform="${{matrix.build_platform}}" /p:PlatformToolset=${{env.MSBUILD_TOOLSET}}
38+
39+ # Step 4: Upload build binary artifacts for deployment
40+ - name : Archive binaries artifacts
41+ uses : actions/upload-artifact@v4
42+ with :
43+ name : ${{env.ARTIFACT_PREFIX}}${{matrix.build_platform}}_${{matrix.build_configuration}}
44+ path : ${{env.BUILD_DIR }}\${{matrix.build_configuration}}\${{matrix.build_platform}}\NPPJSONViewer.dll
45+
46+ # Step 5: Upload build pdb artifacts
47+ - name : Archive symbols artifacts
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : ${{env.ARTIFACT_PREFIX}}${{matrix.build_platform}}_${{matrix.build_configuration}}_pdb
51+ path : ${{env.BUILD_DIR }}\${{matrix.build_configuration}}\${{matrix.build_platform}}\NPPJSONViewer.pdb
52+
53+ # Step 6: Run unit tests for x86 and x64
54+ - name : Run unit tests
55+ if : matrix.build_platform == 'Win32' || matrix.build_platform == 'x64'
56+ run : |
57+ cd ${{env.BUILD_DIR}}\${{matrix.build_configuration}}\${{matrix.build_platform}}
58+ ./UnitTest.exe
59+
60+ upload-full-artifacts :
61+ # Trigger this job only after all 'build' jobs are complete
62+ needs : build
63+ runs-on : windows-latest
64+ strategy :
65+ fail-fast : true
66+
67+ steps :
68+ # Step 7: Download all artifacts from the build job
69+ - name : Download all artifacts
70+ uses : actions/download-artifact@v4
71+ with :
72+ pattern : ${{env.ARTIFACT_PREFIX}}*
73+ path : all_artifacts\
74+
75+ # Step 8: Upload consolidated artifacts as a single artifact
76+ - name : Upload full artifact
77+ uses : actions/upload-artifact@v4
78+ with :
79+ name : ${{env.ARTIFACT_PREFIX}}ALL
80+ path : all_artifacts\**
0 commit comments