Skip to content

Commit 3310d86

Browse files
Merge pull request #113 from Green-Software-Foundation/dev
Release 1.0 PR to Main for Official Release. Thank you to all involved. This is only the beginning of a more sustainable future! 💚
2 parents ada4c8c + 5eff3dc commit 3310d86

File tree

267 files changed

+18538
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+18538
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0
2+
3+
RUN apt-get update
4+
5+
RUN apt-get install -y iputils-ping procps
6+
7+
RUN echo Installing Code Generator CLI
8+
9+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
10+
RUN apt-get install -y nodejs build-essential default-jre
11+
RUN npm install @openapitools/openapi-generator-cli -g
12+
13+
RUN echo Done!
14+

.devcontainer/devcontainer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Dev Container",
3+
"dockerFile": "Dockerfile",
4+
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
5+
6+
// Use 'settings' to set *default* container specific settings.json values on container create.
7+
// You can edit these settings after create using File > Preferences > Settings > Remote.
8+
// "settings": {
9+
// "terminal.integrated.shell.linux": "/bin/bash",
10+
// "lldb.executable": "/usr/bin/lldb"
11+
// },
12+
13+
// Use 'appPort' to create a container with published ports. If the port isn't working, be sure
14+
// your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost.
15+
// "appPort": [],
16+
17+
// Uncomment the next line to run commands after the container is created.
18+
// "postCreateCommand": "rustc --version",
19+
20+
// Comment out the next line to run as root
21+
// "remoteUser": "vscode",
22+
23+
// Uncomment the line below to mount your local usersecrets into the devcontainer from a Windows OS
24+
// "mounts": [ "source=${localEnv:APPDATA}/Microsoft/UserSecrets,target=/root/.microsoft/usersecrets,type=bind" ],
25+
26+
// Uncomment the line below to mount your local usersecrets into the devcontainer from a Mac/Linux OS
27+
// "mounts": [ "source=${localEnv:HOME}/.microsoft/usersecrets,target=/root/.microsoft/usersecrets,type=bind" ],
28+
29+
// Add the IDs of extensions you want installed when the container is created in the array below.
30+
"extensions": [
31+
"ms-dotnettools.csharp"
32+
]
33+
}

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# Setting build up so that license changes and CODEOWNERS changes
5+
# require admin approval.
6+
7+
* @vaughanknight

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: input
11+
id: contact
12+
attributes:
13+
label: Contact Details
14+
description: How can we get in touch with you if we need more info?
15+
placeholder: ex. [email protected]
16+
validations:
17+
required: false
18+
- type: textarea
19+
id: what-happened
20+
attributes:
21+
label: What happened?
22+
description: Also tell us, what did you expect to happen?
23+
placeholder: Tell us what you see!
24+
value: "A bug happened!"
25+
validations:
26+
required: true
27+
- type: dropdown
28+
id: client
29+
attributes:
30+
label: client
31+
description: What client of the Carbon Aware SDK are you running?
32+
options:
33+
- WebAPI (Default)
34+
- CLI
35+
validations:
36+
required: true
37+
- type: textarea
38+
id: logs
39+
attributes:
40+
label: Relevant log output
41+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
42+
render: shell
43+
- type: checkboxes
44+
id: terms
45+
attributes:
46+
label: Code of Conduct
47+
description: By submitting this issue, you agree to follow the [Way We Work](https://github.com/Green-Software-Foundation/standards_wg/blob/main/the_way_we_work.md)
48+
options:
49+
- label: I agree to follow this project's Code of Conduct
50+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Green Software Foundation Membership Enquiries
4+
url: https://greensoftware.foundation/join-us/
5+
about: Join the Green Software Foundation
6+
- name: Carbon Aware SDK Project Proposal
7+
url: https://greensoftware.foundation/projects/carbon-aware-sdk
8+
about: GSF Page on Carbon Aware SDK
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Feature Contribution
2+
description: Contribute a Feature
3+
title: "[Feature Contribution]: "
4+
labels: ["feature", "triage"]
5+
assignees:
6+
- vaughanknight
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Thank you for wanting to contribute to the Carbon Aware SDK! Please fill out this Issue Template with your feature contribution.
12+
- type: textarea
13+
id: feature-desc
14+
attributes:
15+
label: What happened?
16+
description: Please Describe the need for the feature
17+
placeholder: User stories, feature specifications, contribution benefits.
18+
value: "Feature XYZ will perform function ABC and enable development for project 123."
19+
validations:
20+
required: true
21+
- type: checkboxes
22+
id: terms
23+
attributes:
24+
label: Code of Conduct
25+
description: By submitting this issue, you agree to follow the [Way We Work](https://github.com/Green-Software-Foundation/standards_wg/blob/main/the_way_we_work.md)
26+
options:
27+
- label: I agree to follow this project's Code of Conduct
28+
required: true
29+
- type: checkboxes
30+
id: commitment
31+
attributes:
32+
label: Feature Commitment
33+
description: By submitting this issue, you commit to contributing the feature outlined here.
34+
options:
35+
- label: I commit to contributing this feature as a PR and working with the GSF to merge this feature into the Carbon Aware SDK.
36+
required: true
37+

.github/codecov.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
codecov:
2+
require_ci_to_pass: no
3+
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: "70...100"
8+
9+
parsers:
10+
gcov:
11+
branch_detection:
12+
conditional: yes
13+
loop: yes
14+
method: no
15+
macro: no
16+
17+
comment:
18+
layout: "reach,diff,flags,files"
19+
behavior: default
20+
require_changes: no

.github/pull_request_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Issue Number: (Link to Github Issue or Azure Dev Ops Task/Story)
2+
3+
## Summary
4+
One sentence summary of PR
5+
6+
## Changes
7+
8+
- List of comprehensive changes
9+
10+
## Checklist
11+
12+
- [ ] Local Tests Passing?
13+
- [ ] CICD and Pipeline Tests Passing?
14+
- [ ] Added any new Tests?
15+
- [ ] Documentation Updates Made?
16+
- [ ] Are there any API Changes? If yes, please describe below.
17+
- [ ] This is not a breaking change. If it is, please describe it below.
18+
19+
## Are there API Changes?
20+
If yes, what are the expected API Changes? Please link to an API-Comparison workflow with the API Diff.
21+
22+
## Is this a breaking change?
23+
If yes, what workflow does this break?
24+
25+
## Anything else?
26+
Other comments, collaborators, etc.
27+
This PR Closes Issue #
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: BUILD CLI in DOTNET
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/**'
7+
- '.github/workflows/**'
8+
pull_request:
9+
branches: [ dev, main ]
10+
paths:
11+
- 'src/**'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
working-directory: ./src
19+
steps:
20+
21+
- uses: actions/checkout@v2
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v1
24+
with:
25+
dotnet-version: 6.0.x
26+
27+
- name: Restore dependencies
28+
run: dotnet restore
29+
30+
- name: Build
31+
run: dotnet build --no-restore
32+
33+
- name: Unit Tests
34+
run: dotnet test --no-build --verbosity normal

.github/workflows/build-webapi.yaml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Docker Web API Build
2+
3+
on:
4+
push:
5+
branches: [ dev, main ]
6+
pull_request:
7+
branches: [ dev, main ]
8+
paths:
9+
- 'src/**'
10+
- '.github/workflows/**'
11+
12+
env:
13+
DOCKERFILE_PATH: "CarbonAware.WebApi/src/Dockerfile"
14+
HEALTH_ENDPOINT: "0.0.0.0:8080/health"
15+
DATA_ENDPOINT: "0.0.0.0:8080/emissions/bylocation?location=eastus"
16+
DLL_FILE_PATH: "./bin/Release/net6.0/CarbonAware.WebApi.dll"
17+
DOTNET_SRC_DIR: "./src"
18+
19+
jobs:
20+
container-dotnet-build:
21+
runs-on: ubuntu-latest
22+
container:
23+
image: mcr.microsoft.com/dotnet/sdk:6.0
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Setup .NET Core SDK 6
28+
uses: actions/setup-dotnet@v2
29+
with:
30+
dotnet-version: '6.0.x'
31+
include-prerelease: false
32+
33+
- name: Install dependencies
34+
run: dotnet restore
35+
working-directory: ${{ env.DOTNET_SRC_DIR }}
36+
37+
- name: Install tools
38+
run: dotnet tool restore
39+
working-directory: ${{ env.DOTNET_SRC_DIR }}/CarbonAware.WebApi/src
40+
41+
- name: Build
42+
run: dotnet build --configuration Release --no-restore
43+
working-directory: ${{ env.DOTNET_SRC_DIR }}
44+
45+
- name: Unit Test + Code Coverage
46+
run: dotnet test --filter TestCategory=Unit --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=json
47+
working-directory: ${{ env.DOTNET_SRC_DIR }}
48+
49+
- name: Integration Test + Code Coverage
50+
run: dotnet test --filter TestCategory=Integration --no-restore --verbosity normal /p:CollectCoverage=true /p:MergeWith=\"./coverage.json\" /p:CoverletOutputFormat=\"json,opencover\"
51+
working-directory: ${{ env.DOTNET_SRC_DIR }}
52+
53+
- name: Codecov
54+
uses: codecov/codecov-action@v2
55+
with:
56+
directory: ${{ env.DOTNET_SRC_DIR }}
57+
58+
- name: Generate Open API
59+
run: dotnet tool run swagger tofile --output ./api/v1/swagger.yaml --yaml ${{ env.DLL_FILE_PATH }} v1
60+
working-directory: ./src/CarbonAware.WebApi/src
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v1
64+
with:
65+
name: pr-swagger.yaml
66+
path: src/CarbonAware.WebApi/src/api/v1/swagger.yaml
67+
68+
container-validation:
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout Repository
72+
uses: actions/checkout@v2
73+
74+
- name: Docker Target Final
75+
run: docker build . -f ${DOCKERFILE_PATH} -t ca-api
76+
working-directory: ./src
77+
78+
- name: Docker Run Container
79+
run: |
80+
docker run -d --name runnable-container -p 8080:80 ca-api
81+
docker container ls
82+
83+
- name: Docker WGET Health Endpoint
84+
run: |
85+
wget -t 5 --waitretry=5 ${HEALTH_ENDPOINT}
86+
87+
- name: Docker WGET Data Endpoint
88+
run: |
89+
wget -t 5 --waitretry=5 ${DATA_ENDPOINT}
90+
91+
api-comparison:
92+
needs: container-dotnet-build
93+
runs-on: ubuntu-latest
94+
defaults:
95+
run:
96+
working-directory: ./src/CarbonAware.WebApi/src
97+
container:
98+
image: mcr.microsoft.com/dotnet/sdk
99+
steps:
100+
- name: Checkout Dev Branch
101+
uses: actions/checkout@v3
102+
with:
103+
ref: dev
104+
- name: Setup .NET Core SDK 6
105+
uses: actions/setup-dotnet@v2
106+
with:
107+
dotnet-version: '6.0.x'
108+
include-prerelease: false
109+
- name: Install dependencies
110+
run: dotnet restore
111+
working-directory: ${{ env.DOTNET_SRC_DIR }}
112+
- name: Install tools
113+
run: dotnet tool restore
114+
- name: Build
115+
run: dotnet build --configuration Release --no-restore
116+
working-directory: ${{ env.DOTNET_SRC_DIR }}
117+
- name: Generate Open API
118+
run: dotnet tool run swagger tofile --output ./api/v1/swagger.yaml --yaml ${{ env.DLL_FILE_PATH }} v1
119+
- name: Upload dev artifact
120+
uses: actions/upload-artifact@v1
121+
with:
122+
name: dev-swagger.yaml
123+
path: src/CarbonAware.WebApi/src/api/v1/swagger.yaml
124+
- uses: actions/download-artifact@v3
125+
with:
126+
name: pr-swagger.yaml
127+
path: ./src/CarbonAware.WebApi/src/api/v1/pr-swagger.yaml
128+
- name: API Diff Comparison
129+
run: |
130+
diff ./api/v1/pr-swagger.yaml ./api/v1/swagger.yaml && echo "No API Changes detected" || echo "::warning:: API Changed"

0 commit comments

Comments
 (0)