Skip to content

Commit 50a9c38

Browse files
committed
fix CI
1 parent 2e09ec3 commit 50a9c38

4 files changed

Lines changed: 32 additions & 29 deletions

File tree

build/build.fs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ open Fake.DotNet
22
open System
33
open System.Linq
44
open System.IO
5+
open System.Xml.Linq
56
open Fun.Build
67
open Fake.Core
78
open Fake.Tools.Git
@@ -127,7 +128,6 @@ Target.create "Build" (fun _ ->
127128
slnPath)
128129

129130
open System.Data.SqlClient
130-
open System.Configuration
131131
open System.IO.Compression
132132
open Fake.DotNet.Testing
133133

@@ -141,29 +141,32 @@ Target.create "DeployTestDB" (fun _ ->
141141

142142
stage "adjust config file connection strings" {
143143
run (fun ctx ->
144-
let map = ExeConfigurationFileMap()
145-
map.ExeConfigFilename <- testsSourceRoot @@ "app.config"
144+
let appConfigPath = testsSourceRoot @@ "app.config"
146145

147-
let testConfigFile =
148-
ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None)
146+
let connStrValue =
147+
let gitHubActionSqlConnectionString =
148+
System.Environment.GetEnvironmentVariable "GITHUB_ACTION_SQL_SERVER_CONNECTION_STRING"
149149

150-
let connStr =
151-
let connStr =
152-
let gitHubActionSqlConnectionString =
153-
System.Environment.GetEnvironmentVariable "GITHUB_ACTION_SQL_SERVER_CONNECTION_STRING"
150+
if String.IsNullOrWhiteSpace gitHubActionSqlConnectionString then
151+
// Read current value directly from XML
152+
let doc = XDocument.Load(appConfigPath)
154153

155-
if String.IsNullOrWhiteSpace gitHubActionSqlConnectionString then
156-
testConfigFile.ConnectionStrings.ConnectionStrings.["AdventureWorks"].ConnectionString
157-
else
158-
// we run under Github Actions, update the test config file connection string.
159-
testConfigFile.ConnectionStrings.ConnectionStrings.["AdventureWorks"].ConnectionString <-
160-
gitHubActionSqlConnectionString
154+
doc.Root.Element("connectionStrings").Elements("add")
155+
|> Seq.find (fun el -> el.Attribute(XName.Get "name").Value = "AdventureWorks")
156+
|> fun el -> el.Attribute(XName.Get "connectionString").Value
157+
else
158+
// Write the new connection string directly into the XML file
159+
let doc = XDocument.Load(appConfigPath)
161160

162-
testConfigFile.Save()
163-
gitHubActionSqlConnectionString
161+
let el =
162+
doc.Root.Element("connectionStrings").Elements("add")
163+
|> Seq.find (fun el -> el.Attribute(XName.Get "name").Value = "AdventureWorks")
164164

165-
SqlConnectionStringBuilder connStr
165+
el.SetAttributeValue(XName.Get "connectionString", gitHubActionSqlConnectionString)
166+
doc.Save(appConfigPath)
167+
gitHubActionSqlConnectionString
166168

169+
let connStr = SqlConnectionStringBuilder connStrValue
167170
testConnStr <- Some connStr
168171
database <- Some connStr.InitialCatalog
169172

src/SqlClient.DesignTime/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ open System.Runtime.CompilerServices
77
[<assembly: AssemblyTitleAttribute("SqlClient.DesignTime")>]
88
[<assembly: AssemblyProductAttribute("FSharp.Data.SqlClient.DesignTime")>]
99
[<assembly: AssemblyDescriptionAttribute("SqlClient F# type providers")>]
10-
[<assembly: AssemblyVersionAttribute("2.1.3")>]
11-
[<assembly: AssemblyFileVersionAttribute("2.1.3")>]
10+
[<assembly: AssemblyVersionAttribute("3.0.0")>]
11+
[<assembly: AssemblyFileVersionAttribute("3.0.0")>]
1212
[<assembly: InternalsVisibleToAttribute("SqlClient.Tests")>]
1313
do ()
1414

@@ -23,10 +23,10 @@ module internal AssemblyVersionInformation =
2323
let AssemblyDescription = "SqlClient F# type providers"
2424

2525
[<Literal>]
26-
let AssemblyVersion = "2.1.3"
26+
let AssemblyVersion = "3.0.0"
2727

2828
[<Literal>]
29-
let AssemblyFileVersion = "2.1.3"
29+
let AssemblyFileVersion = "3.0.0"
3030

3131
[<Literal>]
3232
let InternalsVisibleTo = "SqlClient.Tests"

src/SqlClient/AssemblyInfo.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ open System.Runtime.CompilerServices
77
[<assembly: AssemblyTitleAttribute("SqlClient")>]
88
[<assembly: AssemblyProductAttribute("FSharp.Data.SqlClient")>]
99
[<assembly: AssemblyDescriptionAttribute("SqlClient F# type providers")>]
10-
[<assembly: AssemblyVersionAttribute("2.1.3")>]
11-
[<assembly: AssemblyFileVersionAttribute("2.1.3")>]
10+
[<assembly: AssemblyVersionAttribute("3.0.0")>]
11+
[<assembly: AssemblyFileVersionAttribute("3.0.0")>]
1212
[<assembly: InternalsVisibleToAttribute("SqlClient.Tests")>]
1313
do ()
1414

@@ -23,10 +23,10 @@ module internal AssemblyVersionInformation =
2323
let AssemblyDescription = "SqlClient F# type providers"
2424

2525
[<Literal>]
26-
let AssemblyVersion = "2.1.3"
26+
let AssemblyVersion = "3.0.0"
2727

2828
[<Literal>]
29-
let AssemblyFileVersion = "2.1.3"
29+
let AssemblyFileVersion = "3.0.0"
3030

3131
[<Literal>]
3232
let InternalsVisibleTo = "SqlClient.Tests"

tests/SqlClient.Tests/app.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<configSections>
44
<section name="FSharp.Data.SqlClient" type="System.Configuration.NameValueSectionHandler" />
55
</configSections>
66
<!--<connectionStrings configSource="connectionStrings.Azure.config"/>-->
77
<connectionStrings>
8-
<add name="AdventureWorks" connectionString="Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True;TrustServerCertificate=true" />
9-
<add name="MasterDb" connectionString="Data Source=.;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=true" />
8+
<add name="AdventureWorks" connectionString="Data Source=localhost,1433;Initial Catalog=AdventureWorks2012;User ID=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=True;" />
9+
<add name="MasterDb" connectionString="Data Source=.;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=true" />
1010
</connectionStrings>
1111
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1212
<dependentAssembly>

0 commit comments

Comments
 (0)