diff --git a/.github/workflows/main_blazor-appl.yml b/.github/workflows/main_blazor-appl.yml new file mode 100644 index 00000000..ddae11e1 --- /dev/null +++ b/.github/workflows/main_blazor-appl.yml @@ -0,0 +1,66 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Blazor-appl - Build and deploy + +on: + push: + branches: + - main + paths: + - "src/apps/blazor-app/**" + - ".github/workflows/main_blazor-appl.yml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src/apps/blazor-app + + steps: + - uses: actions/checkout@v2 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "7.0.x" + include-prerelease: true + + - name: Build with dotnet + run: | + yarn + dotnet build -c Release + + - name: dotnet publish + run: dotnet publish -c Release -o ./publish + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: .net-app + path: src/apps/blazor-app/publish + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: "Production" + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: .net-app + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: "blazor-appl" + slot-name: "Production" + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_7CF290DC47994C3BA43A303FCF5A89CA }} + package: . diff --git a/.github/workflows/main_dot-net-api.yml b/.github/workflows/main_dot-net-api.yml new file mode 100644 index 00000000..21161fa1 --- /dev/null +++ b/.github/workflows/main_dot-net-api.yml @@ -0,0 +1,64 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy - dot-net-api + +on: + push: + branches: + - "main" + paths: + - "src/apps/api/**" + - ".github/workflows/main_dot-net-api.yml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src/apps/api + + steps: + - uses: actions/checkout@v2 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "7.0.x" + include-prerelease: true + + - name: Build with dotnet + run: dotnet build -c Release + + - name: dotnet publish + run: dotnet publish -c Release -o ./publish + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: .net-app + path: src/apps/api/publish + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: "Production" + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: .net-app + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: "dot-net-api" + slot-name: "Production" + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_D7DCB7DDE31F4AA9879DA722FF5637EE }} + package: . diff --git a/.github/workflows/main_express-microservice.yml b/.github/workflows/main_express-microservice.yml new file mode 100644 index 00000000..d0cdcc6e --- /dev/null +++ b/.github/workflows/main_express-microservice.yml @@ -0,0 +1,78 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Express - Build and Deploy + +on: + push: + branches: + - main + paths: + - "src/apps/services/**" + - ".github/workflows/main_express-microservice.yml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: "18.x" + + - name: yarn install and build + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + cache-dependency-path: | + src/yarn.lock + src/package-lock.json + - run: | + yarn + yarn nx run services:build --configuration=production + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: node-app + path: | + src/dist/apps/services + src/package.json + src/.puppeteerrc.cjs + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: "Production" + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: node-app + + - run: mv dist/apps/services/* . + + - run: yarn add puppeteer + + - run: yarn --production + + - name: "Deploy to Azure Web App" + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: "express-microservice" + slot-name: "Production" + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B5AD89411527464CA08BE8E4F87274B2 }} + package: . diff --git a/.github/workflows/main_libs.yml b/.github/workflows/main_libs.yml new file mode 100644 index 00000000..e5646c69 --- /dev/null +++ b/.github/workflows/main_libs.yml @@ -0,0 +1,64 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy - libs + +on: + push: + branches: + - "main" + paths: + - "src/libs/**" + - ".github/workflows/main_libs.yml" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src/libs/shared-utils + + steps: + - uses: actions/checkout@v2 + + - name: Set up .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "7.0.x" + include-prerelease: true + + - name: Build with dotnet + run: dotnet build -c Release + + - name: dotnet publish + run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: .net-app + path: ${{env.DOTNET_ROOT}}/myapp + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: "Production" + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: .net-app + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: "libs" + slot-name: "Production" + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_927C1878D22148E4A15E97F5A738E248 }} + package: . diff --git a/src/.gitignore b/src/.gitignore index 52d93566..3d9edbee 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -42,4 +42,5 @@ Thumbs.db .env .env.* -apps/machine-learning/* \ No newline at end of file +apps/machine-learning/* +/.cache \ No newline at end of file diff --git a/src/.puppeteerrc.cjs b/src/.puppeteerrc.cjs new file mode 100644 index 00000000..a7021076 --- /dev/null +++ b/src/.puppeteerrc.cjs @@ -0,0 +1,9 @@ +const {join} = require('path'); + +/** + * @type {import("puppeteer").Configuration} + */ +module.exports = { + // Changes the cache location for Puppeteer. + cacheDirectory: join(__dirname, '.cache', 'puppeteer'), +}; \ No newline at end of file diff --git a/src/apps/blazor-app/Components/Dashboard/LocationItem.razor b/src/apps/blazor-app/Components/Dashboard/LocationItem.razor index 197bfff7..49828fe4 100644 --- a/src/apps/blazor-app/Components/Dashboard/LocationItem.razor +++ b/src/apps/blazor-app/Components/Dashboard/LocationItem.razor @@ -10,7 +10,7 @@
@Text
+@Text
diff --git a/src/apps/blazor-app/Components/SolarScore/Results.razor b/src/apps/blazor-app/Components/SolarScore/Results.razor index f78f1fef..55caebcf 100644 --- a/src/apps/blazor-app/Components/SolarScore/Results.razor +++ b/src/apps/blazor-app/Components/SolarScore/Results.razor @@ -55,8 +55,10 @@ @* Solar Score and Potential Savings *@R
- @{ - var savings = Math.Round(avgEnergyProduction * 2.5 * 30, 0); - } + @{ + var savings = Math.Round(avgEnergyProduction * 2.5 * 30, 0); + }@savings
p/m
@tooltipService.GetTooltip("number of panels")
@tooltipService.GetTooltip("battery utilisation")
@chargingLimitPercentage
-%
++ %
@tooltipService.GetTooltip("number of batteries")
You can add or remove appliances to get more accurate power usages for your location on our calculations page.
+You can add or remove appliances to get more accurate power usages for your location on our + calculations page.
Go to calculations page now?