-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from NREL/develop
v3.1
- Loading branch information
Showing
72 changed files
with
3,896 additions
and
35,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Check Examples APIs | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
examples-check: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.9] | ||
os: [ubuntu-latest] #, macos-latest, windows-latest] | ||
fail-fast: False | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install project | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -e . | ||
pip install nbconvert # For converting Jupyter notebook to python script in the next step | ||
- name: Run examples | ||
# Run all examples and test that they finish successfully. Do not evaluate the results. | ||
run: | | ||
cd examples/ | ||
error_found=0 # 0 is false | ||
error_results="Error in example:" | ||
# Run each Python script example | ||
for i in *.py; do | ||
# Skip these examples since they have additional dependencies | ||
if [[ $i == *11* ]]; then | ||
continue | ||
fi | ||
if [[ $i == *16* ]]; then | ||
continue | ||
fi | ||
if ! python $i; then | ||
error_results="${error_results}"$'\n'" - ${i}" | ||
error_found=1 | ||
fi | ||
done | ||
# Run all Jupyter notebooks | ||
for i in *.ipynb; do | ||
# Convert this notebook to a Python script | ||
if ! jupyter nbconvert --to script $i; then | ||
# On conversion error, report and go to the next notebook | ||
error_results="${error_results}"$'\n'" - Error converting ${i} to Python script" | ||
continue | ||
fi | ||
# Get the basename of the notebook since the converted script will have the same basename | ||
script_name=`basename $i .ipynb` | ||
# Run the converted script | ||
if ! python "${script_name}.py"; then | ||
error_results="${error_results}"$'\n'" - ${i}" | ||
error_found=1 | ||
fi | ||
done | ||
if [[ $error_found ]]; then | ||
echo "${error_results}" | ||
fi | ||
exit $error_found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,104 @@ | ||
--- | ||
layout: default | ||
title: Architecture | ||
title: Workflow | ||
nav_order: 1 | ||
--- | ||
|
||
# FLORIS architecture and developer documentation | ||
# Developer workflows and interaction | ||
|
||
Look out for updates here in the next release! | ||
FLORIS is maintained at NREL's National Wind Technology Center. | ||
We are excited about community contribution, and this page outlines | ||
processes and procedures to follow when contributing to the | ||
source code. For technical questions regarding FLORIS usage, please | ||
post your questions to [GitHub Discussions](https://github.com/NREL/floris/discussions). | ||
|
||
## Git and GitHub | ||
|
||
The majority of the collaboration and development for FLORIS takes place | ||
in the [GitHub repository](http://github.com/nrel/floris). There, | ||
[issues](http://github.com/nrel/floris/issues) and | ||
[pull requests](http://github.com/nrel/floris/pulls) are managed, | ||
questions and ideas are [discussed](https://github.com/NREL/floris/discussions), | ||
and [new versions](http://github.com/nrel/floris/releases) | ||
are released. It is the best mechanism for engaging with the NREL team | ||
and other developers throughout the FLORIS community. | ||
|
||
FLORIS development should follow "Git Flow" when interacting with the GitHub | ||
repository. Git Flow is a git workflow outlining safe methods of pushing and | ||
pulling commits to a shared repository. Maintaining this workflow is critical | ||
to prevent remote changes from blocking your local development. The Git Flow | ||
process is detailed nicely [here](http://nvie.com/posts/a-successful-git-branching-model). | ||
|
||
### Syncing a local repository with NREL/FLORIS | ||
The "main" FLORIS repository is continuously updated along with ongoing | ||
research at NREL. From time to time, developers of FLORIS using their own | ||
"local" repositories (versions of the software that exist on a local computer) | ||
may want to sync with NREL/FLORIS. To do this, use the following git commands: | ||
|
||
```bash | ||
|
||
# Move into the FLORIS source code directory; | ||
# this may be named differently on your computer. | ||
cd floris/ | ||
|
||
# Find the remote name that corresponds to | ||
# NREL/FLORIS; usually "origin" or "upstream". | ||
git remote -v | ||
|
||
# Fetch the changes on all remotes. | ||
git fetch --all | ||
|
||
# Decide which branch to sync with | ||
# NREL/FLORIS. Generally, this will be "main". | ||
git checkout main | ||
git pull origin main | ||
|
||
# Update any local working branches with the | ||
# latest from NREL/FLORIS. | ||
git checkout feature/working_branch | ||
git merge main | ||
``` | ||
|
||
Note that the example above is a general case and may need to be modified | ||
to fit a specific use case or purpose. If significant development has | ||
happened locally, then [merge conflicts](https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts) | ||
are likely and should be resolved as early as possible. | ||
|
||
## Testing | ||
|
||
In order to maintain a level of confidence in the software, FLORIS is expected | ||
to maintain a reasonable level of test coverage. To that end, unit | ||
tests for a the low-level code in the `floris.simulation` package are included. | ||
|
||
The full testing suite can by executed by running the command ``pytest`` from | ||
the highest directory in the repository. A testing-only class is included | ||
to provide consistent and convenient inputs to modules at | ||
`floris/tests/conftest.py`. | ||
|
||
### Unit Tests | ||
|
||
Unit tests are integrated into FLORIS with the | ||
[pytest](https://docs.pytest.org/en/latest/) framework. These can be executed | ||
by running the command `pytest tests/*_unit_test.py` from the highest | ||
directory in the repository. | ||
|
||
### Regression Tests | ||
|
||
Regression tests are included in FLORIS through the same | ||
[pytest](https://docs.pytest.org/en/latest/) framework as the unit tests. | ||
Functionally, the only difference is that the regression tests take more | ||
time to execute and exercise a large portion of the software. These can be | ||
executed by running the command `pytest tests/*_regression_test.py` from the | ||
highest directory in the repository. | ||
|
||
### Continuous Integration | ||
|
||
Continuous integration is configured with [GitHub Actions](https://github.com/nrel/floris/actions) | ||
and executes all of the existing tests for every push-event. The configuration file | ||
is located at `floris/.github/workflows/continuous-integration-workflow.yaml`. | ||
|
||
## Deploying to pip | ||
|
||
Generally, only NREL developers will have appropriate permissions to deploy | ||
FLORIS updates. When the time comes, here is a great reference on doing it | ||
is available [here](https://medium.freecodecamp.org/how-to-publish-a-pyton-package-on-pypi-a89e9522ce24). |
Oops, something went wrong.