Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9935cc2
started to add SCPI to DAQiFi Core
tylerkron Mar 23, 2025
2ea699a
added CICD
tylerkron Mar 23, 2025
de6981b
Add versioning and NuGet package metadata to DAQifi.Core.csproj
tylerkron Mar 23, 2025
4f244ce
Enhance coverage reporting in CI/CD pipeline
tylerkron Mar 23, 2025
64657ba
Enhance PR validation workflow
tylerkron Mar 23, 2025
a789fd4
Fix upload-artifact action version in PR validation workflow
tylerkron Mar 23, 2025
96c92a1
Refactor PR validation workflow for DAQiFi.Core
tylerkron Mar 23, 2025
ee0d499
Refactor coverage report generation in PR validation workflow
tylerkron Mar 23, 2025
677f3c3
Refactor paths in PR validation workflow
tylerkron Mar 23, 2025
902a8be
Update PR validation workflow for targeted project paths
tylerkron Mar 23, 2025
b7a72c7
chore: standardize DAQiFi casing across project
tylerkron Mar 23, 2025
3476e77
chore: simplify PR validation workflow steps
tylerkron Mar 23, 2025
b988bc1
chore: update PR validation workflow for improved case sensitivity an…
tylerkron Mar 23, 2025
0c7487a
chore: add CI workflow for .NET project
tylerkron Mar 23, 2025
4dad91a
chore: remove PR validation workflow
tylerkron Mar 23, 2025
a0883ee
chore: standardize project casing and namespaces
tylerkron Mar 23, 2025
1a00f62
chore: specify solution file in CI workflow commands
tylerkron Mar 23, 2025
d02de38
Add .gitattributes to fix line endings
tylerkron Mar 23, 2025
9c593bb
Fix solution file casing in CI workflow
tylerkron Mar 23, 2025
e1ca117
Update solution file with correct casing
tylerkron Mar 23, 2025
333dc8f
Fix project casing in solution file for consistency
tylerkron Mar 23, 2025
b729e05
Fix casing in CI workflow commands for Daqifi.Core solution
tylerkron Mar 23, 2025
bbeb398
fix: rename solution file to match CI casing
tylerkron Mar 23, 2025
5a11c2e
fix: recreate solution file with correct project references
tylerkron Mar 23, 2025
c695d82
fix: update solution with correct project casing
tylerkron Mar 23, 2025
255888a
fix: standardize casing to DAQifi across all files
tylerkron Mar 23, 2025
9b2d141
fix: standardize project file casing to match directory names
tylerkron Mar 23, 2025
1621805
fix: standardize on simple Daqifi casing everywhere
tylerkron Mar 23, 2025
644dffc
fix: update solution file to standardize project casing
tylerkron Mar 23, 2025
a273916
chore: clean up CI workflow by removing debug steps
tylerkron Mar 23, 2025
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
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* text=auto

*.sln text eol=crlf
*.csproj text eol=crlf
*.cs text eol=crlf
*.md text
*.json text
*.yml text
*.yaml text
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: Restore dependencies
run: dotnet restore Daqifi.Core.sln

- name: Build
run: dotnet build --no-restore Daqifi.Core.sln

- name: Test
run: dotnet test Daqifi.Core.sln
79 changes: 78 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ ScaffoldingReadMe.txt
*.nupkg
# NuGet Symbol Packages
*.snupkg
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

# Others
~$*
Expand All @@ -51,4 +54,78 @@ CodeCoverage/
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
nunit-*.xml

# Rider
.idea/
*.sln.iml

# VS Code
.vscode/
*.code-workspace

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates

# macOS
.DS_Store
.AppleDouble
.LSOverride

# Coverage results
coverage/
coverage.*
*.coverage
*.coveragexml
coveragereport/
*.cobertura.xml
Summary.txt

# Local History
.localhistory/

# Visual Studio History
.vshistory/

# ReSharper
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
34 changes: 34 additions & 0 deletions Daqifi.Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5412868F-5B63-486D-8EA6-ED8C83418517}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Daqifi.Core", "src\Daqifi.Core\Daqifi.Core.csproj", "{F30FE70B-E858-46F1-8BDA-16859680FE56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Daqifi.Core.Tests", "src\Daqifi.Core.Tests\Daqifi.Core.Tests.csproj", "{A3E04AD3-E095-48CD-99C7-BD82EF2AB128}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F30FE70B-E858-46F1-8BDA-16859680FE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F30FE70B-E858-46F1-8BDA-16859680FE56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F30FE70B-E858-46F1-8BDA-16859680FE56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F30FE70B-E858-46F1-8BDA-16859680FE56}.Release|Any CPU.Build.0 = Release|Any CPU
{A3E04AD3-E095-48CD-99C7-BD82EF2AB128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3E04AD3-E095-48CD-99C7-BD82EF2AB128}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3E04AD3-E095-48CD-99C7-BD82EF2AB128}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3E04AD3-E095-48CD-99C7-BD82EF2AB128}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F30FE70B-E858-46F1-8BDA-16859680FE56} = {5412868F-5B63-486D-8EA6-ED8C83418517}
{A3E04AD3-E095-48CD-99C7-BD82EF2AB128} = {5412868F-5B63-486D-8EA6-ED8C83418517}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Text;
using Daqifi.Core.Communication.Messages;
using Daqifi.Core.Communication.Producers;

namespace Daqifi.Core.Tests.Communication.Producers;

public class ScpiMessageProducerTests
{
[Fact]
public void Reboot_ReturnsCorrectCommand()
{
// Act
var message = ScpiMessageProducer.Reboot;

// Assert
Assert.Equal("SYSTem:REboot", message.Data);
AssertMessageFormat(message);
}

[Fact]
public void SystemInfo_ReturnsCorrectCommand()
{
// Act
var message = ScpiMessageProducer.SystemInfo;

// Assert
Assert.Equal("SYSTem:SYSInfoPB?", message.Data);
AssertMessageFormat(message);
}

[Fact]
public void TurnOffEcho_ReturnsCorrectCommand()
{
// Act
var message = ScpiMessageProducer.TurnOffEcho;

// Assert
Assert.Equal("SYSTem:ECHO -1", message.Data);
AssertMessageFormat(message);
}

[Fact]
public void TurnOnEcho_ReturnsCorrectCommand()
{
// Act
var message = ScpiMessageProducer.TurnOnEcho;

// Assert
Assert.Equal("SYSTem:ECHO 1", message.Data);
AssertMessageFormat(message);
}

private void AssertMessageFormat(IMessage message)
{
var bytes = message.GetBytes();
var expectedBytes = Encoding.ASCII.GetBytes($"{message.Data}\r\n");

Assert.Equal(expectedBytes, bytes);
}
}
33 changes: 33 additions & 0 deletions src/Daqifi.Core.Tests/Daqifi.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<CollectCoverage>true</CollectCoverage>
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
<CoverletOutput>$(MSBuildThisFileDirectory)../coverage/</CoverletOutput>
<ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Daqifi.Core\Daqifi.Core.csproj" />
</ItemGroup>

</Project>
8 changes: 8 additions & 0 deletions src/Daqifi.Core/Communication/Messages/IMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Daqifi.Core.Communication.Messages;

public interface IMessage
{
object Data { get; set;}

byte[] GetBytes();
}
13 changes: 13 additions & 0 deletions src/Daqifi.Core/Communication/Messages/ScpiMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text;

namespace Daqifi.Core.Communication.Messages;

public class ScpiMessage(string command) : IMessage
{
public object Data { get; set; } = command;

public byte[] GetBytes()
{
return Encoding.ASCII.GetBytes((string)Data + "\r\n");
}
}
11 changes: 11 additions & 0 deletions src/Daqifi.Core/Communication/Producers/ScpiMessageProducer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Daqifi.Core.Communication.Messages;

namespace Daqifi.Core.Communication.Producers;

public class ScpiMessageProducer
{
public static IMessage Reboot => new ScpiMessage("SYSTem:REboot");
public static IMessage SystemInfo => new ScpiMessage("SYSTem:SYSInfoPB?");
public static IMessage TurnOffEcho => new ScpiMessage("SYSTem:ECHO -1");
public static IMessage TurnOnEcho => new ScpiMessage("SYSTem:ECHO 1");
}
21 changes: 21 additions & 0 deletions src/Daqifi.Core/Daqifi.Core.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Version info -->
<Version>0.1.0</Version>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<FileVersion>0.1.0.0</FileVersion>

<!-- NuGet package info -->
<PackageId>Daqifi.Core</PackageId>
<Authors>DAQiFi</Authors>
<Description>Core library for interacting with DAQiFi devices</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/daqifi/daqifi-core</PackageProjectUrl>
</PropertyGroup>

</Project>