forked from microsoft/scalar
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (145 loc) · 6.63 KB
/
continuous-integration.yml
File metadata and controls
168 lines (145 loc) · 6.63 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Scalar
on:
push:
branches: [ main, releases/* ]
pull_request:
branches: [ main, releases/* ]
jobs:
validate_scalar:
name: "CI"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, windows-2019, macos-10.15]
watchman: [false, true]
env:
BUILD_FRAGMENT: bin/Release/netcoreapp3.1
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Indicate full history so Nerdbank.GitVersioning works.
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.302
- name: Install dependencies
run: dotnet restore
env:
DOTNET_NOLOGO: 1
- name: Build
run: dotnet build --configuration Release --no-restore -p:UseAppHost=true # Force generation of executable on macOS.
- name: Unit test
run: dotnet test --no-restore
- name: Setup platform (Linux)
if: runner.os == 'Linux'
run: |
echo "BUILD_PLATFORM=${{ runner.os }}" >>$GITHUB_ENV
echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.watchman }}" >>$GITHUB_ENV
- name: Setup platform (Mac)
if: runner.os == 'macOS'
run: |
echo 'BUILD_PLATFORM=Mac' >>$GITHUB_ENV
echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.watchman }}" >>$GITHUB_ENV
- name: Setup platform (Windows)
if: runner.os == 'Windows'
run: |
echo "BUILD_PLATFORM=${{ runner.os }}" >>$env:GITHUB_ENV
echo 'BUILD_FILE_EXT=.exe' >>$env:GITHUB_ENV
echo "TRACE2_BASENAME=Trace2.${{ github.run_id }}__${{ github.run_number }}__${{ matrix.os }}__${{ matrix.watchman }}" >>$env:GITHUB_ENV
- name: Setup Git installer
shell: bash
run: |
GIT_VERSION=$(grep '<GitPackageVersion>' Directory.Build.props | grep -Eo '[0-9.]+(-\w+)*')
cd ../out
dotnet new classlib -n Scalar.GitInstaller
cd Scalar.GitInstaller
cp ../../scalar/nuget.config .
dotnet add Scalar.GitInstaller.csproj package "GitFor${BUILD_PLATFORM}.GVFS.Installer" --package-directory . --version "$GIT_VERSION" --source "https://pkgs.dev.azure.com/gvfs/ci/_packaging/Dependencies/nuget/v3/index.json"
- name: Install Git (Linux)
if: runner.os == 'Linux'
run: |
cd ../out/Scalar.GitInstaller
sudo apt-get install -y $(find . -type f -name '*.deb')
- name: Install Git (Mac)
if: runner.os == 'macOS'
run: |
cd ../out/Scalar.GitInstaller
sudo /usr/sbin/installer -pkg $(find . -type f -name '*.pkg') -target /
- name: Install Git (Windows)
if: runner.os == 'Windows'
run: |
Set-Location -Path ..\out\Scalar.GitInstaller
Write-Host 'Uninstalling Git ...'
foreach ($file in Get-ChildItem 'C:\Program Files\Git' -Recurse -File -Include 'unins*.exe') {
& $file.Fullname /VERYSILENT /SUPPRESSMSGBOXES /NORESTART
Wait-Process -Name $file.Basename
}
Remove-Item 'C:\Program Files\Git' -Recurse -Force
Write-Host 'Installing GitForWindows ...'
$files = Get-ChildItem . -Recurse -File -Include 'Git-*.vfs.*.exe'
& $files[0].Fullname /DIR="C:\Program Files\Git" /NOICONS /COMPONENTS="ext,ext\shellhere,ext\guihere,assoc,assoc_sh" /GROUP="Git" /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLOWDOWNGRADE=1 /LOG=install.log
Wait-Process $files[0].Basename
Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\GitForWindows'
- name: Install Watchman (Linux)
if: runner.os == 'Linux' && matrix.watchman
run: |
cd ..
git clone https://github.com/facebook/watchman.git -b v4.9.0 --depth 1
cd watchman
./autogen.sh
GCC_VERSION=$(gcc -dumpversion | cut -d. -f1)
if [ "$GCC_VERSION" -ge 7 ]; then CPPFLAGS="-Wno-error=format-truncation"; fi
if [ "$GCC_VERSION" -ge 8 ]; then CPPFLAGS="$CPPFLAGS -Wno-error=class-memaccess"; fi
export CPPFLAGS
./configure --without-python
make
sudo make install
- name: Install Watchman (Mac)
if: runner.os == 'macOS' && matrix.watchman
run: brew install watchman
- name: Install Watchman (Windows)
if: runner.os == 'Windows' && matrix.watchman
run: |
Write-Host 'Downloading Watchman ...'
$Uri = (Select-Xml -Path Directory.Build.props -XPath /Project/PropertyGroup/WatchmanPackageUrl).Node.'#text'
Set-Location -Path ..
Invoke-WebRequest -Uri $Uri -OutFile watchman.zip
Expand-Archive watchman.zip
Write-Host 'Installing Watchman ...'
New-Item -Path 'C:\Program Files' -Name Watchman -ItemType Directory | Out-Null
Copy-Item -Path 'watchman\watchman-*-windows\bin\*' -Destination 'C:\Program Files\Watchman'
$ENV:PATH="$ENV:PATH;C:\Program Files\Watchman"
& watchman --version
echo "PATH=$ENV:PATH" >>$env:GITHUB_ENV
- id: functional_test
name: Functional test
shell: bash
run: |
export GIT_TRACE2_EVENT="$PWD/$TRACE2_BASENAME/Event"
export GIT_TRACE2_PERF="$PWD/$TRACE2_BASENAME/Perf"
export GIT_TRACE2_EVENT_BRIEF=true
export GIT_TRACE2_PERF_BRIEF=true
mkdir -p "$TRACE2_BASENAME"
mkdir -p "$TRACE2_BASENAME/Event"
mkdir -p "$TRACE2_BASENAME/Perf"
git version --build-options
cd ../out
PATH="$PWD/Scalar/$BUILD_FRAGMENT:$PWD/Scalar.Service/$BUILD_FRAGMENT:$PATH"
Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --test-scalar-on-path --full-suite
- id: trace2_zip_unix
if: runner.os != 'Windows' && ( success() || failure() ) && ( steps.functional_test.conclusion == 'success' || steps.functional_test.conclusion == 'failure' )
name: Zip Trace2 Logs (Unix)
shell: bash
run: zip -q -r $TRACE2_BASENAME.zip $TRACE2_BASENAME/
- id: trace2_zip_windows
if: runner.os == 'Windows' && ( success() || failure() ) && ( steps.functional_test.conclusion == 'success' || steps.functional_test.conclusion == 'failure' )
name: Zip Trace2 Logs (Windows)
run: Compress-Archive -DestinationPath ${{ env.TRACE2_BASENAME }}.zip -Path ${{ env.TRACE2_BASENAME }}
- name: Archive Trace2 Logs
if: ( success() || failure() ) && ( steps.trace2_zip_unix.conclusion == 'success' || steps.trace2_zip_windows.conclusion == 'success' )
uses: actions/upload-artifact@v2
with:
name: ${{ env.TRACE2_BASENAME }}.zip
path: ${{ env.TRACE2_BASENAME }}.zip
retention-days: 3