-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
140 additions
and
140 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Thanks for opening a PR to SiennaTemplate.jl, please take note of the following when making a PR: | ||
|
||
Check the [contributor guidelines](https://nrel-sienna.github.io/SiennaTemplate.jl/stable/api/developer_guidelines/) | ||
|
||
|
||
Thanks for opening a PR to SiennaTemplate.jl, please take note of the following when making a PR: | ||
|
||
Check the [contributor guidelines](https://nrel-sienna.github.io/SiennaTemplate.jl/stable/api/developer_guidelines/) | ||
|
||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Documentation | |
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- 'release-' | ||
tags: '*' | ||
pull_request: | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Format Check | |
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'main' | ||
- 'release-' | ||
tags: '*' | ||
pull_request: | ||
|
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,6 +1,6 @@ | ||
# Contributing | ||
|
||
Community driven development of this package is encouraged. To maintain code quality standards, please adhere to the following guidlines when contributing: | ||
- To get started, <a href="https://www.clahub.com/agreements/NREL/SIIP-PACKAGE.jl">sign the Contributor License Agreement</a>. | ||
- To get started, <a href="https://www.clahub.com/agreements/NREL/SIENNA-PACKAGE.jl">sign the Contributor License Agreement</a>. | ||
- Please do your best to adhere to our [coding style guide](docs/src/developer/style.md). | ||
- To submit code contributions, [fork](https://help.github.com/articles/fork-a-repo/) the repository, commit your changes, and [submit a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). |
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
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,6 +1,6 @@ | ||
# Internal API | ||
|
||
```@autodocs | ||
Modules = [SiennaTemplate] | ||
Public = false | ||
``` | ||
# Internal API | ||
|
||
```@autodocs | ||
Modules = [SiennaTemplate] | ||
Public = false | ||
``` |
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,6 +1,6 @@ | ||
# Public API Reference | ||
|
||
```@autodocs | ||
Modules = [SiennaTemplate] | ||
Public = true | ||
``` | ||
# Public API Reference | ||
|
||
```@autodocs | ||
Modules = [SiennaTemplate] | ||
Public = true | ||
``` |
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,4 +1,4 @@ | ||
# SIIP-Examples | ||
# SIENNA-Examples | ||
|
||
All the tutorials for the SIIP project are part of a separate repository | ||
[SIIP-Examples](https://github.com/NREL-SIIP/SIIPExamples.jl). | ||
All the tutorials for the SIENNA project are part of a separate repository | ||
[SIENNA-Examples](https://github.com/NREL-SIENNA/SIENNAExamples.jl). |
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,107 +1,107 @@ | ||
using Test | ||
import Logging | ||
|
||
import Aqua | ||
Aqua.test_unbound_args(SiennaTemplate) | ||
Aqua.test_undefined_exports(SiennaTemplate) | ||
Aqua.test_ambiguities(SiennaTemplate) | ||
Aqua.test_stale_deps(SiennaTemplate) | ||
Aqua.test_deps_compat(SiennaTemplate) | ||
|
||
LOG_FILE = "power-systems.log" | ||
LOG_LEVELS = Dict( | ||
"Debug" => Logging.Debug, | ||
"Info" => Logging.Info, | ||
"Warn" => Logging.Warn, | ||
"Error" => Logging.Error, | ||
) | ||
|
||
""" | ||
Copied @includetests from https://github.com/ssfrr/TestSetExtensions.jl. | ||
Ideally, we could import and use TestSetExtensions. Its functionality was broken by changes | ||
in Julia v0.7. Refer to https://github.com/ssfrr/TestSetExtensions.jl/pull/7. | ||
""" | ||
|
||
""" | ||
Includes the given test files, given as a list without their ".jl" extensions. | ||
If none are given it will scan the directory of the calling file and include all | ||
the julia files. | ||
""" | ||
macro includetests(testarg...) | ||
if length(testarg) == 0 | ||
tests = [] | ||
elseif length(testarg) == 1 | ||
tests = testarg[1] | ||
else | ||
error("@includetests takes zero or one argument") | ||
end | ||
|
||
quote | ||
tests = $tests | ||
rootfile = @__FILE__ | ||
if length(tests) == 0 | ||
tests = readdir(dirname(rootfile)) | ||
tests = filter( | ||
f -> | ||
startswith(f, "test_") && endswith(f, ".jl") && f != basename(rootfile), | ||
tests, | ||
) | ||
else | ||
tests = map(f -> string(f, ".jl"), tests) | ||
end | ||
println() | ||
for test in tests | ||
print(splitext(test)[1], ": ") | ||
include(test) | ||
println() | ||
end | ||
end | ||
end | ||
|
||
function get_logging_level_from_env(env_name::String, default) | ||
level = get(ENV, env_name, default) | ||
return IS.get_logging_level(level) | ||
end | ||
|
||
function run_tests() | ||
logging_config_filename = get(ENV, "SIIP_LOGGING_CONFIG", nothing) | ||
if logging_config_filename !== nothing | ||
config = IS.LoggingConfiguration(logging_config_filename) | ||
else | ||
config = IS.LoggingConfiguration(; | ||
filename = LOG_FILE, | ||
file_level = Logging.Info, | ||
console_level = Logging.Error, | ||
) | ||
end | ||
console_logger = ConsoleLogger(config.console_stream, config.console_level) | ||
|
||
IS.open_file_logger(config.filename, config.file_level) do file_logger | ||
levels = (Logging.Info, Logging.Warn, Logging.Error) | ||
multi_logger = | ||
IS.MultiLogger([console_logger, file_logger], IS.LogEventTracker(levels)) | ||
global_logger(multi_logger) | ||
|
||
if !isempty(config.group_levels) | ||
IS.set_group_levels!(multi_logger, config.group_levels) | ||
end | ||
|
||
# Testing Topological components of the schema | ||
@time @testset "Begin SIIP-PACKAGE tests" begin | ||
@includetests ARGS | ||
end | ||
|
||
@test length(IS.get_log_events(multi_logger.tracker, Logging.Error)) == 0 | ||
@info IS.report_log_summary(multi_logger) | ||
end | ||
end | ||
|
||
logger = global_logger() | ||
|
||
try | ||
run_tests() | ||
finally | ||
# Guarantee that the global logger is reset. | ||
global_logger(logger) | ||
nothing | ||
end | ||
using Test | ||
import Logging | ||
|
||
import Aqua | ||
Aqua.test_unbound_args(SiennaTemplate) | ||
Aqua.test_undefined_exports(SiennaTemplate) | ||
Aqua.test_ambiguities(SiennaTemplate) | ||
Aqua.test_stale_deps(SiennaTemplate) | ||
Aqua.test_deps_compat(SiennaTemplate) | ||
|
||
LOG_FILE = "power-systems.log" | ||
LOG_LEVELS = Dict( | ||
"Debug" => Logging.Debug, | ||
"Info" => Logging.Info, | ||
"Warn" => Logging.Warn, | ||
"Error" => Logging.Error, | ||
) | ||
|
||
""" | ||
Copied @includetests from https://github.com/ssfrr/TestSetExtensions.jl. | ||
Ideally, we could import and use TestSetExtensions. Its functionality was broken by changes | ||
in Julia v0.7. Refer to https://github.com/ssfrr/TestSetExtensions.jl/pull/7. | ||
""" | ||
|
||
""" | ||
Includes the given test files, given as a list without their ".jl" extensions. | ||
If none are given it will scan the directory of the calling file and include all | ||
the julia files. | ||
""" | ||
macro includetests(testarg...) | ||
if length(testarg) == 0 | ||
tests = [] | ||
elseif length(testarg) == 1 | ||
tests = testarg[1] | ||
else | ||
error("@includetests takes zero or one argument") | ||
end | ||
|
||
quote | ||
tests = $tests | ||
rootfile = @__FILE__ | ||
if length(tests) == 0 | ||
tests = readdir(dirname(rootfile)) | ||
tests = filter( | ||
f -> | ||
startswith(f, "test_") && endswith(f, ".jl") && f != basename(rootfile), | ||
tests, | ||
) | ||
else | ||
tests = map(f -> string(f, ".jl"), tests) | ||
end | ||
println() | ||
for test in tests | ||
print(splitext(test)[1], ": ") | ||
include(test) | ||
println() | ||
end | ||
end | ||
end | ||
|
||
function get_logging_level_from_env(env_name::String, default) | ||
level = get(ENV, env_name, default) | ||
return IS.get_logging_level(level) | ||
end | ||
|
||
function run_tests() | ||
logging_config_filename = get(ENV, "SIENNA_LOGGING_CONFIG", nothing) | ||
if logging_config_filename !== nothing | ||
config = IS.LoggingConfiguration(logging_config_filename) | ||
else | ||
config = IS.LoggingConfiguration(; | ||
filename = LOG_FILE, | ||
file_level = Logging.Info, | ||
console_level = Logging.Error, | ||
) | ||
end | ||
console_logger = ConsoleLogger(config.console_stream, config.console_level) | ||
|
||
IS.open_file_logger(config.filename, config.file_level) do file_logger | ||
levels = (Logging.Info, Logging.Warn, Logging.Error) | ||
multi_logger = | ||
IS.MultiLogger([console_logger, file_logger], IS.LogEventTracker(levels)) | ||
global_logger(multi_logger) | ||
|
||
if !isempty(config.group_levels) | ||
IS.set_group_levels!(multi_logger, config.group_levels) | ||
end | ||
|
||
# Testing Topological components of the schema | ||
@time @testset "Begin SIENNA-PACKAGE tests" begin | ||
@includetests ARGS | ||
end | ||
|
||
@test length(IS.get_log_events(multi_logger.tracker, Logging.Error)) == 0 | ||
@info IS.report_log_summary(multi_logger) | ||
end | ||
end | ||
|
||
logger = global_logger() | ||
|
||
try | ||
run_tests() | ||
finally | ||
# Guarantee that the global logger is reset. | ||
global_logger(logger) | ||
nothing | ||
end |