diff --git a/.github/workflows/1-pr.yaml b/.github/workflows/1-pr.yaml
index c6d8f9f44..f6c635e81 100644
--- a/.github/workflows/1-pr.yaml
+++ b/.github/workflows/1-pr.yaml
@@ -11,7 +11,7 @@ env:
DLL_FILE_PATH: "./bin/Release/net6.0/CarbonAware.WebApi.dll"
DOTNET_SRC_DIR: "./src"
# console app packages
- DOTNET_SOLUTION: "src/GSF.CarbonAware/src/GSF.CarbonAware.csproj"
+ DOTNET_SOLUTION: "src/CarbonAwareSDK.sln"
OUTPUT_DIR: "packages"
CONSOLE_APP: "samples/lib-integration/ConsoleApp/ConsoleApp.csproj"
CREATE_PKGS: "scripts/package/create_packages.ps1"
diff --git a/.github/workflows/verify-azure-function-with-packages.yaml b/.github/workflows/verify-azure-function-with-packages.yaml
index d5faa3dba..a99fe1b06 100644
--- a/.github/workflows/verify-azure-function-with-packages.yaml
+++ b/.github/workflows/verify-azure-function-with-packages.yaml
@@ -29,23 +29,30 @@ jobs:
- name: Docker Target Final
run: |
docker build --no-cache . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.CONTAINER_IMAGE_NAME }}
- docker rmi -f $(docker images -f "dangling=true" -q)
+ docker image prune -f
- name: Docker Run Container
- run: docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}
+ run: |
+ docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}
+ timeout 30 bash -c -- 'while [ -z "$(docker ps -q)" ]; do echo "waiting for container to start" && sleep 5s; done'
+ docker ps
# Request fails with authentication error. Expected
- name: Get Average Carbon Intensity
run: |
set +e
- ret_code=$(wget -S -t 5 --waitretry=5 "http://0.0.0.0:8080/api/GetAverageCarbonIntensity?startDate=2022-03-01T15:30:00Z&endDate=2022-03-01T18:30:00Z&location=eastus" 2>&1 | grep "HTTP/" | awk '{print $2}')
+ set -x
+ ret_code=$(wget --server-response "http://0.0.0.0:8080/api/GetAverageCarbonIntensity?startDate=2022-03-01T15:30:00Z&endDate=2022-03-01T18:30:00Z&location=eastus" 2>&1 | awk '/^ HTTP/{print $2}')
set -e
- [ "401" == $ret_code ]
+ echo "Return Code: $ret_code"
+ [ "401" = "$ret_code" ]
# Request fails with authentication error. Expected
- name: Get Current Forecast
run: |
set +e
- ret_code=$(wget -S -t 5 --waitretry=5 "http://0.0.0.0:8080/api/GetCurrentForecast" --header "Content-Type: application/json" --post-data '{"startDate":"2022-11-02T15:30:00Z","endDate":"2022-11-02T18:30:00Z","location":"eastus","duration":"15"}' 2>&1 | grep "HTTP/" | awk '{print $2}')
+ set -x
+ ret_code=$(curl -4 --retry-connrefused --retry 6 --retry-delay 10 -s -o /dev/null -w "%{response_code}" -X POST -H "Content-Type: application/json" -d '{"startDate":"2022-11-02T15:30:00Z","endDate":"2022-11-02T18:30:00Z","location":"eastus","duration":"15"}' "http://0.0.0.0:8080/api/GetCurrentForecast"
set -e
- [ "401" == $ret_code ]
+ echo "Return Code: $ret_code"
+ [ "401" = "$ret_code" ]
diff --git a/.gitignore b/.gitignore
index 70926da57..376132234 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,6 @@ src/data/location-sources/custom-azure-zones.json
# exclude artifacts on java-client example
samples/java-client/target
+
+# exclude artifacts from default package builder
+/packages
\ No newline at end of file
diff --git a/docs/packaging.md b/docs/packaging.md
index 0ae684e22..2d36c3f93 100644
--- a/docs/packaging.md
+++ b/docs/packaging.md
@@ -18,21 +18,21 @@ showing how the package can be consumed.
- [Console App Sample](#console-app-sample)
- [Run the Sample Console App](#run-the-sample-console-app)
-## Included Projects
+## Included Packages
-The current package include 7 projects from the SDK:
+The current solution creates 5 packages from the SDK projects:
1. "GSF.CarbonAware"
-2. "CarbonAware"
-3. "CarbonAware.DataSources.ElectricityMapsFree"
-4. "CarbonAware.DataSources.ElectricityMaps"
-5. "CarbonAware.DataSources.Json"
-6. "CarbonAware.DataSources.WattTime"
-7. "CarbonAware.LocationSources"
-
-These 7 projects enable users of the library to consume the current endpoints
-exposed by the library. The package that needs to be added to a new C# project
-is `GSF.CarbonAware`.
+ 1. "CarbonAware"
+ 2. "CarbonAware.LocationSources"
+2. "CarbonAware.DataSources.ElectricityMapsFree"
+3. "CarbonAware.DataSources.ElectricityMaps"
+4. "CarbonAware.DataSources.Json"
+5. "CarbonAware.DataSources.WattTime"
+
+Adding the `GSF.CarbonAware` project to your C# projects gives you access to all
+CarbonAware SDK interfaces.
+Additionally, operators must add any data source packages they plan to use.
## Included Scripts
diff --git a/samples/azure/azure-function/Dockerfile b/samples/azure/azure-function/Dockerfile
index 53316cbf0..4aeed4c49 100644
--- a/samples/azure/azure-function/Dockerfile
+++ b/samples/azure/azure-function/Dockerfile
@@ -10,7 +10,7 @@ COPY ["scripts/", "data/scripts/"]
COPY ["samples/", "data/samples/"]
WORKDIR /data
-RUN pwsh -c scripts/package/create_packages.ps1 src/GSF.CarbonAware/src/GSF.CarbonAware.csproj /packages && \
+RUN pwsh -c scripts/package/create_packages.ps1 src/CarbonAwareSDK.sln /packages && \
dotnet restore "samples/azure/azure-function/function.csproj" && \
pwsh -c scripts/package/add_packages.ps1 samples/azure/azure-function/function.csproj /packages && \
dotnet build "samples/azure/azure-function/function.csproj" -c Release -o /app/build
diff --git a/scripts/package/create_packages.ps1 b/scripts/package/create_packages.ps1
index a07cc6e20..7bfa6e2cf 100644
--- a/scripts/package/create_packages.ps1
+++ b/scripts/package/create_packages.ps1
@@ -14,7 +14,7 @@ if ([string]::IsNullOrEmpty($DOTNET_SOLUTION) -or [string]::IsNullOrEmpty($DEST_
$REVISION = $(git rev-parse HEAD)
$BRANCH = "dev"
-New-Item -Path $DEST_PACKAGES -ItemType Directory
+New-Item -Path $DEST_PACKAGES -ItemType Directory -Force | Out-Null
# Remove existing packages
Get-ChildItem -Path $path -Recurse -Include *.nupkg, *.snupkg | Remove-Item
diff --git a/src/CarbonAware.CLI/src/CarbonAware.CLI.csproj b/src/CarbonAware.CLI/src/CarbonAware.CLI.csproj
index fcc1f9bfb..03ca3a85e 100644
--- a/src/CarbonAware.CLI/src/CarbonAware.CLI.csproj
+++ b/src/CarbonAware.CLI/src/CarbonAware.CLI.csproj
@@ -27,6 +27,14 @@
+
+
+
+
diff --git a/src/CarbonAware.DataSources/CarbonAware.DataSources.Json/src/CarbonAware.DataSources.Json.csproj b/src/CarbonAware.DataSources/CarbonAware.DataSources.Json/src/CarbonAware.DataSources.Json.csproj
index 1d0002f72..defd0103a 100644
--- a/src/CarbonAware.DataSources/CarbonAware.DataSources.Json/src/CarbonAware.DataSources.Json.csproj
+++ b/src/CarbonAware.DataSources/CarbonAware.DataSources.Json/src/CarbonAware.DataSources.Json.csproj
@@ -4,7 +4,6 @@
enable
enable
true
- false
diff --git a/src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/CarbonAware.DataSources.WattTime.csproj b/src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/CarbonAware.DataSources.WattTime.csproj
index f9f3e6bcc..ade7ea95e 100644
--- a/src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/CarbonAware.DataSources.WattTime.csproj
+++ b/src/CarbonAware.DataSources/CarbonAware.DataSources.WattTime/src/CarbonAware.DataSources.WattTime.csproj
@@ -5,7 +5,6 @@
enable
enable
true
- false
diff --git a/src/CarbonAware.WebApi/src/CarbonAware.WebApi.csproj b/src/CarbonAware.WebApi/src/CarbonAware.WebApi.csproj
index 356e23088..e6c315bfb 100644
--- a/src/CarbonAware.WebApi/src/CarbonAware.WebApi.csproj
+++ b/src/CarbonAware.WebApi/src/CarbonAware.WebApi.csproj
@@ -12,6 +12,7 @@
$(AssemblyName).xml
1591
+ false
@@ -29,6 +30,14 @@
+
+
+
+
diff --git a/src/GSF.CarbonAware/src/GSF.CarbonAware.csproj b/src/GSF.CarbonAware/src/GSF.CarbonAware.csproj
index d6bd80083..e90160bd1 100644
--- a/src/GSF.CarbonAware/src/GSF.CarbonAware.csproj
+++ b/src/GSF.CarbonAware/src/GSF.CarbonAware.csproj
@@ -21,14 +21,6 @@
-
-
-
-
diff --git a/src/GSF.CarbonAware/test/GSF.CarbonAware.Tests.csproj b/src/GSF.CarbonAware/test/GSF.CarbonAware.Tests.csproj
index 64e74590c..93aecfffe 100644
--- a/src/GSF.CarbonAware/test/GSF.CarbonAware.Tests.csproj
+++ b/src/GSF.CarbonAware/test/GSF.CarbonAware.Tests.csproj
@@ -26,6 +26,10 @@
+
+
\ No newline at end of file