diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml deleted file mode 100644 index 9f65eb01..00000000 --- a/.azure-pipelines/build-template.yml +++ /dev/null @@ -1,84 +0,0 @@ -parameters: - agentOS: 'Windows' - phaseName: '' - queueName: '' - buildArgs: '' - beforeBuild: [] - afterBuild: [] - variables: {} - dependsOn: '' - -phases: - - phase: ${{ coalesce(parameters.phaseName, parameters.agentOS) }} - dependsOn: ${{ parameters.dependsOn }} - displayName: ${{ coalesce(parameters.phaseName, parameters.agentOS) }} - queue: - ${{ if ne(parameters.queueName, '') }}: - name: ${{ parameters.queueName }} - ${{ if and(eq(parameters.queueName, ''), eq(parameters.agentOS, 'Linux')) }}: - name: Hosted Ubuntu 1604 - ${{ if and(eq(parameters.queueName, ''), eq(parameters.agentOS, 'macOS')) }}: - name: Hosted macOS - ${{ if and(eq(parameters.queueName, ''), eq(parameters.agentOS, 'Windows')) }}: - name: Hosted Windows 2019 with VS2019 - variables: - AgentOSName: ${{ parameters.agentOS }} - BuildArgs: ${{ parameters.buildArgs }} - ${{ insert }}: ${{ parameters.variables }} - steps: - - ${{ parameters.beforeBuild }} - - ${{ if eq(parameters.agentOS, 'Linux') }}: - - script: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends gettext libcurl4-openssl-dev libicu-dev libssl-dev libunwind8 - name: InstallDotNetCoreDeps - displayName: Install .NET Core pre-requisites - - ${{ if eq(parameters.agentOS, 'Windows') }}: - - powershell: | - choco install sqllocaldb - name: InstallSQLServerLocalDB - displayName: Install SQL Server LocalDB - - ${{ if eq(parameters.agentOS, 'Windows') }}: - - powershell: | - .\Build.ps1 -OutputPath $(Build.StagingDirectory) $(BuildArgs) - name: BuildAndTest - displayName: Build and test - env: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_XMLDOC_MODE: skip - - ${{ if ne(parameters.agentOS, 'Windows') }}: - - script: | - ./build.sh --output $(Build.StagingDirectory) $(BuildArgs) - name: BuildAndTest - displayName: Build and test - env: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_XMLDOC_MODE: skip - - task: PublishTestResults@2 - name: PublishTests - displayName: Publish test results - condition: always() - inputs: - failTaskOnFailedTests: true - testRunner: VSTest - testRunTitle: Unit and integration tests ($(AgentOSName)) - testResultsFiles: $(Build.SourcesDirectory)/**/*.trx - - task: PublishCodeCoverageResults@1 - name: PublishCodeCoverage - displayName: Publish code coverage - condition: always() - inputs: - codeCoverageTool: cobertura - reportDirectory: $(Build.StagingDirectory)/**/coverage - summaryFileLocation: $(Build.StagingDirectory)/coverage.netcoreapp3.1.cobertura.xml - - task: PublishBuildArtifacts@1 - displayName: Publish build artifacts - condition: eq(variables['System.PullRequest.IsFork'], false) - inputs: - PathToPublish: '$(Build.StagingDirectory)' - ArtifactType: Container - ${{ if eq(parameters.artifacts.name, '') }}: - ArtifactName: BuildDrop-$(AgentOSName) - ${{ if ne(parameters.artifacts.name, '') }}: - ArtifactName: ${{ parameters.artifacts.name }} - - ${{ parameters.afterBuild }} diff --git a/.azure-pipelines/build.yml b/.azure-pipelines/build.yml deleted file mode 100644 index bee0fceb..00000000 --- a/.azure-pipelines/build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: CI_$(Date:yyyyMMdd)$(Rev:.r) - -trigger: - batch: true - branches: - include: - - master - tags: - include: - - v* - -phases: -- template: build-template.yml - parameters: - agentOS: Linux -- template: build-template.yml - parameters: - agentOS: macOS -- template: build-template.yml - parameters: - agentOS: Windows diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index da8449c6..be68e95d 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,7 +4,7 @@ To contribute changes (source code, scripts, configuration) to this repository p 1. Fork the `master` branch of this repository from the latest commit. 1. Create a branch from your fork's `master` branch to help isolate your changes from any further work on `master`. If fixing an issue try to reference its name in your branch name (e.g. `issue-123`) to make changes easier to track the changes. 1. Work on your proposed changes on your fork. If you are fixing an issue include at least one unit test that reproduces it if the code changes to fix it have not been applied; if you are adding new functionality please include unit tests appropriate to the changes you are making. The [code coverage figure](https://codecov.io/gh/martincostello/sqllocaldb) should be maintained where possible. - 1. When you think your changes are complete, test that the code builds cleanly using `Build.ps1`/`build.sh`. There should be no compiler warnings and all tests should pass. + 1. When you think your changes are complete, test that the code builds cleanly using `build.ps1`. There should be no compiler warnings and all tests should pass. 1. Once your changes build cleanly locally submit a Pull Request back to the `master` branch from your fork's branch. Ideally commits to your branch should be squashed before creating the Pull Request. If the Pull Request fixes an issue please reference it in the title and/or description. Please keep changes focused around a specific topic rather than include multiple types of changes in a single Pull Request. 1. After your Pull Request is created it will build against the repository's continuous integrations. 1. Once the Pull Request has been reviewed by the project's [contributors](https://github.com/martincostello/sqllocaldb/graphs/contributors) and the status checks pass your Pull Request will be merged back to the `master` branch, assuming that the changes are deemed appropriate. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..1dc3eae2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: build + +on: + push: + branches: [ master ] + tags: [ v* ] + pull_request: + branches: [ master ] + +jobs: + build: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ macos-latest, ubuntu-latest, windows-latest ] + include: + - os: macos-latest + os_name: macos + - os: ubuntu-latest + os_name: linux + - os: windows-latest + os_name: windows + + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.201 + + - name: Build, Test and Package + shell: pwsh + run: ./build.ps1 + env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + NUGET_XMLDOC_MODE: skip + + - uses: codecov/codecov-action@v1 + name: Upload coverage to Codecov + with: + file: ./artifacts/coverage.netcoreapp3.1.cobertura.xml + flags: ${{ matrix.os_name }} + + - name: Publish artifacts + uses: actions/upload-artifact@v1 + with: + name: artifacts-${{ matrix.os_name }} + path: ./artifacts + +# TODO Publish NuGet package to feed diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 07b54407..00000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -dist: bionic -language: csharp -mono: none - -os: - - linux - - osx - -env: - global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true - - NUGET_XMLDOC_MODE=skip - -branches: - only: - - master - -cache: - directories: - - /home/travis/.nuget/packages - -addons: - apt: - packages: - - gettext - - libcurl4-openssl-dev - - libicu-dev - - libssl-dev - - libunwind8 - -script: - - ./build.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) -f "./artifacts/coverage.netcoreapp3.1.cobertura.xml" -F $TRAVIS_OS_NAME || echo "Codecov did not collect coverage reports" diff --git a/Directory.Build.props b/Directory.Build.props index 60074845..cc49903a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,10 +19,13 @@ martin_costello $(MSBuildThisFileDirectory)SqlLocalDb.ruleset https://github.com/martincostello/sqllocaldb + true Martin Costello (c) 2012-$([System.DateTime]::Now.ToString(yyyy)) + + false true false - true + true latest en-US $(NoWarn);CA1054;CA2234 @@ -41,10 +44,10 @@ snupkg true 3.0.1 - beta$([System.Convert]::ToInt32(`$(APPVEYOR_BUILD_NUMBER)`).ToString(`0000`)) - beta$([System.Convert]::ToInt32(`$(BUILD_BUILDID)`).ToString(`0000`)) - beta$([System.Convert]::ToInt32(`$(TRAVIS_BUILD_NUMBER)`).ToString(`0000`)) - $(APPVEYOR_REPO_TAG_NAME.Substring($(APPVEYOR_REPO_TAG_NAME.IndexOf(`-`))).Substring(1)) + beta$([System.Convert]::ToInt32(`$(GITHUB_RUN_NUMBER)`).ToString(`0000`)) + $(GITHUB_REF.Replace('refs/tags/v', '')) + + $(VersionPrefix).$(GITHUB_RUN_NUMBER) true diff --git a/Directory.Build.targets b/Directory.Build.targets index 456ac77f..90d9b73e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,11 +1,7 @@ - $(APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH) - $(APPVEYOR_REPO_BRANCH) - $(BUILD_SOURCEBRANCHNAME) - $(TRAVIS_PULL_REQUEST_BRANCH) - $(TRAVIS_BRANCH) - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + $(GITHUB_REF.Substring(11)) + $(GITHUB_SHA) + + + $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) + + + + diff --git a/SqlLocalDb.sln b/SqlLocalDb.sln index 0d96071d..fad73be8 100644 --- a/SqlLocalDb.sln +++ b/SqlLocalDb.sln @@ -8,10 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitattributes = .gitattributes .gitignore = .gitignore - .travis.yml = .travis.yml - appveyor.yml = appveyor.yml - Build.ps1 = Build.ps1 - build.sh = build.sh + build.ps1 = build.ps1 CHANGELOG = CHANGELOG CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md CommonAssemblyInfo.cs = CommonAssemblyInfo.cs @@ -59,10 +56,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApp", "samples\TodoApp\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApp.Tests", "samples\TodoApp.Tests\TodoApp.Tests.csproj", "{5B2AD682-C000-45D0-AECE-8DADED1616B7}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".azure-pipelines", ".azure-pipelines", "{CB75AAE3-CB43-44D7-A0C1-0FD8D21CD968}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B3D6F0CC-F49F-424E-B853-FFB0626A38D0}" ProjectSection(SolutionItems) = preProject - .azure-pipelines\build-template.yml = .azure-pipelines\build-template.yml - .azure-pipelines\build.yml = .azure-pipelines\build.yml + .github\workflows\build.yml = .github\workflows\build.yml EndProjectSection EndProject Global @@ -103,7 +99,7 @@ Global {701E574A-6366-4AF9-9319-237968FA1089} = {E207A447-68A1-4D72-B24F-89FB7890AE12} {1B720E31-3AA8-4010-A3DB-187B2D0BC471} = {825D6F08-8321-4C6E-92A9-92543FDAF965} {5B2AD682-C000-45D0-AECE-8DADED1616B7} = {825D6F08-8321-4C6E-92A9-92543FDAF965} - {CB75AAE3-CB43-44D7-A0C1-0FD8D21CD968} = {E207A447-68A1-4D72-B24F-89FB7890AE12} + {B3D6F0CC-F49F-424E-B853-FFB0626A38D0} = {D0426D09-1FF8-4E1F-A9AF-38DDEE5D7CCA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3B9E157C-5E92-4357-B233-281B4530EABD} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e30cebf3..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,40 +0,0 @@ -os: Visual Studio 2019 -version: 3.0.1.{build} - -environment: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_XMLDOC_MODE: skip - -branches: - only: - - master - -build_script: - - ps: .\Build.ps1 - -after_build: - - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%" - - pip install codecov - - codecov -f "artifacts\coverage.netcoreapp3.1.cobertura.xml" -F windows - -artifacts: - - path: artifacts\*.nupkg - - path: artifacts\*.snupkg - - path: artifacts\MartinCostello.SqlLocalDb.TestApp.* - - path: artifacts\coverage*.xml - -nuget: - disable_publish_on_pr: true - -skip_tags: false -test: off - -deploy: - - - provider: NuGet - api_key: - secure: jt9LbilCxwYKHpi85v3TWxkFxHVwLRgtPlwceTK2EWI/Z2dawe4+aPb6wAS1LGtZ - artifact: /.*\.*nupkg/ - skip_symbols: false - on: - appveyor_repo_tag: true diff --git a/Build.ps1 b/build.ps1 old mode 100644 new mode 100755 similarity index 76% rename from Build.ps1 rename to build.ps1 index fed3b92d..fb44ed1f --- a/Build.ps1 +++ b/build.ps1 @@ -1,3 +1,4 @@ +#! /usr/bin/pwsh param( [Parameter(Mandatory = $false)][string] $Configuration = "Release", [Parameter(Mandatory = $false)][string] $VersionSuffix = "", @@ -26,7 +27,7 @@ if ($OutputPath -eq "") { $installDotNetSdk = $false; -if (($null -eq (Get-Command "dotnet.exe" -ErrorAction SilentlyContinue)) -and ($null -eq (Get-Command "dotnet" -ErrorAction SilentlyContinue))) { +if (($null -eq (Get-Command "dotnet" -ErrorAction SilentlyContinue)) -and ($null -eq (Get-Command "dotnet.exe" -ErrorAction SilentlyContinue))) { Write-Host "The .NET Core SDK is not installed." $installDotNetSdk = $true } @@ -52,17 +53,25 @@ if ($installDotNetSdk -eq $true) { if (!(Test-Path $env:DOTNET_INSTALL_DIR)) { mkdir $env:DOTNET_INSTALL_DIR | Out-Null } - $installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.ps1" [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" - Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript -UseBasicParsing - & $installScript -Version "$dotnetVersion" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath + if (($PSVersionTable.PSVersion.Major -ge 6) -And !$IsWindows) { + $installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.sh" + Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile $installScript -UseBasicParsing + chmod +x $installScript + & $installScript --version "$dotnetVersion" --install-dir "$env:DOTNET_INSTALL_DIR" --no-path + } + else { + $installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.ps1" + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript -UseBasicParsing + & $installScript -Version "$dotnetVersion" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath + } } $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" - $dotnet = Join-Path "$env:DOTNET_INSTALL_DIR" "dotnet.exe" + $dotnet = Join-Path "$env:DOTNET_INSTALL_DIR" "dotnet" } else { - $dotnet = "dotnet.exe" + $dotnet = "dotnet" } function DotNetBuild { @@ -96,20 +105,15 @@ function DotNetPack { function DotNetTest { param([string]$Project) - $nugetPath = Join-Path $env:USERPROFILE ".nuget\packages" + $nugetPath = Join-Path ($env:USERPROFILE ?? "~") ".nuget\packages" $propsFile = Join-Path $solutionPath "Directory.Build.props" $reportGeneratorVersion = (Select-Xml -Path $propsFile -XPath "//PackageReference[@Include='ReportGenerator']/@Version").Node.'#text' - $reportGeneratorPath = Join-Path $nugetPath "ReportGenerator\$reportGeneratorVersion\tools\netcoreapp2.0\ReportGenerator.dll" + $reportGeneratorPath = Join-Path $nugetPath "reportgenerator\$reportGeneratorVersion\tools\netcoreapp3.0\ReportGenerator.dll" $coverageOutput = Join-Path $OutputPath "coverage.*.cobertura.xml" $reportOutput = Join-Path $OutputPath "coverage" - if ($null -ne $env:TF_BUILD) { - & $dotnet test $Project --output $OutputPath --logger trx - } - else { - & $dotnet test $Project --output $OutputPath - } + & $dotnet test $Project --output $OutputPath $dotNetTestExitCode = $LASTEXITCODE diff --git a/build.sh b/build.sh deleted file mode 100755 index c2e65df7..00000000 --- a/build.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -root=$(cd "$(dirname "$0")"; pwd -P) -artifacts=$root/artifacts -configuration=Release -skipTests=0 - -while :; do - if [ $# -le 0 ]; then - break - fi - - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - -\?|-h|--help) - echo "./build.sh [--skip-tests] [--output ]" - exit 1 - ;; - - --output) - artifacts="$2" - shift - ;; - - --skip-tests) - skipTests=1 - ;; - - *) - __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" - ;; - esac - - shift -done - -export CLI_VERSION=`cat ./global.json | grep -E '[0-9]\.[0-9]\.[a-zA-Z0-9\-]*' -o` -export DOTNET_INSTALL_DIR="$root/.dotnetcli" -export PATH="$DOTNET_INSTALL_DIR:$PATH" - -dotnet_version=$(dotnet --version) - -if [ "$dotnet_version" != "$CLI_VERSION" ]; then - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR" -fi - -dotnet build ./SqlLocalDb.sln --output $artifacts --configuration $configuration || exit 1 -dotnet pack ./src/SqlLocalDb/MartinCostello.SqlLocalDb.csproj --output $artifacts --configuration $configuration || exit 1 - -if [ $skipTests == 0 ]; then - if [ "$TF_BUILD" != "" ]; then - dotnet test ./tests/SqlLocalDb.Tests/MartinCostello.SqlLocalDb.Tests.csproj --output $artifacts --configuration $configuration --logger trx || exit 1 - else - dotnet test ./tests/SqlLocalDb.Tests/MartinCostello.SqlLocalDb.Tests.csproj --output $artifacts --configuration $configuration '--logger:Console;noprogress=true' || exit 1 - fi -fi diff --git a/readme.md b/readme.md index 2c7d3c20..416281b5 100644 --- a/readme.md +++ b/readme.md @@ -4,10 +4,7 @@ SQL LocalDB Wrapper is a .NET Standard 2.0 library providing interop with the [M [![NuGet](https://buildstats.info/nuget/MartinCostello.SqlLocalDb?includePreReleases=true)](http://www.nuget.org/packages/MartinCostello.SqlLocalDb "Download MartinCostello.SqlLocalDb from NuGet") -| | Windows | Linux/macOS | Linux/macOS/Windows | -|:-:|:-:|:-:|:-:| -| **Build Status** | [![Windows build status](https://img.shields.io/appveyor/ci/martincostello/sqllocaldb/master.svg)](https://ci.appveyor.com/project/martincostello/sqllocaldb) [![Code coverage](https://codecov.io/gh/martincostello/sqllocaldb/branch/master/graph/badge.svg)](https://codecov.io/gh/martincostello/sqllocaldb) | [![Linux build status](https://img.shields.io/travis/com/martincostello/sqllocaldb/master.svg)](https://travis-ci.com/martincostello/sqllocaldb) | [![Azure Pipelines build status](https://dev.azure.com/martincostello/sqllocaldb/_apis/build/status/CI)](https://dev.azure.com/martincostello/sqllocaldb/_build/latest?definitionId=66) | -| **Build History** | [![Windows build history](https://buildstats.info/appveyor/chart/martincostello/sqllocaldb?branch=master&includeBuildsFromPullRequest=false)](https://ci.appveyor.com/project/martincostello/sqllocaldb) | [![Linux build history](https://buildstats.info/travisci/chart/martincostello/sqllocaldb?branch=master&includeBuildsFromPullRequest=false)](https://travis-ci.com/martincostello/sqllocaldb) | [![Build history](https://buildstats.info/azurepipelines/chart/martincostello/sqllocaldb/66?branch=master&includeBuildsFromPullRequest=false)](https://dev.azure.com/martincostello/sqllocaldb/_build?definitionId=66) | +[![Build status](https://github.com/martincostello/sqllocaldb/workflows/build/badge.svg?branch=master&event=push)](https://github.com/martincostello/sqllocaldb/actions?query=workflow%3Abuild+branch%3Amaster+event%3Apush) ## Introduction @@ -87,30 +84,22 @@ Compiling the library yourself requires Git and the [.NET Core SDK](https://www. For all of the tests to be functional you must also have at least one version of SQL LocalDB installed. -To build and test the library locally from a terminal/command-line, run one of the following set of commands: +To build and test the library locally from a terminal/command-line, run the following set of commands: **Windows** ```powershell git clone https://github.com/martincostello/sqllocaldb.git cd sqllocaldb -.\Build.ps1 +./build.ps1 ``` -**Note**: To run all the tests successfully, you must run either `Build.ps1` or Visual Studio with administrative privileges. This is because the SQL LocalDB APIs for sharing LocalDB instances can only be used with administrative privileges. Not running the tests with administrative privileges will cause all tests that exercise such functionality to be skipped. +**Note**: To run all the tests successfully, you must run either `build.ps1` or Visual Studio with administrative privileges. This is because the SQL LocalDB APIs for sharing LocalDB instances can only be used with administrative privileges. Not running the tests with administrative privileges will cause all tests that exercise such functionality to be skipped. -**Linux/macOS** - -```sh -git clone https://github.com/martincostello/sqllocaldb.git -cd sqllocaldb -./build.sh -``` - -**Note**: Several tests are skipped on non-Windows Operating Systems. +**Note**: Several tests are skipped on non-Windows Operating Systems as SQL LocalDB itself is only supported on Windows. ## Copyright and Trademarks -This library is copyright (©) Martin Costello 2012-2018. +This library is copyright (©) Martin Costello 2012-2020. [Microsoft SQL Server](https://www.microsoft.com/en-gb/sql-server/) is a trademark and copyright of the Microsoft Corporation. diff --git a/samples/TodoApp.Tests/TodoApp.Tests.csproj b/samples/TodoApp.Tests/TodoApp.Tests.csproj index d002b08b..ed923245 100644 --- a/samples/TodoApp.Tests/TodoApp.Tests.csproj +++ b/samples/TodoApp.Tests/TodoApp.Tests.csproj @@ -13,6 +13,7 @@ + diff --git a/samples/TodoApp.Tests/TodoRepositoryTests.cs b/samples/TodoApp.Tests/TodoRepositoryTests.cs index e59acff5..e9205157 100644 --- a/samples/TodoApp.Tests/TodoRepositoryTests.cs +++ b/samples/TodoApp.Tests/TodoRepositoryTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using System.Threading.Tasks; using MartinCostello.SqlLocalDb; using Microsoft.EntityFrameworkCore; @@ -24,10 +25,14 @@ public TodoRepositoryTests(ITestOutputHelper outputHelper) private ILoggerFactory LoggerFactory { get; } - [Fact] + [SkippableFact] public async Task Can_Create_Update_And_Delete_Todo_Items() { // Arrange + Skip.IfNot( + RuntimeInformation.IsOSPlatform(OSPlatform.Windows), + "This test can only be run on Windows."); + var now = new DateTimeOffset(2018, 08, 12, 10, 41, 0, TimeSpan.Zero); var clock = new FakeClock(Instant.FromDateTimeOffset(now)); diff --git a/tests/SqlLocalDb.Tests/WindowsCIOnlyFactAttribute.cs b/tests/SqlLocalDb.Tests/WindowsCIOnlyFactAttribute.cs index 47ced75a..5d59e66d 100644 --- a/tests/SqlLocalDb.Tests/WindowsCIOnlyFactAttribute.cs +++ b/tests/SqlLocalDb.Tests/WindowsCIOnlyFactAttribute.cs @@ -20,7 +20,7 @@ public WindowsCIOnlyFactAttribute() bool isWindowsCI = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) || - !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TF_BUILD"))); + !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"))); Skip = isWindowsCI ? string.Empty : $"This test can only be run on Windows CI."; }