-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (117 loc) · 3.93 KB
/
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
name: Build MSVC project
on: [ push, pull_request ] # yamllint disable-line rule:truthy
jobs:
check-formatting:
name: Check Code Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check Markdown syntax (docker)
shell: sh
run: make -- check-md
- name: Check YAML syntax (docker)
shell: sh
run: make -- check-yaml
build:
name: Visual Studio 2019
runs-on: windows-2019
env:
ARTIFACT_NAME: logreader-${{ matrix.config.config }}-${{ matrix.config.platform }}.7z
strategy:
fail-fast: false
matrix:
config:
- config: Release
platform: x64
output_dir: Release-x64
- config: Release
platform: x86
output_dir: Release-Win32
- config: Debug
platform: x64
output_dir: Debug-x64
- config: Debug
platform: x86
output_dir: Debug-Win32
steps:
- uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: ${{ matrix.config.platform }}
- name: Build MSVC project - ${{ matrix.config.config }} - ${{ matrix.config.platform }}
env:
CONFIG: ${{ matrix.config.config }}
PLATFORM: ${{ matrix.config.platform }}
shell: sh
run: |
MSBuild.exe ./LogReader.sln "/property:Configuration=$CONFIG" "/property:Platform=$PLATFORM"
- name: Run Unit Tests - ${{ matrix.config.config }} - ${{ matrix.config.platform }}
shell: sh
run: ./${{ matrix.config.output_dir }}/tests.exe
- name: Copy Executable
shell: sh
run: |
mkdir -p -- "$RUNNER_TEMP/instdir"
cp -- ./${{ matrix.config.output_dir }}/LogReader.exe "$RUNNER_TEMP/instdir"
- name: Pack Build Artifact
working-directory: ${{ runner.temp }}/instdir
shell: sh
run: cmake -E tar vcf "$RUNNER_TEMP/$ARTIFACT_NAME" --format=7zip -- .
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
name: ${{ env.ARTIFACT_NAME }}
create-release:
name: Create Release for ${{ github.ref }}
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs:
- build
- check-formatting
permissions:
contents: write
env:
ARTIFACT_NAME1: logreader-Release-x86.7z
ARTIFACT_NAME2: logreader-Release-x64.7z
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Download Artifact x86
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME1 }}
path: ./
- name: Download Artifact x64
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME2 }}
path: ./
- name: Upload Artifact x86 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.ARTIFACT_NAME1 }}
asset_name: ${{ env.ARTIFACT_NAME1 }}
asset_content_type: application/x-7z-compressed
- name: Upload Artifact x64 to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.ARTIFACT_NAME2 }}
asset_name: ${{ env.ARTIFACT_NAME2 }}
asset_content_type: application/x-7z-compressed