Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize into multi-package monorepo #63

Closed
wants to merge 12 commits into from
Closed
74 changes: 74 additions & 0 deletions .github/workflows/PRAS.jl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: PRAS.jl tests
# Run on master, tags, or any pull request
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
push:
branches: [main]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "lts" # Latest LTS release, min supported
- "1" # Latest release
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- aarch64
exclude:
- os: windows-latest
arch: aarch64
- os: ubuntu-latest
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.arch }}-test-
${{ runner.os }}-${{ matrix.arch }}-
${{ runner.os }}-
- run: julia --project=PRAS -e 'import Pkg;
Pkg.Registry.add("General");
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/NREL/JuliaRegistry.git"));
Pkg.develop([
(path="PRASCore",),
(path="PRASFiles",),
(path="PRASCapacityCredits",)
])'
shell: bash
- uses: julia-actions/julia-buildpkg@latest
with:
project: PRAS
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- uses: julia-actions/julia-runtest@latest
with:
project: PRAS
env:
JULIA_NUM_THREADS: 2
- uses: julia-actions/julia-processcoverage@v1
with:
directories: PRAS/src
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/PRASCapacityCredits.jl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: PRASCapacityCredits.jl tests
# Run on master, tags, or any pull request
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
push:
branches: [main]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "lts" # Latest LTS release, min supported
- "1" # Latest release
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- aarch64
exclude:
- os: windows-latest
arch: aarch64
- os: ubuntu-latest
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.arch }}-test-
${{ runner.os }}-${{ matrix.arch }}-
${{ runner.os }}-
- run: julia --project=PRASCapacityCredits -e 'import Pkg;
Pkg.Registry.add("General");
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/NREL/JuliaRegistry.git"));
Pkg.develop(path="PRASCore")'
shell: bash
- uses: julia-actions/julia-buildpkg@latest
with:
project: PRASCapacityCredits
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- uses: julia-actions/julia-runtest@latest
with:
project: PRASCapacityCredits
env:
JULIA_NUM_THREADS: 2
- uses: julia-actions/julia-processcoverage@v1
with:
directories: PRASCapacityCredits/src
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
15 changes: 9 additions & 6 deletions .github/workflows/CI.yml → .github/workflows/PRASCore.jl.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI
name: PRASCore.jl tests
# Run on master, tags, or any pull request
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
push:
branches: [master]
branches: [main]
tags: ["*"]
pull_request:
jobs:
Expand Down Expand Up @@ -46,18 +46,21 @@ jobs:
${{ runner.os }}-${{ matrix.arch }}-test-
${{ runner.os }}-${{ matrix.arch }}-
${{ runner.os }}-
- run: julia -e 'import Pkg;
Pkg.Registry.add("General");
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/NREL/JuliaRegistry.git"))'
shell: bash
- uses: julia-actions/julia-buildpkg@latest
with:
project: PRASCore
localregistry: https://github.com/NREL/JuliaRegistry.git
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- uses: julia-actions/julia-runtest@latest
with:
project: PRASCore
env:
JULIA_NUM_THREADS: 2
- uses: julia-actions/julia-processcoverage@v1
with:
directories: PRASCore/src
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/PRASFiles.jl.yml
GordStephen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: PRASFiles.jl tests
# Run on master, tags, or any pull request
on:
schedule:
- cron: '0 2 * * *' # Daily at 2 AM UTC (8 PM CST)
push:
branches: [main]
tags: ["*"]
pull_request:
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "lts" # Latest LTS release, min supported
- "1" # Latest release
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- aarch64
exclude:
- os: windows-latest
arch: aarch64
- os: ubuntu-latest
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-test-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.arch }}-test-
${{ runner.os }}-${{ matrix.arch }}-
${{ runner.os }}-
- run: julia --project=PRASFiles -e 'import Pkg;
Pkg.Registry.add("General");
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/NREL/JuliaRegistry.git"));
Pkg.develop(path="PRASCore")'
shell: bash
- uses: julia-actions/julia-buildpkg@latest
with:
project: PRASFiles
- run: |
git config --global user.name Tester
git config --global user.email [email protected]
- uses: julia-actions/julia-runtest@latest
with:
project: PRASFiles
env:
JULIA_NUM_THREADS: 2
- uses: julia-actions/julia-processcoverage@v1
with:
directories: PRASFiles/src
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*.jl.mem
Manifest.toml
*.DS_Store
*.pras
26 changes: 26 additions & 0 deletions PRAS/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name = "PRAS"
uuid = "05348d26-1c52-11e9-35e3-9d51842d34b9"
authors = [
"Gord Stephen <[email protected]>",
"Surya Chandan Dhulipala <[email protected]>",
"Hari Sundar <[email protected]>"
]
version = "0.7.0"

[deps]
PRASCapacityCredits = "2e1a2ed5-e89d-4cd3-bc86-c0e88a73d3a3"
PRASCore = "c5c32b99-e7c3-4530-a685-6f76e19f7fe2"
PRASFiles = "a2806276-6d43-4ef5-91c0-491704cd7cf1"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
PRASCapacityCredits = "0.7"
PRASCore = "0.7"
PRASFiles = "0.7"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
10 changes: 10 additions & 0 deletions PRAS/src/PRAS.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module PRAS

using Reexport

@reexport using PRASCore
@reexport using PRASCapacityCredits

import PRASFiles: toymodel, rts_gmlc

end
12 changes: 12 additions & 0 deletions PRAS/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using PRAS
using Test

sys = PRAS.rts_gmlc()

sf, = assess(sys, SequentialMonteCarlo(samples=100), Shortfall())

eue = EUE(sf)
lole = LOLE(sf)

@test val(eue) isa Float64
@test stderror(eue) isa Float64
GordStephen marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 19 additions & 0 deletions PRASCapacityCredits/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name = "PRASCapacityCredits"
uuid = "2e1a2ed5-e89d-4cd3-bc86-c0e88a73d3a3"
authors = ["Gord Stephen <[email protected]>"]
version = "0.7.0"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
PRASCore = "c5c32b99-e7c3-4530-a685-6f76e19f7fe2"

[compat]
Distributions = "0.25"
PRASCore = "0.7"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function EFC{M}(
end

function assess(sys_baseline::S, sys_augmented::S,
params::EFC{M}, simulationspec::SimulationSpec
params::EFC{M}, simulationspec::SequentialMonteCarlo
) where {N, L, T, P, S <: SystemModel{N,L,T,P}, M <: ReliabilityMetric}

_, powerunit, _ = unitsymbol(sys_baseline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function ELCC{M}(
end

function assess(sys_baseline::S, sys_augmented::S,
params::ELCC{M}, simulationspec::SimulationSpec
params::ELCC{M}, simulationspec::SequentialMonteCarlo
) where {N, L, T, P, S <: SystemModel{N,L,T,P}, M <: ReliabilityMetric}

_, powerunit, _ = unitsymbol(sys_baseline)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@reexport module CapacityCredit
module PRASCapacityCredits

import PRASCore.Systems: Generators, PowerUnit, Regions, SystemModel, unitsymbol
import PRASCore.Simulations: assess, SequentialMonteCarlo
import PRASCore.Results: ReliabilityMetric, Result, Shortfall, stderror, val

import Base: minimum, maximum, extrema
import Distributions: ccdf, Normal
import ..PRASBase: Generators, PowerUnit, Regions, SystemModel, unitsymbol
import ..ResourceAdequacy: assess, ReliabilityMetric, Result, Shortfall,
SimulationSpec, stderror, val

export EFC, ELCC

Expand Down
File renamed without changes.
Loading
Loading