Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Main
on:
push:
branches:
- main
- develop
pull_request:
types: [ opened, synchronize, reopened ]
release:
types: [ published ]
jobs:
unit-tests:
name: Run Unit Tests
uses: ./.github/workflows/unit-tests.yml
secrets: inherit

validation-tests:
name: Run Validation Tests
if: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' }}
uses: ./.github/workflows/validation-tests.yml
secrets: inherit

publish-nuget:
name: Publish Nuget
needs: [ unit-tests ]
if: ${{ github.ref_name == 'main' && github.event_name != 'pull_request' }}
uses: ./.github/workflows/publish-svs.yml
secrets: inherit
with:
beta: false

publish-nuget-beta:
name: Publish Nuget Beta
needs: [ unit-tests ]
if: ${{ github.ref_name != 'main' }}
uses: ./.github/workflows/publish-svs.yml
secrets: inherit
with:
beta: true
48 changes: 48 additions & 0 deletions .github/workflows/publish-svs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish

on:
workflow_call:
inputs:
beta:
required: true
type: boolean

env:
FULL_PACKAGE_VERSION: ${{ format('1.2.{0}{1}+{2}', github.run_number, inputs.beta && '-beta' || '', github.sha) }}
PACKAGE_VERSION: ${{ format('1.2.{0}{1}', github.run_number, inputs.beta && '-beta' || '') }}
jobs:
pack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Pack
run: dotnet pack SVSModel/SVSModel.csproj -c Release -p:Version=${FULL_PACKAGE_VERSION} -o ./output
- name: Upload Package
uses: actions/[email protected]
with:
name: SVSModel
path: ./output
retention-days: 0

publish:
runs-on: ubuntu-latest
permissions: write-all
needs: [ pack ]
steps:
- name: Download Artifact
uses: actions/[email protected]
with:
name: SVSModel
path: ./output
- name: Upload to NuGet
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
PACKAGE_NAME: ${{ format('SVSModel.{0}.nupkg', env.PACKAGE_VERSION) }}
run: |
dotnet nuget push ./output/${PACKAGE_NAME} \
-k ${NUGET_KEY} \
-s https://api.nuget.org/v3/index.json
- name: Persist Version
env:
GH_TOKEN: ${{ secrets.GH_CLI_PAT }}
run: gh variable set LATEST_SVSMODEL --body=${PACKAGE_VERSION} -R Plant-Food-Research-Open/FieldNBalance
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
name: Unit Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
workflow_dispatch: { }
workflow_call:

permissions:
contents: read
actions: read
checks: write

jobs:
build:
run-unit-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
Expand Down
96 changes: 0 additions & 96 deletions .github/workflows/validation-tests.yaml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/validation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Validation Test Plots

on:
workflow_call:

permissions:
actions: write
contents: write
deployments: write
pages: write

jobs:
build:
runs-on: ubuntu-20.04

concurrency:
group: "pages"
cancel-in-progress: true

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: |
poetry install --no-interaction --no-root

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Run tests
run: |
source .venv/bin/activate
dotnet run --project TestConsole/TestsConsole.csproj

- name: Upload test sets
uses: actions/upload-artifact@v4
with:
name: TestSets
path: TestComponents/TestSets

- name: Run report generator
run: |
source .venv/bin/activate
python TestGraphs/report.py

- name: Get current date
id: date
run: |
echo "{date}={$(date +'%Y-%m-%d')}" >> $GITHUB_ENV

- name: Upload validation report
uses: actions/upload-artifact@v4
with:
name: validation_report
path: html

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: html
token: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions SVSModel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestComponents", "TestCompo
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVSModel.Tests", "SVSModel.Tests\SVSModel.Tests.csproj", "{1E04368C-6819-4263-853D-CDE9AECDFA2F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{73C2B72B-485E-4145-AE50-F808E8176B44}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{A3B84C44-078A-4AEA-9902-3D5D8FD46E95}"
ProjectSection(SolutionItems) = preProject
.github\workflows\publish-svs.yml = .github\workflows\publish-svs.yml
.github\workflows\main.yml = .github\workflows\main.yml
.github\workflows\unit-tests.yml = .github\workflows\unit-tests.yml
.github\workflows\validation-tests.yml = .github\workflows\validation-tests.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -53,4 +63,7 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {65DAB7A8-9FD1-4073-9D72-0D12C600CE16}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A3B84C44-078A-4AEA-9902-3D5D8FD46E95} = {73C2B72B-485E-4145-AE50-F808E8176B44}
EndGlobalSection
EndGlobal
11 changes: 1 addition & 10 deletions SVSModel/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
# How to deploy a new nuget package
First update the `SVSModel.csproj` `<version>` field, then run these commands with the version number replacing the `X.X.X`

```bash
$ dotnet pack SVSModel/SVSModel.csproj
```

```bash
$ dotnet nuget push SVSModel/bin/Release/SVSModel.1.2.4.nupkg --source "https://pkgs.dev.azure.com/rezaresystems/48ae16c6-5f20-44a0-ad41-e047c311de0a/_packaging/svs-model-calculator/nuget/v3/index.json" --api-key az --interactive
```
# SVSModel
15 changes: 11 additions & 4 deletions SVSModel/SVSModel.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<id>SVSModel</id>
<version>1.2.4</version>
<authors>PotatoesNZ</authors>
<description>A wrapper of the SVS Model code</description>
<ImplicitUsings>disable</ImplicitUsings>
<PackageId>SVSModel</PackageId>
<Version>1.2.0</Version>
<Authors>PotatoesNZ</Authors>
<PackageTags>Nitrogen,Model,SVS</PackageTags>
<Description>A wrapper of the SVS Model code</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<LangVersion>12</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -14,6 +17,10 @@
<DebugType>embedded</DebugType>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<None Remove="Data\CropCoefficientTableFull.csv" />
<None Remove="Data\LossCoefficientTable.csv" />
Expand Down
Loading