Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
darshanjain12 committed May 27, 2024
2 parents 3b53f7a + 42e94bc commit 832e1f6
Show file tree
Hide file tree
Showing 447 changed files with 25,397 additions and 9,009 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.git/
ontology/docs
/tools/**/build
/tools/**/dist
/tools/**/*.egg-info*
**/venv/**
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-ticket.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ assignees: ''

---

**IMPORTANT**
DO NOT INCLUDE ANY PROJECT-SPECIFIC INFORMATION IN THIS TICKET!
ANY PROJECT-SPECIFIC CONTEXT (E.G. BUILDING CONFIG INPUTS) SHOULD BE
EMAILED DIRECTLY TO: [email protected]

PLEASE REFERENCE THIS ISSUE LINK IN YOUR EMAIL TO THAT GROUP

**Describe the bug**
A clear and concise description of what the bug is.

Expand All @@ -28,3 +35,5 @@ OS where the bug is reported (ubuntu, macos, windows, or others)

**Additional context**
Add any other context about the problem here.


File renamed without changes.
40 changes: 0 additions & 40 deletions .github/workflows/OntologyTypeValidator.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/OntologyValidator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This workflow adds guids to any newly added entity types in the ontology and validates the ontology
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Ontology Validator

on:
push:
branches: [ master ]
paths:
- ontology/yaml/**

pull_request:
branches: [ master ]
paths:
- ontology/yaml/**

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the branch the PR is coming from if PR
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Checkout head if push
if: github.event_name == 'push'
uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: '3.11'

- name: Install dependencies for ontology YAML validator
run: |
python setup.py install
working-directory: ./tools/validators/ontology_validator

### Only generate type guids if triggered by a push ###

- name: Get modified entity type files
id: changed-entity-type-files
if: github.event_name == 'push'
uses: tj-actions/changed-files@v41
with:
files: '**/ontology/yaml/**/entity_types/*.yaml'

- name: Run types GUID generator if any entity types files are changed
if: github.event_name == 'push' && steps.changed-entity-type-files.outputs.any_changed == 'true'
run: |
python setup.py install
for file in ${{ steps.changed-entity-type-files.outputs.all_changed_files }}; do
python types_guid_generator/types_guid_generator.py -f=../../../$file
done
working-directory: ./tools/guid_generator/ontology

- name: Commit files changed by types GUID generator
if: github.event_name == 'push' && steps.changed-entity-type-files.outputs.any_changed == 'true'
uses: EndBug/add-and-commit@v9
with:
author_name: db-robot
author_email: [email protected]
message: 'Add GUIDs to new entity types'

- name: Run ontology YAML validator with type guid checks if push
if: github.event_name == 'push'
run: |
python validator.py --original=../../../../ontology/yaml/resources --interactive=False
working-directory: ./tools/validators/ontology_validator/yamlformat

### End of type guid generation ###

- name: Run ontology YAML validator without type guid checks if PR
if: github.event_name == 'pull_request'
run: |
python validator.py --original=../../../../ontology/yaml/resources --interactive=False --allow_missing_type_guids
working-directory: ./tools/validators/ontology_validator/yamlformat
60 changes: 44 additions & 16 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ jobs:
- 'tools/abel/**'
explorer:
- 'tools/explorer/**'
guid_generator:
- 'tools/guid_generator/**'
instance_guid_generator:
- 'tools/guid_generator/instance/**'
ontology_guid_generator:
- 'tools/guid_generator/ontology/**'
instance_validator:
- 'tools/validators/instance_validator/**'
rdf_generator:
Expand All @@ -40,10 +42,10 @@ jobs:
- 'tools/validators/ontology_validator/**'
scoring:
- 'tools/scoring/**'
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Pylint
run: |
python -m pip install pylint
Expand Down Expand Up @@ -72,11 +74,21 @@ jobs:
if: steps.changes.outputs.instance_validator == 'true'
run: |
pylint --rcfile ./styles/pylintrc ./tools/validators/instance_validator
- name: Instance Yaml Validator Tests
- name: Instance Yaml Validator Unit Tests
if: steps.changes.outputs.instance_validator == 'true' || steps.changes.outputs.type_validator == 'true'
run: |
python -m unittest discover -p '*_test.py' --failfast -v
working-directory: ./tools/validators/instance_validator
- name: Instance Yaml Validator Integraion Test
if: steps.changes.outputs.instance_validator == 'true' || steps.changes.outputs.type_validator == 'true'
run: |
python instance_validator.py -i ../../abel/tests/test_resources/good_test_building_config.yaml
working-directory: ./tools/validators/instance_validator

- name: Correct Ontology Descriptions
run: |
pip install -r tools/spellcheck/requirements.txt
python tools/spellcheck/spellcheck.py
#---------- ABEL ----------#
- name: ABEL install dependencies
Expand All @@ -88,27 +100,43 @@ jobs:
if: steps.changes.outputs.abel == 'true'
run: |
pylint --rcfile ./styles/pylintrc ./tools/abel
- name: ABEL Tests
- name: ABEL Unit Tests
if: steps.changes.outputs.abel == 'true' || steps.changes.outputs.instance_validator == 'true' || steps.changes.outputs.type_validator == 'true'
run: |
python -m unittest discover -p '*_test.py' --failfast -v
working-directory: ./tools/abel

#---------- GUID Generator ----------#
- name: GUID Generator Install dependencies
if: steps.changes.outputs.guid_generator == 'true' || steps.changes.outputs.instance_validator == 'true'
#---------- Instance GUID Generator ----------#
- name: Instance GUID Generator Install dependencies
if: steps.changes.outputs.instance_guid_generator == 'true' || steps.changes.outputs.instance_validator == 'true'
run: |
python setup.py install
working-directory: ./tools/guid_generator/instance
- name: Run pylint on Instance GUID Generator
if: steps.changes.outputs.instance_guid_generator == 'true'
run: |
pylint --rcfile ./styles/pylintrc ./tools/guid_generator/instance
- name: Instance GUID Generator Tests
if: steps.changes.outputs.instance_guid_generator == 'true' || steps.changes.outputs.instance_validator == 'true'
run: |
python -m unittest discover -p '*_test.py' --failfast -v
working-directory: ./tools/guid_generator/instance

#---------- Ontology GUID Generator ----------#
- name: Ontology GUID Generator Install dependencies
if: steps.changes.outputs.ontology_guid_generator == 'true' || steps.changes.outputs.type_validator == 'true'
run: |
python setup.py install
working-directory: ./tools/guid_generator
- name: Run pylint on GUID Generator
if: steps.changes.outputs.guid_generator == 'true'
working-directory: ./tools/guid_generator/ontology
- name: Run pylint on Ontology GUID Generator
if: steps.changes.outputs.ontology_guid_generator == 'true'
run: |
pylint --rcfile ./styles/pylintrc ./tools/guid_generator
- name: GUID Generator Tests
if: steps.changes.outputs.guid_generator == 'true' || steps.changes.outputs.instance_validator == 'true'
pylint --rcfile ./styles/pylintrc ./tools/guid_generator/ontology
- name: Ontology GUID Generator Tests
if: steps.changes.outputs.ontology_guid_generator == 'true' || steps.changes.outputs.type_validator == 'true'
run: |
python -m unittest discover -p '*_test.py' --failfast -v
working-directory: ./tools/guid_generator
working-directory: ./tools/guid_generator/ontology

#---------- RDF Generator ----------#
- name: RDF Generator Install dependencies
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/type_guid_generator.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
*.DS_Store
package-lock.json
yarn.lock
venv/
27 changes: 18 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ just a few small guidelines you need to follow.
## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
Agreement (CLA). You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
Expand All @@ -27,16 +27,25 @@ information on using pull requests.
This project follows
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).

## Pull requests
## Pull Requests

If you are Google partner, please make sure not to add sensitive data on github when:
* Extending the ontology types through a pull request
If you are Google partner, please make sure not to add sensitive data on GitHub when performing the following actions:
* Extending the ontology types through a pull request
* Opening an issue
* Asking a question

Sensitive data is one of the following:
* Building names or their locations, same applied for floors, rooms and zones.
* Indentifiers such as project id, subscription names
* Equipment names and their locations.
* Others
Sensitive data is considered anything in any of the following categories:
* **Buildings:** name, location, street address, information about floors/rooms/zones within the building, etc.
* **Devices/Equipment:** name, id, location, etc.
* **Other:** project id, subscription names, etc.

### Enabling Auto-GUID Generation for PRs
1. In your individual fork, navigate to `Settings > Actions > General` and ensure your settings under each header are as follows:
* Under “Actions Permissions,” please select “Allow all actions and reusable workflows”
* Under “Workflow Permissions,” please select “Read and write permissions” and check the box next to “Allow GitHub Actions to create and approve pull requests”

2. Click the gray “Save” button at the bottom of the page to preserve the changes

3. Once your Settings are saved, in your individual fork, navigate to `Actions`
* Click the green button that says “I understand my workflows, go ahead and enable them” to fully enable (if you do not see this button, it is likely the workflows are already enabled and no further action is required)

6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.10
WORKDIR /source
COPY . /source
RUN /source/tools/scripts/docker_setup.sh
WORKDIR /work
ENTRYPOINT ["/source/tools/scripts/docker_entry.sh"]
4 changes: 1 addition & 3 deletions LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
```

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -188,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2023 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -201,4 +200,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
Loading

0 comments on commit 832e1f6

Please sign in to comment.