Skip to content

Commit 9840efd

Browse files
authored
Merge pull request #110 from BuildingSync/develop
Prep release 1.1.3
2 parents 3d9a195 + 32bc2a7 commit 9840efd

File tree

70 files changed

+78154
-702
lines changed

Some content is hidden

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

70 files changed

+78154
-702
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
tox_env: [python, flake8]
13+
services:
14+
postgres:
15+
image: postgres:9.6
16+
env:
17+
POSTGRES_PASSWORD: postgres
18+
POSTGRES_DB: bsync_validator
19+
# Set health checks to wait until postgres has started
20+
options: >-
21+
--health-cmd pg_isready
22+
--health-interval 10s
23+
--health-timeout 5s
24+
--health-retries 5
25+
ports:
26+
- 5432:5432
27+
steps:
28+
- uses: actions/checkout@v2
29+
-
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.6'
33+
-
34+
name: Display system info
35+
run: python -c "import sys; print(sys.version)"
36+
-
37+
name: Setup Python
38+
run: |
39+
apt-get update && apt-get install python-enchant -y
40+
pip install tox
41+
pip install --upgrade pip
42+
pip install tox coveralls
43+
-
44+
name: Run tox
45+
env:
46+
DJANGO_SETTINGS_MODULE: bsyncviewer.settings.gh_actions
47+
run: tox -e ${{ matrix.tox_env }}
48+
-
49+
name: Coveralls
50+
if: ${{ success() && matrix.tox_env == 'python' }}
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: coveralls --service=github

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ use_case_file_*
9494
mapping_template*
9595
template_*
9696
bedes-mappings-*.csv
97-
bsyncviewer/lib/bedes/v2.2/schema0.0.1/
9897
bsyncviewer/lib/bedes/*/schema*/bedes-mappings-enumerations.csv
9998
bsyncviewer/lib/bedes/*/schema*/bedes-mappings-terms.csv
10099
bsyncviewer/lib/bedes/*/schema*/bsync_unique_words.csv

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# BuildingSync Use Case Selection Tool
22

3+
## Version 1.1.3
4+
5+
Date Range: 06/03/20 - 06/15/21
6+
7+
Updates:
8+
9+
- Renamed master to main
10+
- Install testsuite from PyPi
11+
- Bump lxml to 4.6.2
12+
- BSync version 2.3.0 with updated example files
13+
- Django 2.2.20
14+
- Backup Script
15+
- Add L200 audit example file
16+
- Accept Zip of BuildingSync files for validation
17+
318
## Version 1.1.2
419

520
Date Range: 03/26/20 - 06/02/20

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BuildingSync Schema Viewer and Validator
22

3-
[![Build Status](https://travis-ci.org/BuildingSync/selection-tool.svg?branch=develop)](https://travis-ci.org/BuildingSync/selection-tool)
3+
[![Build Status](https://github.com/BuildingSync/selection-tool/workflows/CI/badge.svg)](https://github.com/BuildingSync/selection-tool)
44

55
This is the repository for the BuildingSync Validator web application.
66

@@ -11,7 +11,7 @@ This is the repository for the BuildingSync Validator web application.
1111
```bash
1212
pyenv install 3.6.5
1313
pyenv virtualenv 3.6.5 bsync-validator-3.6.5
14-
pyenv local bsync-validator-3.6.3
14+
pyenv local bsync-validator-3.6.5
1515
```
1616
1. Install PostgreSQL server for local development (if desired)
1717
* Once installed, create your local database and user:
@@ -53,6 +53,8 @@ This is the repository for the BuildingSync Validator web application.
5353
python manage.py reset_schema --schema_version=1.0.0
5454
```
5555

56+
**NOTE**: You will need to be off the NREL VPN to import a schema, otherwise you'll get an error related to http://www.gbxml.org/schema}Area' as the gbxml schema cannot be imported when on the NREL VPN.
57+
5658
### Precommit
5759

5860
This project used `pre-commit <https://pre-commit.com/>`_ to ensure code consistency. To enable pre-commit, run the following from the command line.
@@ -96,7 +98,7 @@ tox -e flake8
9698

9799
The BuildingSync Schema Viewer can support multiple versions of the BuildingSync schema. Admin users can manage schemas from the Django Administration console. Click on the 'Admin' link in the top navigation bar to access the Django Administration pages.
98100

99-
To add a schema, specify the name, version, and schema file (XSD) to parse and save the record. The schema file will be parsed automatically.
101+
To add a schema, specify the name, version, and schema file (XSD) to parse and save the record. The schema file will be parsed automatically. **NOTE**: You will need to be off the NREL VPN to import a schema, otherwise you'll get an error related to http://www.gbxml.org/schema}Area' as the gbxml schema cannot be imported when on the NREL VPN.
100102

101103
To modify an existing schema, click on the edit link. If changes are made to the uploaded XSD schema file and re-uploaded, ensure that the 'schema parsed' checkbox is unchecked before saving the record. This will trigger the automatic schema parsing.
102104

@@ -285,9 +287,9 @@ Follow these steps to add new example tables from the TestSuite repo
285287
286288
### Adding an OpenStudio Simulation Use Case from the TestSuite repo
287289
288-
1. The relevant files are currently on the L000_Schematron branch of the [TestSuite](https://github.com/BuildingSync/TestSuite/tree/L100_Schematron) repo. Clone the repo locally.
289-
1. OpenStudio Simulation use case schematron files include patterns from a [library of schematron files](https://github.com/BuildingSync/TestSuite/tree/L100_Schematron/lib). Copy these files from the TestSuite repo into the selection-tool at the following location: ```bsyncviewer/testsuitelib```.
290-
1. Open the relevant use case file from the TestSuite repo. For example: [L00_OpenStudio_Simulation.sch](https://github.com/BuildingSync/TestSuite/blob/L100_Schematron/spec/use_cases/schema2.0.0/L000_OpenStudio_Simulation.sch). Edit the include statements at the top of the file with relative paths to the selection-tool testsuitelib directory. Save the file.
290+
1. The relevant files are currently on the `develop` branch of the [TestSuite](https://github.com/BuildingSync/TestSuite/tree/develop) repo. Clone the repo locally.
291+
1. OpenStudio Simulation use case schematron files include patterns from a [library of schematron files](https://github.com/BuildingSync/TestSuite/tree/develop/lib). Copy these files from the TestSuite repo into the selection-tool at the following location: ```bsyncviewer/testsuitelib```.
292+
1. Open the relevant use case file from the TestSuite repo. For example: [L00_OpenStudio_Simulation.sch](https://github.com/BuildingSync/TestSuite/blob/develop/schematron/v2.2.0/v2-2-0_L000_OpenStudio_Simulation.sch). Edit the include statements at the top of the file with relative paths to the selection-tool testsuitelib directory. Save the file.
291293
```bash
292294
<include href="../../testsuitelib/rootElements.sch#root.oneOfEachUntilBuilding"/>
293295
<include href="../../testsuitelib/rootElements.sch#root.oneOfEachFacilityUntilScenario"/>
@@ -303,5 +305,5 @@ Follow these steps to add new example tables from the TestSuite repo
303305
1. Upload the file that was modified in the previous step
304306
1. Save
305307
1. Make the use case public from the selection-tool admin interface.
306-
1. If you have any example files to add to the selection-tool (for example, for the L000 OpenStudio Simulation use case, there are [2 examples files](https://github.com/BuildingSync/TestSuite/tree/L100_Schematron/spec/use_cases/schema2.0.0/examples)), add them in the appropriate schema directory in ```bsyncviewer/lib/validator/examples```. Regenerate the ```example_files.zip``` archive. This will make the files available as examples at the ```/validator``` URL.
308+
1. If you have any example files to add to the selection-tool (for example, for the L000 OpenStudio Simulation use case, there are [2 examples files](https://github.com/BuildingSync/TestSuite/tree/develop/spec/use_cases/schema2.0.0/examples)), add them in the appropriate schema directory in ```bsyncviewer/lib/validator/examples```. Regenerate the ```example_files.zip``` archive. This will make the files available as examples at the ```/validator``` URL.
307309
1. You can now validate XMLs against the new use case.

backup_database.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# This backup script creates nightly database and media file backups of the Selection Tool when running
4+
# in a docker container. The name of the container running the database is hardcoded to look for
5+
# *db-postgres*. This may cause an issue if several docker applications are running on the same
6+
# system. Also, the location of the backups is hardcoded to ~/selection-tool-backups.
7+
8+
# To create nightly backups, add the following to your crontab
9+
# 0 0 * * * /srv/selection-tool/backup_database.sh <db_name> <db_username> >> /home/ubuntu/selection-tool-backups/cron.log 2>&1
10+
11+
DB_NAME=$1
12+
DB_USERNAME=$2
13+
14+
function file_name(){
15+
echo ${BACKUP_DIR}/${DB_NAME}_$(date '+%Y%m%d_%H%M%S').dump
16+
}
17+
18+
function media_file_name(){
19+
echo /backup/dir/${DB_NAME}_media_$(date '+%Y%m%d_%H%M%S').tgz
20+
}
21+
22+
if [[ (-z ${DB_NAME}) || (-z ${DB_USERNAME}) ]] ; then
23+
echo "Expecting command to be of form ./backup_database.sh <db_name> <db_username>"
24+
exit 1
25+
fi
26+
27+
# currently the backup directory is hard coded
28+
BACKUP_DIR=/home/ubuntu/selection-tool-backups
29+
mkdir -p ${BACKUP_DIR}
30+
31+
# db_password is set from the environment variables in docker-compose. The docker stack must
32+
# be running for this command to work.
33+
echo "docker exec $(docker ps -f "name=db-postgres" --format "{{.ID}}") pg_dump -U ${DB_USERNAME} -Fc ${DB_NAME} > $(file_name)"
34+
docker exec $(docker ps -f "name=db-postgres" --format "{{.ID}}") pg_dump -U ${DB_USERNAME} -Fc ${DB_NAME} > $(file_name)
35+
36+
37+
# Backup the media directory (uploads, especially buildingsync). In docker-land this is
38+
# just a container volume, so create a new container with the volume attached and tar it up.
39+
echo "docker run --rm -it -v selectiontool_mediadata:/backup/media -v $BACKUP_DIR:/backup/dir/ alpine:3.8 tar zcvf $(media_file_name) /backup/media"
40+
docker run --rm -v selectiontool_mediadata:/backup/media -v $BACKUP_DIR:/backup/dir/ alpine:3.8 tar zcvf $(media_file_name) /backup/media
41+
42+
# Delete files older than 30 days.
43+
find ${BACKUP_DIR} -mtime +30 -type f -name '*.dump' -delete
44+
find ${BACKUP_DIR} -mtime +30 -type f -name '*.tgz' -delete

bsyncviewer/lib/bedes/v2.2/bedes_v2.2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46155,4 +46155,4 @@
4615546155
"list_options": []
4615646156
}
4615746157
]
46158-
}
46158+
}

0 commit comments

Comments
 (0)