-
Notifications
You must be signed in to change notification settings - Fork 150
80 lines (68 loc) · 2.54 KB
/
ci_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build and Test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
BUILD_DIR: src\Build\Bin
MSBUILD_TOOLSET: v143
ARTIFACT_PREFIX: NppJSONViewer_
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: Setup MSBuild
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=${{env.MSBUILD_TOOLSET}}
# Step 4: Upload build binary artifacts for deployment
- name: Archive binaries artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_PREFIX}}${{matrix.build_platform}}_${{matrix.build_configuration}}
path: ${{env.BUILD_DIR }}\${{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: ${{env.ARTIFACT_PREFIX}}${{matrix.build_platform}}_${{matrix.build_configuration}}_pdb
path: ${{env.BUILD_DIR }}\${{matrix.build_configuration}}\${{matrix.build_platform}}\NPPJSONViewer.pdb
# Step 6: Run unit tests for x86 and x64
- name: Run unit tests
if: matrix.build_platform == 'Win32' || matrix.build_platform == 'x64'
run: |
cd ${{env.BUILD_DIR}}\${{matrix.build_configuration}}\${{matrix.build_platform}}
./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:
# Step 7: Download all artifacts from the build job
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{env.ARTIFACT_PREFIX}}*
path: all_artifacts\
# Step 8: Upload consolidated artifacts as a single artifact
- name: Upload full artifact
uses: actions/upload-artifact@v4
with:
name: ${{env.ARTIFACT_PREFIX}}ALL
path: all_artifacts\**