Improve build workflow #92
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build_configuration: [Release, Debug] | |
| build_platform: [Win32, x64, ARM64] | |
| steps: | |
| # Step 1: Check out the code from the repo | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Step 2: Prepare for build | |
| - name: Pre Build | |
| uses: microsoft/setup-msbuild@v2 | |
| # Step 3: Build projects and unit test | |
| - name: Build code | |
| working-directory: src | |
| run: msbuild NppJSONViewer.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="v143" | |
| # Step 4: Upload build binary artifacts for deployment | |
| - name: Archive binaries artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NppJSONViewer_${{ matrix.build_platform}}_${{ matrix.build_configuration}} | |
| path: src\Build\Bin\${{ matrix.build_configuration}}\${{ matrix.build_platform}}\NPPJSONViewer.dll | |
| # Step 5: Upload build pdb artifacts | |
| - name: Archive symbols artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NppJSONViewer_${{ matrix.build_platform}}_${{ matrix.build_configuration}}_pdb | |
| path: src\Build\Bin\${{ matrix.build_configuration}}\${{ matrix.build_platform}}\NPPJSONViewer.pdb | |
| # Step 6: Run unit tests for x86 | Release | |
| - name: Run unit tests x86 | Release | |
| if: matrix.build_platform == 'Win32' && matrix.build_configuration == 'Release' | |
| run: | | |
| cd src\Build\Bin\Release\Win32 | |
| ./UnitTest.exe | |
| # Step 7: Run unit tests for x64 | Release | |
| - name: Run unit tests x64 | Release | |
| if: matrix.build_platform == 'x64' && matrix.build_configuration == 'Release' | |
| run: | | |
| cd src\Build\Bin\Release\x64 | |
| ./UnitTest.exe | |
| upload-full-artifacts: | |
| # Trigger this job only after all 'build' jobs are complete | |
| needs: build | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| # Step 8: Download all artifacts from all build jobs | |
| - name: Download Release Win32 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_Win32_Release | |
| path: all_artifacts/Release/win32 | |
| - name: Download Release Win32 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_Win32_Release_pdb | |
| path: all_artifacts/Release/win32 | |
| - name: Download Release x64 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_x64_Release | |
| path: all_artifacts/Release/x64 | |
| - name: Download Release x64 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_x64_Release_pdb | |
| path: all_artifacts/Release/x64 | |
| - name: Download Release ARM64 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_ARM64_Release | |
| path: all_artifacts/Release/ARM64 | |
| - name: Download Release ARM64 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_ARM64_Release_pdb | |
| path: all_artifacts/Release/ARM64 | |
| - name: Download Debug Win32 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_Win32_Debug | |
| path: all_artifacts/Debug/win32 | |
| - name: Download Debug Win32 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_Win32_Debug_pdb | |
| path: all_artifacts/Debug/win32 | |
| - name: Download Debug x64 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_x64_Debug | |
| path: all_artifacts/Debug/x64 | |
| - name: Download Debug x64 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_x64_Debug_pdb | |
| path: all_artifacts/Debug/x64 | |
| - name: Download Debug ARM64 DLL | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_ARM64_Debug | |
| path: all_artifacts/Debug/ARM64 | |
| - name: Download Debug ARM64 PDB | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: NppJSONViewer_ARM64_Debug_pdb | |
| path: all_artifacts/Debug/ARM64 | |
| # Step 9: Archive the consolidated artifacts as a single artifact or zip file | |
| - name: Zip all artifacts | |
| run: | | |
| # Zip the contents directly without including the parent folder | |
| powershell Compress-Archive -Path all_artifacts\* -DestinationPath NppJSONViewer_full.zip | |
| - name: Upload full artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NppJSONViewer_full | |
| path: NppJSONViewer_full.zip |