Skip to content

Tests: disable advice message #446

Tests: disable advice message

Tests: disable advice message #446

name: Scalar
on:
push:
branches: [ main, releases/* ]
pull_request:
branches: [ main, releases/* ]
env:
SCALAR_TEST_SKIP_VSTS_INFO: true
jobs:
validate_scalar:
name: "CI"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, windows-2019, macos-10.15]
features: [ignored]
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.features }}" >>$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.features }}" >>$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.features }}" >>$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,scalar" /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: Configure feature.scalar
run: git config --global feature.scalar ${{ matrix.features }}
- 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
Scalar.FunctionalTests/$BUILD_FRAGMENT/Scalar.FunctionalTests$BUILD_FILE_EXT --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