未验证 提交 4ee8a0c1 编写于 作者: A Austin Drenski 提交者: GitHub

Setup GitHub Actions v1 (#1068)

上级 f9e62e52
image: Visual Studio 2019
version: 3.1.0-{build}
services:
- postgresql111
environment:
global:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
Test__Npgsql__DefaultConnection: Host=localhost;Database=postgres;Username=postgres;Password=Password12!
PGUSER: postgres
PGPASSWORD: Password12!
POSTGIS_EXE: postgis-bundle-pg11x64-setup-2.5.3-1.exe
NoPackageAnalysis: true # Suppresses warning about SemVer 2.0.0 version suffixes when packing
cache:
- '%USERPROFILE%\.nuget\packages -> **\*.csproj'
- $(POSTGIS_EXE)
clone_depth: 10
install:
- powershell .build\setup_appveyor.ps1
# The following can be used to install a custom version of .NET Core
- ps: Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1" -OutFile "install-dotnet.ps1"
- ps: .\install-dotnet.ps1 -Version 3.0.100 -InstallDir "dotnetcli"
#
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
before_build:
- appveyor-retry dotnet restore -v Minimal
build_script:
- dotnet pack src\EFCore.PG\EFCore.PG.csproj -c Release
- dotnet pack src\EFCore.PG.NodaTime\EFCore.PG.NodaTime.csproj -c Release
- dotnet pack src\EFCore.PG.NTS\EFCore.PG.NTS.csproj -c Release
test_script:
- dotnet test test\EFCore.PG.Tests\EFCore.PG.Tests.csproj
- dotnet test test\EFCore.PG.Plugins.FunctionalTests\EFCore.PG.Plugins.FunctionalTests.csproj
- dotnet test test\EFCore.PG.FunctionalTests\EFCore.PG.FunctionalTests.csproj
artifacts:
- path: 'src\**\*.nupkg'
- path: 'src\**\*.snupkg'
......@@ -3,10 +3,28 @@ set -e
CONTEXT_DIR=$(dirname $0)/docker
sudo docker build -t npgsql/postgres:11 --build-arg PG_VERSION=11 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:10 --build-arg PG_VERSION=10 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:9.6 --build-arg PG_VERSION=9.6 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:9.6 --build-arg PG_VERSION=9.6 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:9.6-postgis-3 --build-arg PG_VERSION=9.6 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:9.6-postgis-2.5 --build-arg PG_VERSION=9.6 --build-arg POSTGIS_MAJOR=2.5 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:10 --build-arg PG_VERSION=10 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:10-postgis-3 --build-arg PG_VERSION=10 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:10-postgis-2.5 --build-arg PG_VERSION=10 --build-arg POSTGIS_MAJOR=2.5 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:11 --build-arg PG_VERSION=11 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:11-postgis-3 --build-arg PG_VERSION=11 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:11-postgis-2.5 --build-arg PG_VERSION=11 --build-arg POSTGIS_MAJOR=2.5 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:12 --build-arg PG_VERSION=12 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:12-postgis-3 --build-arg PG_VERSION=12 --build-arg POSTGIS_MAJOR=3 $CONTEXT_DIR
sudo docker build -t npgsql/postgres:12-postgis-2.5 --build-arg PG_VERSION=12 --build-arg POSTGIS_MAJOR=2.5 $CONTEXT_DIR
sudo docker push npgsql/postgres:11
sudo docker push npgsql/postgres:10
sudo docker push npgsql/postgres:9.6
sudo docker push npgsql/postgres:9.6-postgis-3
sudo docker push npgsql/postgres:9.6-postgis-2.5
sudo docker push npgsql/postgres:10
sudo docker push npgsql/postgres:10-postgis-3
sudo docker push npgsql/postgres:10-postgis-2.5
sudo docker push npgsql/postgres:11
sudo docker push npgsql/postgres:11-postgis-3
sudo docker push npgsql/postgres:11-postgis-2.5
sudo docker push npgsql/postgres:12
sudo docker push npgsql/postgres:12-postgis-3
sudo docker push npgsql/postgres:12-postgis-2.5
ARG PG_VERSION=11
ARG PG_VERSION
FROM postgres:$PG_VERSION
LABEL description="Npgsql CI build image"
LABEL description="Npgsql PostgreSQL image"
ENV POSTGIS_MAJOR 2.5
ENV POSTGIS_VERSION 2.5.2+dfsg-1~exp1.pgdg90+1
ARG POSTGIS_MAJOR
ENV POSTGIS_MAJOR=$POSTGIS_MAJOR
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
postgis=$POSTGIS_VERSION && \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
postgis && \
rm -rf /var/lib/apt/lists/*
# Data directory needs to be empty for initialization scripts to run, so stash one level up.
COPY ./server.crt $PGDATA/../server.crt
COPY ./server.key $PGDATA/../server.key
RUN chown root:postgres $PGDATA/../server.key
RUN chmod 0640 $PGDATA/../server.key
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-npgsql.sh /docker-entrypoint-initdb.d/initdb-npgsql.sh
CMD ["postgres", "-c", "max_prepared_transactions=10", "-c", "ssl=true", "-c", "ssl_cert_file=../server.crt", "-c", "ssl_key_file=../server.key"]
#!/bin/sh
set -e
# Generate server certificate
echo "Generating $PGDATA/server.crt and $PGDATA/server.key"
openssl req -new -x509 -days 365 -nodes -text -out $PGDATA/server.crt -keyout $PGDATA/server.key -subj '/C=US'
chmod 0600 $PGDATA/server.key
chown postgres $PGDATA/server.key
# Configure PostgreSQL
echo "Setting 'ssl = on' in $PGDATA/postgresql.conf"
sed -i 's/#ssl = off/ssl = on/' $PGDATA/postgresql.conf
echo "Setting 'max_prepared_transactions = 10' in $PGDATA/postgresql.conf"
sed -i 's/#max_prepared_transactions = 0/max_prepared_transactions = 10/' $PGDATA/postgresql.conf
# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"
# Standard test account for Npgsql
psql -c "CREATE ROLE npgsql_tests SUPERUSER LOGIN PASSWORD 'npgsql_tests';"
psql -c "CREATE DATABASE npgsql_tests OWNER npgsql_tests;"
# Domain account for Azure Pipelines.
psql -c "CREATE ROLE vsts SUPERUSER LOGIN;"
psql -c "CREATE DATABASE vsts OWNER vsts;"
###################
### Setup PostgreSQL
####################
Write-Host Enabling PostGIS...
If (!(Test-Path $env:POSTGIS_EXE)) {
Write-Host Downloading PostGIS...
(New-Object Net.WebClient).DownloadFile("http://download.osgeo.org/postgis/windows/pg11/$env:POSTGIS_EXE", "$env:POSTGIS_EXE")
}
ls '/Program Files/PostgreSQL'
net start postgresql-x64-11;
iex ".\$env:POSTGIS_EXE /S /D='C:\Program Files\PostgreSQL\11'"
########################
## Set version variables
########################
Set-Variable -Name TruncatedSha1 -Value $env:APPVEYOR_REPO_COMMIT.subString(0, 9)
if ($env:APPVEYOR_REPO_TAG -eq 'true' -and $env:APPVEYOR_REPO_TAG_NAME -match '^v\d+\.\d+\.\d+(-(\w+))?')
{
if ($matches[2]) {
Write-Host "Prerelease tag detected ($env:APPVEYOR_REPO_TAG_NAME), version suffix set to $($matches[2])."
Set-AppveyorBuildVariable -Name VersionSuffix -Value $matches[2]
} else {
Write-Host "Release tag detected ($env:APPVEYOR_REPO_TAG_NAME), no version suffix will be set."
}
Set-AppveyorBuildVariable -Name deploy_github_release -Value true
}
#elseif (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)
#{
# Set-AppveyorBuildVariable -Name deploy_myget_unstable -Value true
# Set-Variable -Name VersionSuffix -Value "pr$($env:APPVEYOR_PULL_REQUEST_NUMBER).$($env:APPVEYOR_BUILD_NUMBER)+sha.$TruncatedSha1"
# Write-Host "Pull request detected (#$env:APPVEYOR_PULL_REQUEST_NUMBER), setting version suffix to $VersionSuffix"
# Set-AppveyorBuildVariable -Name VersionSuffix -Value $VersionSuffix
#}
else
{
# Set which myget feed we deploy to
if ($env:APPVEYOR_REPO_BRANCH.StartsWith("hotfix/")) {
Set-AppveyorBuildVariable -Name deploy_myget_stable -Value true
} else {
Set-AppveyorBuildVariable -Name deploy_myget_unstable -Value true
}
Set-Variable -Name VersionSuffix -Value "ci.$($env:APPVEYOR_BUILD_NUMBER)+sha.$TruncatedSha1"
Write-Host "Setting version suffix to $VersionSuffix"
Set-AppveyorBuildVariable -Name VersionSuffix -Value $VersionSuffix
}
# Acquire Postgres Package Manager by BigSQL
powershell -c "Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://s3.amazonaws.com/pgcentral/install.ps1'))";
# Install PostgreSQL
bigsql/pgc list
bigsql/pgc install pg11
# Install PostGIS
bigsql/pgc list --extensions pg11
bigsql/pgc install postgis25-pg11
# Initialize PostgreSQL
bigsql/pg11/bin/initdb -D PGDATA -E UTF8 -U postgres
# Configure PostgreSQL
cp .build/docker/server.crt PGDATA/
cp .build/docker/server.key PGDATA/
# Start PostgreSQL
bigsql/pg11/bin/pg_ctl -D PGDATA -l logfile -o '-c max_prepared_transactions=10 -c ssl=true' start
# Configure domain account
bigsql/pg11/bin/psql -U postgres -c "CREATE ROLE vsts SUPERUSER LOGIN"
bigsql/pg11/bin/psql -U postgres -c "CREATE DATABASE vsts OWNER vsts"
# Configure test account
bigsql/pg11/bin/psql -U postgres -c "CREATE ROLE npgsql_tests SUPERUSER LOGIN PASSWORD 'npgsql_tests'"
bigsql/pg11/bin/psql -U postgres -c "CREATE DATABASE npgsql_tests OWNER npgsql_tests"
name: Build
on: push
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
pg_major: [ 12, 11, 10 ]
postgis_version: [ 3 ]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start PostgreSQL ${{ matrix.pg_major }} (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: docker run --detach --name postgresql -p 5432:5432 npgsql/postgres:${{ matrix.pg_major }}-postgis-${{ matrix.postgis_version }}
shell: bash
- name: Start PostgreSQL ${{ matrix.pg_major }} (Windows)
if: startsWith(matrix.os, 'windows')
run: |
# Find EnterpriseDB version number
EDB_VERSION=$(\
curl -Ls 'http://sbp.enterprisedb.com/applications.xml' |
sed -n '\#<id>postgresql_${{ matrix.pg_major }}</id>#{n;p;n;p;}' |
sed -n '\#<platform>windows-x64</platform>#{n;p;}' |
sed -E 's#.*<version>([^<]+)</version>#\1#')
# Install PostgreSQL
echo "Installing PostgreSQL (version: ${EDB_VERSION})"
curl -o pgsql.zip -L https://get.enterprisedb.com/postgresql/postgresql-${EDB_VERSION}-windows-x64-binaries.zip
unzip pgsql.zip -x 'pgsql/include/**' 'pgsql/doc/**' 'pgsql/pgAdmin 4/**' 'pgsql/StackBuilder/**'
# Match Npgsql CI Docker image and stash one level up
cp {$GITHUB_WORKSPACE/.build/docker,pgsql}/server.crt
cp {$GITHUB_WORKSPACE/.build/docker,pgsql}/server.key
# Find OSGEO version number
OSGEO_VERSION=$(\
curl -Ls https://download.osgeo.org/postgis/windows/pg${{ matrix.pg_major }} |
sed -n 's/.*>postgis-bundle-pg${{ matrix.pg_major }}-\(${{ matrix.postgis_version }}.[0-9]*.[0-9]*\)x64.zip<.*/\1/p')
# Install PostGIS
echo "Installing PostGIS (version: ${OSGEO_VERSION})"
POSTGIS_FILE="postgis-bundle-pg${{ matrix.pg_major }}-${OSGEO_VERSION}x64"
curl -o postgis.zip -L https://download.osgeo.org/postgis/windows/pg${{ matrix.pg_major }}/${POSTGIS_FILE}.zip
unzip postgis.zip -d postgis
cp -a postgis/$POSTGIS_FILE/. pgsql/
# Start PostgreSQL
pgsql/bin/initdb -D pgsql/PGDATA -E UTF8 -U postgres
pgsql/bin/pg_ctl -D pgsql/PGDATA -l logfile -o '-c max_prepared_transactions=10 -c ssl=true -c ssl_cert_file=../server.crt -c ssl_key_file=../server.key' start
# Configure test account
pgsql/bin/psql -U postgres -c "CREATE ROLE npgsql_tests SUPERUSER LOGIN PASSWORD 'npgsql_tests'"
pgsql/bin/psql -U postgres -c "CREATE DATABASE npgsql_tests OWNER npgsql_tests"
shell: bash
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.0.2 # Issues with DOTNET_ROOT
with:
dotnet-version: '3.0.100'
- name: Test
run: dotnet test --configuration Debug
shell: bash
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Pack NuGet packages (CI versions)
if: startsWith(github.ref, 'refs/heads/')
run: dotnet pack --configuration Release --output nupkgs --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}"
- name: Pack NuGet packages (Release versions)
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet pack --configuration Release --output nupkgs
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: EFCore.PG+sha.${{ github.sha }}
path: nupkgs
- name: Publish packages to MyGet (vnext)
if: startsWith(github.ref, 'refs/heads/') && startsWith(github.ref, 'refs/heads/hotfix/') == false
run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.MYGET_FEED_VNEXT }} --source https://www.myget.org/F/npgsql-unstable/api/v3/index.json
- name: Publish packages to MyGet (patch)
if: startsWith(github.ref, 'refs/heads/hotfix/')
run: dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.MYGET_FEED_PATCH }} --source https://www.myget.org/F/npgsql/api/v3/index.json
name: 3.1.0-ci.$(Date:yyyyMMdd).$(Rev:r) # equal to $(Build.BuildNumber)
trigger:
branches:
include:
- 'refs/heads/*'
- 'refs/tags/*'
variables:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_SDK_VERSION: '3.0.100'
RELEASE_NOTES_FILE: 'doc/release-notes/3.0.md'
GITHUB_SERVICE_CONNECTION: 'efcore.pg-releases'
resources:
containers:
- container: postgres_11
image: npgsql/postgres:11
ports:
- 5432:5432
- container: postgres_10
image: npgsql/postgres:10
ports:
- 5432:5432
# Disabled during the switch to identity columns by default.
# Need to have tests running in the proper compatibility mode.
# - container: postgres_9_6
# image: npgsql/postgres:9.6
# ports:
# - 5432:5432
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
postgres_11:
postgres_service: postgres_11
postgres_10:
postgres_service: postgres_10
# postgres_9_6:
# postgres_service: postgres_9_6
services:
postgres: $[variables['postgres_service']]
steps:
- bash: echo "##vso[task.setvariable variable=truncated_sha1]${BUILD_SOURCEVERSION:0:9}"
displayName: 'Assign truncated SHA1 to environment variable'
- task: DotNetCoreInstaller@1
displayName: 'Install .NET Core SDK'
inputs:
packageType: 'sdk'
version: '$(DOTNET_SDK_VERSION)'
- task: DotNetCoreCLI@2
displayName: 'Test'
inputs:
command: 'test'
configuration: 'Debug'
projects: 'test/**/*.csproj'
publishTestResults: true
- task: DotNetCoreCLI@2
displayName: 'Pack NuGet packages (CI versions)'
inputs:
buildProperties: 'Version=$(Build.BuildNumber)+sha.$(truncated_sha1)'
command: 'pack'
configuration: 'Release'
includeSymbols: false
outputDir: '$(Build.StagingDirectory)/ci'
packagesToPack: 'src/**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Pack symbol packages (CI versions)'
inputs:
buildProperties: 'Version=$(Build.BuildNumber)+sha.$(truncated_sha1)'
command: 'pack'
configuration: 'Release'
includeSymbols: true
outputDir: '$(Build.StagingDirectory)/ci'
packagesToPack: 'src/**/*.csproj'
- task: PublishBuildArtifacts@1
displayName: 'Publish artifacts'
inputs:
pathtoPublish: '$(Build.StagingDirectory)'
artifactName: 'linux-build'
#- job: Windows
# pool:
# vmImage: 'vs2017-win2016'
# steps:
# - powershell: Write-Host "##vso[task.setvariable variable=truncated_sha1]$($env:BUILD_SOURCEVERSION.subString(0, 9))"
# displayName: 'Assign truncated SHA1 to environment variable'
# - powershell: .build/setup_postgres.ps1
# displayName: 'Start PostgreSQL'
# - task: DotNetCoreInstaller@1
# displayName: 'Install .NET Core SDK'
# inputs:
# packageType: 'sdk'
# version: '$(DOTNET_SDK_VERSION)'
# - task: DotNetCoreCLI@2
# displayName: 'Test'
# inputs:
# command: 'test'
# configuration: 'Debug'
# projects: 'test/**/*.csproj'
# publishTestResults: true
# - task: DotNetCoreCLI@2
# displayName: 'Pack NuGet packages (CI versions)'
# inputs:
# buildProperties: 'Version=$(Build.BuildNumber)+sha.$(truncated_sha1)'
# command: 'pack'
# configuration: 'Release'
# includeSymbols: false
# outputDir: '$(Build.StagingDirectory)/ci'
# packagesToPack: 'src/**/*.csproj'
# - task: DotNetCoreCLI@2
# displayName: 'Pack NuGet packages (Release versions)'
# inputs:
# command: 'pack'
# configuration: 'Release'
# includeSymbols: false
# outputDir: '$(Build.StagingDirectory)/release'
# packagesToPack: 'src/**/*.csproj'
# - task: DotNetCoreCLI@2
# displayName: 'Pack symbol packages (CI versions)'
# inputs:
# buildProperties: 'Version=$(Build.BuildNumber)+sha.$(truncated_sha1)'
# command: 'pack'
# configuration: 'Release'
# includeSymbols: true
# outputDir: '$(Build.StagingDirectory)/ci'
# packagesToPack: 'src/**/*.csproj'
# - task: DotNetCoreCLI@2
# displayName: 'Pack symbol packages (Release versions)'
# inputs:
# command: 'pack'
# configuration: 'Release'
# includeSymbols: true
# outputDir: '$(Build.StagingDirectory)/release'
# packagesToPack: 'src/**/*.csproj'
# - task: PublishBuildArtifacts@1
# displayName: 'Publish artifacts'
# inputs:
# pathtoPublish: '$(Build.StagingDirectory)'
# artifactName: 'windows-build'
# - task: NuGetToolInstaller@1 # TODO: needed because DotNetCoreCLI@2 doesn't support authenticated feeds yet. See: https://github.com/Microsoft/azure-pipelines-tasks/issues/7160
# displayName: 'Install NuGet CLI'
# inputs:
# versionSpec: '4.3.0'
# - task: NuGetCommand@2
# displayName: 'Publish to MyGet (unstable)'
# condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/hotfix/')))
# inputs:
# command: 'push'
# nuGetFeedType: 'external'
# packagesToPush: '$(Build.StagingDirectory)/ci/*.nupkg;!$(Build.StagingDirectory)/ci/*.symbols.nupkg;!$(Build.StagingDirectory)/ci/*.snupkg'
# publishFeedCredentials: 'npgsql-unstable'
# - task: NuGetCommand@2
# displayName: 'Publish to MyGet (stable)'
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/hotfix/'))
# inputs:
# command: 'push'
# nuGetFeedType: 'external'
# packagesToPush: '$(Build.StagingDirectory)/ci/*.nupkg;!$(Build.StagingDirectory)/ci/*.symbols.nupkg;!$(Build.StagingDirectory)/ci/*.snupkg'
# publishFeedCredentials: 'npgsql-stable'
# - task: GitHubRelease@0
# displayName: 'Publish GitHub Pre-release'
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), contains(variables['Build.SourceBranch'], '-preview'))
# inputs:
# assets: '$(Build.StagingDirectory)/release/*'
# gitHubConnection: '$(GITHUB_SERVICE_CONNECTION)'
# isPreRelease: true
# releaseNotesFile: '$(RELEASE_NOTES_FILE)'
# - task: GitHubRelease@0
# displayName: 'Publish GitHub Release'
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], '-preview')))
# inputs:
# assets: '$(Build.StagingDirectory)/release/*'
# gitHubConnection: '$(GITHUB_SERVICE_CONNECTION)'
# isPreRelease: false
# releaseNotesFile: '$(RELEASE_NOTES_FILE)'
......@@ -11,12 +11,8 @@ if [[ $v == *"-" ]]; then
exit 1
fi
sed -i 's/^version: .*/version: '$v'-{build}/' .appveyor.yml
sed -i 's/<VersionPrefix>[^<]*<\/VersionPrefix>/<VersionPrefix>'$v'<\/VersionPrefix>/' Directory.Build.props
sed -i 's/^name: [^-]*-/name: '$v'-/' azure-pipelines.yml
git add .appveyor.yml
git add azure-pipelines.yml
git add Directory.Build.props
git commit -m "Bump version to $v"
......@@ -68,7 +68,7 @@ public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadO
var argument = arguments[0];
var stringTypeMapping = ExpressionExtensions.InferTypeMapping(instance, argument);
return _sqlExpressionFactory.Subtract(
var strposExpression = _sqlExpressionFactory.Subtract(
_sqlExpressionFactory.Function(
"STRPOS",
new[]
......@@ -78,6 +78,17 @@ public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadO
},
method.ReturnType),
_sqlExpressionFactory.Constant(1));
return _sqlExpressionFactory.Case(
new[]
{
new CaseWhenClause(
_sqlExpressionFactory.Equal(
_sqlExpressionFactory.ApplyTypeMapping(argument, stringTypeMapping),
_sqlExpressionFactory.Constant(string.Empty, stringTypeMapping)),
_sqlExpressionFactory.Constant(0))
},
strposExpression);
}
if (method == Replace)
......
......@@ -20,6 +20,9 @@ public FunkyDataQueryNpgsqlTest(FunkyDataQueryNpgsqlFixture fixture, ITestOutput
[ConditionalFact(Skip = "https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/996")]
public override void String_contains_on_argument_with_wildcard_column() {}
[ConditionalFact(Skip = "https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/996")]
public override void String_contains_on_argument_with_wildcard_column_negated() {}
[ConditionalFact(Skip = "https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/996")]
public override void String_contains_on_argument_with_wildcard_constant() {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册