Skip to content

Commit

Permalink
Merge pull request #806 from Green-Software-Foundation/release-v0.4.0…
Browse files Browse the repository at this point in the history
…-beta.0

Release v0.4.0-beta.0
  • Loading branch information
narekhovhannisyan authored Jun 11, 2024
2 parents 885fb3e + 48e3cef commit 6d0be43
Show file tree
Hide file tree
Showing 166 changed files with 9,351 additions and 497 deletions.
1 change: 0 additions & 1 deletion .commitlintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
'package',
'config',
'mocks',
'examples',
'.github',
'.husky',
'scripts',
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/release-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
create-release-commit:
needs: build
runs-on: ubuntu-latest
steps:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -41,27 +41,26 @@ jobs:

- name: Install dependencies
run: npm ci

- name: Initalize git user email
run: git config --global user.email "${{vars.RELEASE_USER_EMAIL}}"

- name: Initalize git user name
- name: Initialize git user email
run: git config --global user.email "${{ vars.RELEASE_USER_EMAIL }}"

- name: Initialize git user name
run: git config --global user.name "Release commit workflow"

- name: Create release branch
run: |
git checkout -b $PR_BRANCH_NAME
git push --set-upstream origin $PR_BRANCH_NAME
echo "branch=$PR_BRANCH_NAME" >> $GITHUB_ENV
- name: Bump version and push changes using release-it
run: |
npm run release -- --ci ${{github.event.release.tag_name}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
run: gh pr create -B ${{ github.event.repository.default_branch }} -H $PR_BRANCH_NAME --title "Release ${{github.event.release.tag_name}}" --body "${{github.event.release.body}}"
run: gh pr create -B release -H $PR_BRANCH_NAME --title "Release ${{github.event.release.tag_name}}" --body "${{github.event.release.body}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49 changes: 34 additions & 15 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- release

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,6 +14,7 @@ jobs:
node-version: 18
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
Expand All @@ -21,6 +23,7 @@ jobs:
uses: actions/checkout@v4
with:
ref: main

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -29,28 +32,44 @@ jobs:

- name: Install dependencies
run: npm ci
- name: Initalize git user email
run: git config --global user.email "${{env.RELEASE_USER_EMAIL}}"
- name: Initalize git user name

- name: Initialize git user email
run: git config --global user.email "${{ env.RELEASE_USER_EMAIL }}"

- name: Initialize git user name
run: git config --global user.name "Release publish workflow"

- name: Initialize npm config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Check if release is a pre-release
id: check_pre_release
run: echo "{name}=${{github.event.release.prerelease}}" >> $GITHUB_OUTPUT

- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release == 'true'
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Fetch latest release info
run: |
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases")
if [ $? -ne 0 ]; then
echo "Failed to fetch releases"
exit 1
fi
LATEST_RELEASE_NAME=$(echo "$RELEASE_JSON" | jq -r '.[0].name')
IS_PRE_RELEASE=$(echo "$RELEASE_JSON" | jq -r '.[0].prerelease')
echo "LATEST_RELEASE_NAME=$LATEST_RELEASE_NAME" >> $GITHUB_ENV
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
- name: Publish to npm (pre-release)
if: env.IS_PRE_RELEASE == 'true'
run: npm publish --tag beta
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to npm
if: steps.check_pre_release.outputs.is_pre_release != 'true'
if: env.IS_PRE_RELEASE == 'false'
run: npm publish
env:
GITHUB_TOKEN: ${{secrets.github_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 6 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
'*.ts': [
'gts lint',
],
'package.json': 'fixpack',
}
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
# Impact Framework

[![Node.js CI](https://github.com/Green-Software-Foundation/if/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/Green-Software-Foundation/if/actions/workflows/nodejs-ci.yml)

> [!IMPORTANT]
> Incubation Project: This project is an incubation project being run inside the Green Software Foundation; as such, we DON’T recommend using it in any critical use case. Incubation projects are experimental, offer no support guarantee, have minimal governance and process, and may be retired at any moment. This project may one day Graduate, in which case this disclaimer will be removed.
**Note** We have recently (March 2024) refactored the IF codebase and introduced some changes affecting both users and developers. You can read our migration guide [HERE](./Refactor-migration-guide.md) to help you update to the latest version!


[Impact Framework](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/17072136/Opensource+Impact+Engine+Framework) (IF) is an [Incubation](https://oc.greensoftware.foundation/project-lifecycle.html#incubation) project from the [Open Source Working Group](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/852049/Open+Source+Working+Group) in the [Green Software Foundation](https://greensoftware.foundation/).


**Our documentation is online at [if.greensoftware.foundation](https://if.greensoftware.foundation/)**


**IF** is a framework to **M**odel, **M**easure, si**M**ulate and **M**onitor the environmental impacts of software

Modern applications are composed of many smaller pieces of software (components) running on many different environments, for example, private cloud, public cloud, bare-metal, virtualized, containerized, mobile, laptops, and desktops.

Every environment requires a different plugin of measurement, and there is no single solution you can use to calculate the environmental impacts for all components across all environments.
Every environment requires a different plugin of measurement, and there is no single solution you can use to calculate the environmental impacts for all components across all environments.

The friction to measuring software emissions isn't that we need to know how, it's that we run software on many things and each thing has several different ways to measure.

Read the [specification and design docs](https://if.greensoftware.foundation) to begin.


## Get started

The first thing to understand is that IF is a framework for running plugins. This means that in order to do some calculations, you need to load some plugins from some external resource. We provide a [standard library of plugins](https://github.com/Green-Software-Foundation/if-plugins) and a repository of [community plugins](https://github.com/Green-Software-Foundation/if-unofficial-plugins) to get you started.
The first thing to understand is that IF is a framework for running plugins. This means that in order to do some calculations, you need to load some plugins from some external resource. We provide a [standard library of plugins](https://github.com/Green-Software-Foundation/if-plugins) and a repository of [community plugins](https://github.com/Green-Software-Foundation/if-unofficial-plugins) to get you started.

Start by installing framework itself:

```sh
npm install -g "@grnsft/if"
```

Then installing some plugins:

```sh
Expand All @@ -50,6 +48,7 @@ ie -m <path-to-your-manifest-file>
```

Note that above command will not print the final output. In order to print the final output to the console, run `if` using the optional stdout argument:

```sh
ie --manifest <path-to-your-manifest-file> --stdout
## or using aliases
Expand All @@ -74,6 +73,12 @@ ie -m <path-to-your-manifest-file> -o <your-savepath>

The `ie` CLI tool will configure and run the plugins defined in your input `yaml` (`manifest`) and return the results as an output `yaml` (`output`).

Use the `debug` command if you want to diagnose and fix errors in your plugin:

```sh
ie --manifest <path-to-your-manifest-file> --debug
```

Use the `help` command if you need guidance about the available commands

```sh
Expand All @@ -92,10 +97,9 @@ Watch this video to learn how to create and run a `manifest`.

[![Watch the walk-through video](https://i3.ytimg.com/vi/R-6eDM8AsvY/maxresdefault.jpg)](https://youtu.be/GW37Qd4AQbU)


## Contributing

To contribute to IF, please fork this repository and raise a pull request from your fork.
To contribute to IF, please fork this repository and raise a pull request from your fork.

You can check our issue board for issues tagged `help-wanted`. These are issues that are not currently, actively being worked on by the core team but are well-scoped enough for someone to pick up. We recommend commenting on the issue to start a chat with the core team, then start working on the issue when you have been assigned to it. This process helps to ensure your work is aligned with our roadmap and makes it much more likely that your changes will get merged compared to unsolicited PRs.

Expand Down
12 changes: 6 additions & 6 deletions Refactor-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ There have also been some changes to the structure of manifest files. Some of th
For example:
```yaml
"sci-m":
path: "@grnsft/if-plugins"
method: SciM
"sci-embodied":
path: "builtin"
method: SciEmbodied
```
- **Global config**
Expand Down Expand Up @@ -150,7 +150,7 @@ There have also been some changes to the structure of manifest files. Some of th
pipeline:
- teads-curve
- sci-e
- sci-m
- sci-embodied
- sci-o
- time-sync
- sci
Expand All @@ -174,7 +174,7 @@ There have also been some changes to the structure of manifest files. Some of th
pipeline:
- teads-curve
- sci-e
- sci-m
- sci-embodied
- sci-o
- time-sync
- sci
Expand Down Expand Up @@ -254,7 +254,7 @@ tree:
pipeline:
- teads-curve
- sci-e
- sci-m
- sci-embodied
- sci-o
- time-sync
- group-by
Expand Down
58 changes: 16 additions & 42 deletions github-processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

- [`if`](https://github.com/Green-Software-Foundation/if)
- source code for the IF
- [`if-plugins`](https://github.com/Green-Software-Foundation/if-plugins)
- [`if-plugins`](https://github.com/Green-Software-Foundation/if-plugins) **DEPRECATED**
- source code for standard library of plugins
- IF core team commit to maintaining these plugins
- [`if-unofficial-plugins`](https://github.com/Green-Software-Foundation/if-unofficial-plugins)
Expand Down Expand Up @@ -110,47 +110,21 @@ We intend to respond to new PRs and issues within 3 days of the ticket being ope

## Labels

```
//review status labels
awaiting-triage
triage-pass
awaiting-review
review-pass
awaiting-qa
qa-pass
changes-needed
//change type labels
fix
feature
docs
package
other
// size labels
small
medium
large
// priority labels
high-priority
med-priority
low-priority
//delay explanation labels
abandoned
blocked
backlogged
// other labels
project-management
agenda
discussion
help-wanted
good-first-issue
```

Each PR is expected to have one label from each category (except `other`) assigned to it at all times.
| Label | Used by | Description |
| ---------------- | --------- | ------------------------------------------------------------------------------------------ |
| blocked | all | The issue is blocked and cannot proceed. |
| bug | all | Error, flaw or fault |
| core-only | all | This issue is reserved for the IF core team only |
| draft | all | The issue is still being written, no need to respond or action on anything. |
| good-first-issue | all | This issue is a good one for someone looking to get involved with this project/initiative. |
| help-wanted | all | This issue can be picked up by anyone in the community |
| needs-response | all | The issue has stalled because someone isn’t responding. |
| agenda | core team | Use for any meeting agenda or minutes issue. |
| EPIC | core team | Used to denote an issue that represents a whole epic |
| initiative | core team | A helper label, needed for GSF internal processes |
| i-summary | core team | A helper label, needed for GSF internal processes |
| i-milestone | core team | A helper label, needed for GSF internal processes |
| project-update | core team | Used to flag project progress updates |


## Releases
Expand Down
12 changes: 6 additions & 6 deletions manifests/bugs/aggregation-error-wrong-metric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ initialize:
"sci-e":
path: "@grnsft/if-plugins"
method: SciE
"sci-m":
path: "@grnsft/if-plugins"
method: SciM
"sci-embodied":
path: "builtin"
method: SciEmbodied
"sci-o":
path: "@grnsft/if-plugins"
method: SciO
"sci":
path: "@grnsft/if-plugins"
path: "builtin"
method: Sci
global-config:
functional-unit: "requests"
Expand All @@ -44,7 +44,7 @@ tree:
pipeline:
- teads-curve
- sci-e
- sci-m
- sci-embodied
- sci-o
- time-sync
- sci
Expand Down Expand Up @@ -87,7 +87,7 @@ tree:
pipeline:
- teads-curve
- sci-e
- sci-m
- sci-embodied
- sci-o
- time-sync
- sci
Expand Down
6 changes: 3 additions & 3 deletions manifests/bugs/azure-importer-ignoring-defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ initialize:
method: AzureImporter
path: "@grnsft/if-unofficial-plugins"
"try-defaults-1":
path: "@grnsft/if-plugins"
path: "builtin"
method: Coefficient
global-config:
input-parameter: grid/carbon-intensity
coefficient: 0.1
output-parameter: grid/carbon-intensity
"try-defaults-2":
path: "@grnsft/if-plugins"
path: "builtin"
method: Coefficient
global-config:
input-parameter: network/energy
Expand Down Expand Up @@ -58,4 +58,4 @@ tree:
inputs:
- timestamp: "2024-04-04T08:00:00.001Z"
duration: 3600
energy: 100
energy: 100
Loading

0 comments on commit 6d0be43

Please sign in to comment.