-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
142 lines (122 loc) · 4.19 KB
/
build-app.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
137
138
139
140
141
142
# Copyright (c) 2023 Files Community
# Licensed under the MIT License. See the LICENSE.
# Abstract:
# This CI is triggered when a commit was added in the main branch directly or
# a commit was added in a PR whose base branch is the main branch within this repository.
name: Build & test Files
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
env:
APPLICATION_NAME: 'Files'
SOLUTION_NAME: 'Files.sln'
PRIMARY_ARCHITECTURE: 'x64'
SOLUTION_PATH: '${{ github.workspace }}\Files.sln'
PACKAGE_PROJECT_DIR: '${{ github.workspace }}\src\Files.App (Package)'
PACKAGE_PROJECT_PATH: '${{ github.workspace }}\src\Files.App (Package)\Files.Package.wapproj'
INTERACTION_TESTS_PROJECT_PATH: '${{ github.workspace }}\tests\Files.InteractionTests\Files.InteractionTests.csproj'
WORKING_DIR: ${{ github.workspace }} # Default: 'D:\a\Files\Files'
ARTIFACTS_STAGING_DIR: ${{ github.workspace }}\artifacts
APPX_PACKAGE_DIR: ${{ github.workspace }}\artifacts\AppxPackages
APPX_SELFSIGNED_CERT_PATH: '${{ github.workspace }}\builds\Files_SelfSigned.pfx'
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [Debug]
platform: [x64, arm64]
env:
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: ${{ matrix.platform }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Restore NuGet
shell: pwsh
run: 'nuget restore $env:SOLUTION_PATH'
- name: Restore Files
shell: pwsh
run: |
msbuild $env:SOLUTION_PATH `
-t:Restore `
-p:Platform=$env:ARCHITECTURE `
-p:Configuration=$env:CONFIGURATION `
-p:PublishReadyToRun=true
- if: env.ARCHITECTURE != env.PRIMARY_ARCHITECTURE
name: Build Files
run: |
msbuild $env:PACKAGE_PROJECT_PATH `
-t:Build `
-p:Configuration=$env:CONFIGURATION `
-p:Platform=$env:ARCHITECTURE `
-p:AppxBundle=Never
- if: env.ARCHITECTURE == env.PRIMARY_ARCHITECTURE
name: Build & Publish Files
run: |
msbuild $env:PACKAGE_PROJECT_PATH `
-t:Build `
-t:_GenerateAppxPackage `
-p:Configuration=$env:CONFIGURATION `
-p:Platform=$env:ARCHITECTURE `
-p:AppxBundlePlatforms=$env:PRIMARY_ARCHITECTURE `
-p:AppxBundle=Always `
-p:UapAppxPackageBuildMode=SideloadOnly `
-p:AppxPackageDir=$env:APPX_PACKAGE_DIR `
-p:AppxPackageSigningEnabled=true `
-p:PackageCertificateKeyFile=$env:APPX_SELFSIGNED_CERT_PATH `
-p:PackageCertificatePassword="" `
-p:PackageCertificateThumbprint=""
- if: env.ARCHITECTURE == env.PRIMARY_ARCHITECTURE
name: Upload the packages to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PRIMARY_ARCHITECTURE }})'
path: ${{ env.ARTIFACTS_STAGING_DIR }}
test:
needs: [build]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
configuration: [Debug]
platform: [x64]
env:
CONFIGURATION: ${{ matrix.configuration }}
steps:
- uses: actions/download-artifact@v3
with:
name: 'Appx Packages (${{ env.CONFIGURATION }}, ${{ env.PRIMARY_ARCHITECTURE }})'
path: ${{ env.ARTIFACTS_STAGING_DIR }}
- name: Install package
shell: powershell
run: |
Set-Location "$env:APPX_PACKAGE_DIR"
$AppxPackageBundleDir = Get-ChildItem -Filter Files.Package_*_Test -Name
Set-Location $AppxPackageBundleDir
./Install.ps1 -Force
Get-AppxPackage
- name: Set full HD resolution
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Run UI tests
run: |
dotnet test "$env:INTERACTION_TESTS_PROJECT_PATH" `
-a $env:PRIMARY_ARCHITECTURE `
-c $env:CONFIGURATION