-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from cognitedata/second-branch
add files
- Loading branch information
Showing
30 changed files
with
3,250 additions
and
0 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,7 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"local>cognitedata/renovate-config", | ||
":automergeMinor" | ||
] | ||
} |
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,37 @@ | ||
name: .NET build and test | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
common: | ||
uses: ./.github/workflows/common.yml | ||
secrets: inherit | ||
|
||
build-installer: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- common | ||
steps: | ||
- run: echo "Yep, the installer is built" | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore | ||
- name: Test | ||
run: dotnet test --no-build --verbosity normal /p:Exclude="[*.Test]*" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=TestResults/ | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
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,86 @@ | ||
name: Release connector | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
common: | ||
uses: ./.github/workflows/common.yml | ||
secrets: inherit | ||
|
||
publish-installer: | ||
runs-on: windows-latest | ||
environment: CD | ||
if: ${{ needs.common.outputs.should-release == 0 }} | ||
needs: | ||
- common | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install markdown-pdf | ||
run: npm install -g [email protected] | ||
|
||
- name: Convert Markdown to PDF | ||
run: markdown-pdf Documentation.md | ||
|
||
- name: download-artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: windows artifacts | ||
path: ./ | ||
|
||
- name: create release | ||
uses: actions/create-release@v1 | ||
id: github-release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
tag_name: ${{ needs.common.outputs.version }} | ||
release_name: DWSIM Connector ${{ needs.common.outputs.version }} | ||
|
||
draft: false | ||
prerelease: true | ||
|
||
- name: upload release msi | ||
uses: actions/upload-release-asset@v1 | ||
id: github-release-msi | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.github-release.outputs.upload_url }} | ||
asset_path: .\DwsimConnectorInstaller-${{needs.common.outputs.version }}.msi | ||
asset_name: DwsimConnectorInstaller-${{ needs.common.outputs.version }}.msi | ||
asset_content_type: application/octet-stream | ||
|
||
- name: upload release binary | ||
uses: actions/upload-release-asset@v1 | ||
id: github-release-binary | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.github-release.outputs.upload_url }} | ||
asset_path: .\Service.exe | ||
asset_name: Service.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Install publisher | ||
shell: bash | ||
run: pip install cognite-extractor-publisher --extra-index-url "https://${{ secrets.ARTIFACTORY_READONLY_TOKEN_USER }}:${{ secrets.ARTIFACTORY_READONLY_TOKEN }}@cognite.jfrog.io/cognite/api/pypi/snakepit/simple" | ||
|
||
- name: publish connector | ||
env: | ||
EXTRACTOR_DOWNLOAD_API_ADMIN_SECRET: ${{ secrets.EXTRACTOR_DOWNLOAD_ADMIN_SECRET }} | ||
run: publish-extractor publish --manifest manifest.yml --version ${{ needs.common.outputs.version }} |
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,130 @@ | ||
name: Build and test connector | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
version: | ||
description: Release version | ||
value: ${{ jobs.prerequisites.outputs.version }} | ||
should-release: | ||
description: Checks if release would occur | ||
value: ${{ jobs.prerequisites.outputs.should-release }} | ||
branch: | ||
description: Branch | ||
value: ${{ jobs.prerequisites.outputs.branch }} | ||
secrets: | ||
ARTIFACTORY_READONLY_TOKEN: | ||
required: true | ||
ARTIFACTORY_READONLY_TOKEN_USER: | ||
required: true | ||
|
||
jobs: | ||
prerequisites: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should-release: ${{ steps.confirm-release.outputs.test }} | ||
branch: ${{ steps.current-branch.outputs.branch }} | ||
version: ${{ steps.get-version.outputs.version }} | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: update pip | ||
run: pip install --upgrade pip | ||
|
||
- name: install shyaml | ||
run: pip install shyaml | ||
|
||
- name: get-version | ||
id: get-version | ||
run: echo "version=$(cat manifest.yml | shyaml keys-0 versions | xargs -0 | cut -d\ -f1)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: debug-version | ||
run: echo ${{ steps.get-version.outputs.version }} | ||
|
||
- name: confirm release | ||
id: confirm-release | ||
run: echo "test=$(git tag --list '${{ steps.get-version.outputs.version }}' | wc -l | sed s/\ //g)" >> $GITHUB_OUTPUT | ||
|
||
- name: Get branch name | ||
id: current-branch | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Message about build | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
if (${{ steps.confirm-release.outputs.test }} == 0) { | ||
core.notice('Will release version ${{ steps.get-version.outputs.version }}...') | ||
} else { | ||
core.warning('Will not create release for version ${{ steps.get-version.outputs.version }} because it already exists.') | ||
} | ||
build-installer: | ||
runs-on: windows-latest | ||
environment: ${{ needs.prerequisites.outputs.branch == 'main' && 'CD' || 'CI' }} | ||
needs: | ||
- prerequisites | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
- name: Restore tools | ||
run: dotnet tool restore | ||
|
||
- name: Add msbuild to path | ||
uses: microsoft/[email protected] | ||
|
||
- name: Build and Publish Service binary | ||
working-directory: .\Service | ||
run: dotnet publish -c Release -r win-x64 --no-self-contained -p:PublishSingleFile=true -p:Version=${{ needs.prerequisites.outputs.version }} -p:InformationalVersion="${{ needs.prerequisites.outputs.version }}" -p:DebugType=none -p:DebugSymbols=false -o ./bin/portable | ||
shell: bash | ||
|
||
- name: Sign service binary | ||
if: ${{ needs.prerequisites.outputs.branch == 'main' }} | ||
env: | ||
CERTIFICATE_HOST: ${{ secrets.CODE_SIGNING_CERT_HOST }} | ||
CERTIFICATE_HOST_API_KEY: ${{ secrets.CODE_SIGNING_CERT_HOST_API_KEY }} | ||
CERTIFICATE_SHA1_HASH: ${{ secrets.CODE_SIGNING_CERT_SHA1_HASH }} | ||
CLIENT_CERTIFICATE: ${{ secrets.CODE_SIGNING_CLIENT_CERT }} | ||
CLIENT_CERTIFICATE_PASSWORD: ${{ secrets.CODE_SIGNING_CLIENT_CERT_PASSWORD }} | ||
KEYPAIR_ALIAS: ${{ secrets.CODE_SIGNING_KEYPAIR_ALIAS }} | ||
uses: cognitedata/code-sign-action/@v3 | ||
with: | ||
path-to-binary: .\Service\bin\portable\Service.exe | ||
|
||
- name: Build Installer | ||
working-directory: .\Installer | ||
run: .\build.ps1 -b msbuild -v ${{ needs.prerequisites.outputs.version }} -d "DWSIM connector Installer" -c .\setup-config.json | ||
shell: powershell | ||
|
||
- name: Sign Installer | ||
if: ${{ needs.prerequisites.outputs.branch == 'main' }} | ||
env: | ||
CERTIFICATE_HOST: ${{ secrets.CODE_SIGNING_CERT_HOST }} | ||
CERTIFICATE_HOST_API_KEY: ${{ secrets.CODE_SIGNING_CERT_HOST_API_KEY }} | ||
CERTIFICATE_SHA1_HASH: ${{ secrets.CODE_SIGNING_CERT_SHA1_HASH }} | ||
CLIENT_CERTIFICATE: ${{ secrets.CODE_SIGNING_CLIENT_CERT }} | ||
CLIENT_CERTIFICATE_PASSWORD: ${{ secrets.CODE_SIGNING_CLIENT_CERT_PASSWORD }} | ||
KEYPAIR_ALIAS: ${{ secrets.CODE_SIGNING_KEYPAIR_ALIAS }} | ||
uses: cognitedata/code-sign-action/@v3 | ||
with: | ||
path-to-binary: '.\Installer\bin\Release\DwsimConnectorInstaller-${{ needs.prerequisites.outputs.version }}.msi' | ||
|
||
- run: mkdir .\uploads | ||
- run: mv .\Installer\bin\Release\DwsimConnectorInstaller-${{ needs.prerequisites.outputs.version }}.msi .\uploads\DwsimConnectorInstaller-${{ needs.prerequisites.outputs.version }}.msi | ||
- run: mv .\Service\bin\portable\Service.exe .\uploads\Service.exe | ||
- name: upload artifact | ||
if: ${{ needs.prerequisites.outputs.branch == 'main' && needs.prerequisites.outputs.should-release == 0 }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: windows artifacts | ||
path: .\uploads\ |
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,15 @@ | ||
*/obj/* | ||
*/bin/* | ||
config.yml | ||
.envrc | ||
.env | ||
.DS_Store | ||
files/* | ||
logs/* | ||
*.db | ||
.vscode/* | ||
configurations/* | ||
.vs/* | ||
*/buildoutput/* | ||
Service/configurations/* | ||
Service/files/* |
Validating CODEOWNERS rules …
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 @@ | ||
@cognitedata/simulator-integration |
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,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> | ||
<!-- You may want to uncomment this to debug locally --> | ||
<!-- <PlatformTarget>x64</PlatformTarget> | ||
<Configuration>Debug</Configuration> --> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Cognite.Simulator.Utils" Version="1.0.0-alpha-054" /> | ||
</ItemGroup> | ||
|
||
<!-- Uncomment below to use libraries built locally --> | ||
<!-- <ItemGroup> | ||
<PackageReference Include="Cognite.ExtractorUtils" Version="1.18.0" /> | ||
<PackageReference Include="Cognite.Extensions" Version="1.18.0" /> | ||
<ProjectReference Include="..\..\dotnet-extractor-utils\ExtractorUtils\ExtractorUtils.csproj" /> | ||
<ProjectReference Include="..\..\dotnet-extractor-utils\Cognite.Extensions\Cognite.Extensions.csproj" /> | ||
</ItemGroup> --> | ||
<!-- <ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
<ProjectReference Include="..\..\dotnet-simulator-utils\Cognite.DataProcessing\Cognite.DataProcessing.csproj" /> | ||
<ProjectReference Include="..\..\dotnet-simulator-utils\Cognite.Simulator.Extensions\Cognite.Simulator.Extensions.csproj" /> | ||
<ProjectReference Include="..\..\dotnet-simulator-utils\Cognite.Simulator.Utils\Cognite.Simulator.Utils.csproj" /> | ||
</ItemGroup> --> | ||
</Project> |
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,45 @@ | ||
/** | ||
* Copyright 2024 Cognite AS | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
using Cognite.Simulator.Utils; | ||
using CogniteSdk.Alpha; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Connector; | ||
public static class ConnectorRuntime { | ||
|
||
public static void Init() { | ||
DefaultConnectorRuntime<DwsimAutomationConfig, DefaultModelFilestate, DefaultModelFileStatePoco>.ConfigureServices = ConfigureServices; | ||
DefaultConnectorRuntime<DwsimAutomationConfig, DefaultModelFilestate, DefaultModelFileStatePoco>.ConnectorName = "DWSIM"; | ||
DefaultConnectorRuntime<DwsimAutomationConfig, DefaultModelFilestate, DefaultModelFileStatePoco>.SimulatorDefinition = SimulatorDefinition.Get(); | ||
} | ||
static void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddScoped<ISimulatorClient<DefaultModelFilestate, SimulatorRoutineRevision>, DwsimClient>(); | ||
} | ||
|
||
public static async Task RunStandalone() { | ||
Init(); | ||
await DefaultConnectorRuntime<DwsimAutomationConfig, DefaultModelFilestate, DefaultModelFileStatePoco>.RunStandalone().ConfigureAwait(false); | ||
} | ||
|
||
public static async Task Run(ILogger defaultLogger, CancellationToken token) { | ||
Init(); | ||
await DefaultConnectorRuntime<DwsimAutomationConfig, DefaultModelFilestate, DefaultModelFileStatePoco>.Run(defaultLogger, token).ConfigureAwait(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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright 2024 Cognite AS | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
using Cognite.Simulator.Utils.Automation; | ||
|
||
namespace Connector; | ||
|
||
public class DwsimAutomationConfig : AutomationConfig | ||
{ | ||
public string DwsimInstallationPath { get; set; } | ||
|
||
public DwsimAutomationConfig() | ||
Check warning on line 25 in Connector/Dwsim/AutomationConfig.cs GitHub Actions / common / build-installer
Check warning on line 25 in Connector/Dwsim/AutomationConfig.cs GitHub Actions / common / build-installer
|
||
{ | ||
ProgramId = "DWSIM.Automation.Automation3"; | ||
} | ||
} |
Oops, something went wrong.