Skip to content

Commit

Permalink
Merge pull request #70 from amosproj/main
Browse files Browse the repository at this point in the history
Mid-project-Release
  • Loading branch information
Waldleufer authored May 26, 2021
2 parents cf8660f + 8923a58 commit 5063ca8
Show file tree
Hide file tree
Showing 85 changed files with 15,819 additions and 19,028 deletions.
12 changes: 7 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ labels: feature
3. So that {}

## Acceptance criteria
* Criterion 1
* Criterion 2
* ...
* [ ] Criterion 1
* [ ] Criterion 2
* [ ] ...

## Definition of done
* Added only after week 5
* The same for all features
* [ ] Documentation for the feature is done
* [ ] Feature branch has been merged
* [ ] Code has been reviewed by at least one other team member
* [ ] Unit tests are written
30 changes: 30 additions & 0 deletions .github/workflows/Reactjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Frontend CI

on:
push:
branches: [ main, frontend-dev, release ]
pull_request:
branches: [ main, frontend-dev, release ]

jobs:
buildAndTest:
name: Build and Test Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- name: Checkout git repository
uses: actions/checkout@v1

- name: Install Dependencies
run: yarn --no-progress --non-interactive --no-lockfile

- name: Build
run: yarn build frontend/public/index.html

- name: Test
run: yarn test --watchAll=false
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main, backend-dev, frontend-dev, release ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, backend-dev, frontend-dev, release ]
schedule:
- cron: '28 15 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
27 changes: 27 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Backend CI

on:
push:
branches: [ main, backend-dev, release ]
pull_request:
branches: [ main, backend-dev, release ]

jobs:
buildAndTest:
name: Build and Test Backend
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore
- name: Nuget Command
run: nuget restore backend/CarbonFootprintVisualization.sln
- name: Build
run: dotnet build backend/CarbonFootprintVisualization.sln --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
123 changes: 113 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# Carbon Footprint | AMOS Project 8
# Carbon Footprint Visualization | AMOS Project 8
## Software Build and Deployment Document

- [Introduction](#introduction)
- [Project Repository](#project-repository)
- [Current Dependencies:](#current-dependencies-)
- [Build Process](#build-process)
* [Setup and start the Frontend](#setup-and-start-the-frontend)
* [Setup and start of the Backend](#setup-and-start-of-the-backend)
+ [General](#general)
+ [Launching](#launching)
* [Testing](#testing)
* [CI/CD](#ci-cd)

# Introduction

This document describes how to build and deploy an application to visualize, compare and analyze the impacts such as global warming, ozone layer depletion, acidification, etc that come from the production, use, and end-of-life of a product or service. The carbon footprint is calculated in the application which helps the customers to understand the impacts and risks associated with it.
All the information that is essential to the build and deployment process is unfolded: how to build and verify the various deliverables, library dependencies, how to install and run the software, and the system requirements.


# Project Repository


## [Frontend](/frontend) Folder Structure

Expand Down Expand Up @@ -38,23 +59,105 @@
- details
- settings

- **/utilities**:
code that purely functional
- PdfReport.js: create the PDF report

## [Backend](/backend) Folder Structure

### base folder: [/backend](/backend):

## Current dependencies:
Includes the git files, Solution.sln, and a [project] folder for every [project].csproj.

[react-hook-form](https://www.npmjs.com/package/react-hook-form): form handling.
* **/backend**:
includes the general source code files for the backend project.

[react-jss](https://www.npmjs.com/package/react-jss): styles.
* **/backend/Controllers**:
includes source code files of the REST-API controllers that receive and handle the incoming HTTP requests.

[react-router-dom](https://www.npmjs.com/package/react-router-dom): routing.
* **/backend/Security**:
includes source code files that handle security-related issues.

[simple-flexbox](https://www.npmjs.com/package/simple-flexbox): flexbox utility.
* **/backend/Properties**:
includes the launch settings.

[react-grid-system](https://www.npmjs.com/package/react-grid-system): page layout
* **/Test**:
includes the source code files of the unit test project for the backend.

[react-apexcharts](https://www.npmjs.com/package/react-apexcharts): pie and column chart
# Current Dependencies:

## License
**Frontend**:

- [react-hook-form](https://www.npmjs.com/package/react-hook-form): form handling.

- [react-jss](https://www.npmjs.com/package/react-jss): styles.

- [react-router-dom](https://www.npmjs.com/package/react-router-dom): routing.

- [simple-flexbox](https://www.npmjs.com/package/simple-flexbox): flexbox utility.

- [react-grid-system](https://www.npmjs.com/package/react-grid-system): page layout

- [react-apexcharts](https://www.npmjs.com/package/react-apexcharts): pie and column chart

- [jsPDF](https://www.npmjs.com/package/jspdf): library to generate PDFs in JavaScript

- [jQuery](https://www.npmjs.com/package/jquery): JavaScript library for DOM operations

- [axios](https://www.npmjs.com/package/axios): frontend and backend connection

**Backend**:

This software is released under the MIT License
- [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/): JSON handling.

- [AspNetCore.Proxy](https://www.nuget.org/packages/AspNetCore.Proxy/): REST-API proxy.

- [xunit](https://www.nuget.org/packages/xunit/): Unit testing framework.

- [Moq](https://www.nuget.org/packages/moq/) Mocking framework.


# Build Process
## Setup and start the Frontend
* Clone the current project
* In a CLI navigate to the frontend folder
* Run yarn install to install all used dependencies
* Run yarn start to start the development server


## Setup and start of the Backend

### General
- For the backend to correctly proxy incoming HTTP requests to the SimaPro API and return the request results, it needs to receive valid SimaPro API credentials and base URL.
- In a hosting environment, these would be given by adding the following Key/Value Pairs to the environment variables:
- "BaseUrl": "https://apps.simapro.com/api/"
- "User": "[insert SimaPro User here]"
- "Password": "[insert SimaPro password here]"
- In a local environment, these will be added by including them as JSON Key/Value pairs in the secrets.json file of the backend project.

### Launching
- It is recommended to launch the backend in Visual Studio via IIS Express. The launch settings can be found in the launchSettings.json file in the [/Properties](/backend/backend/properties) folder.
- The launch settings specify the base URL for the REST-API of the backend. Currently these are "http://localhost:16294" (without SSL) and "https://localhost:44323" (with SSL).
These are determined by the key/value pairs with the keys "applicationUrl" and "sslPort" in the launchSettings.json
- The route of the proxy is determined in the Route annotation in the SimaProController.cs file. Currently the full URLs of the backend proxy for the SimaPro API is "https://localhost:44323/SimaPro/api".
- Once the Solution is running you can send requests to it via Postman, or use it to proxy incoming requests from the frontend.


## Testing

Frontend: Unit tests will automatically be executed by the CI pipeline.

Backend: Existing unit tests can be found, modified, and executed via the Test Project.

## CI/CD
Frontend:

Currently, there is no real deployment planned as this project is a proof-of-concept to show the end-to-end process of the described project.
However, a CI pipeline running implemented tests and building the software to allow fast feedback to the software developers when implementing features is in place.

Backend:
- The CI pipeline for the backend is configured in Github Actions as "Backend CI".
- The CI pipeline will execute the unit tests from the Test Project.

## License
This software is released under the [MIT License](https://github.com/amosproj/amos-ss2021-carbon-footprint/blob/main/LICENSE).
11 changes: 11 additions & 0 deletions amos-ss2021-carbon-footprint.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp5.0</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="backend" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions backend/backend.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp5.0</TargetFramework>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Backend.Controllers"/>
<PackageReference Include="Backend.Security"/>
</ItemGroup>
</Project>
Binary file not shown.
Binary file added deliverables/2021-05-26 Kanban Board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [["@babel/plugin-proposal-class-properties"]]
}
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

package-lock.json
Loading

0 comments on commit 5063ca8

Please sign in to comment.