Skip to content

Commit

Permalink
Adding GitHub Ci for the two test projects (#12)
Browse files Browse the repository at this point in the history
* Combine MSTest nuget reference

* Add test workflow file
  • Loading branch information
Jannify authored Oct 27, 2024
1 parent 86e06f4 commit e1b836f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build and test

on:
push:
pull_request:
branches: [ main ]

jobs:
build-and-test:
name: build-and-test-${{matrix.os}}
runs-on: ${{ matrix.os }}
if: github.repository_owner == 'SubnauticaNitrox'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/package

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install BinaryPack Dependencies
run: dotnet restore ./src/BinaryPack/BinaryPack.csproj

- name: Install BinaryPack.Unit Dependencies
run: dotnet restore ./unit/BinaryPack.Unit/BinaryPack.Unit.csproj

- name: Install BinaryPack.Unit.Internals Dependencies
run: dotnet restore ./unit/BinaryPack.Unit.Internals/BinaryPack.Unit.Internals.csproj

- name: Build BinaryPack
run: dotnet build ./src/BinaryPack/BinaryPack.csproj --configuration Release --no-restore

- name: Build BinaryPack.Unit
run: dotnet build ./unit/BinaryPack.Unit/BinaryPack.Unit.csproj --configuration Debug --no-restore

- name: Build BinaryPack.Unit.Internals
run: dotnet build ./unit/BinaryPack.Unit.Internals/BinaryPack.Unit.Internals.csproj --configuration Debug --no-restore

- name: Test BinaryPack.Unit
run: dotnet test ./unit/BinaryPack.Unit/BinaryPack.Unit.csproj --no-restore --no-build --verbosity normal

- name: Test BinaryPack.Unit.Internals
run: dotnet test ./unit/BinaryPack.Unit.Internals/BinaryPack.Unit.Internals.csproj --no-restore --no-build --verbosity normal
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Nitrox BinaryPack

[![build and test](https://github.com/SubnauticaNitrox/BinaryPack/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/SubnauticaNitrox/BinaryPack/actions/workflows/build-and-test.yml)
[![NuGet](https://img.shields.io/nuget/v/Nitrox.BinaryPack.svg)](https://www.nuget.org/packages/Nitrox.BinaryPack/)
[![Discord](https://img.shields.io/discord/525437013403631617?logo=discord&logoColor=white)](https://discord.gg/E8B4X9s)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
<TargetFramework>net7</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<MSBuildWarningsAsMessages>NU1702;MSB3277</MSBuildWarningsAsMessages>
<MSBuildWarningsAsMessages>NU1702;MSB3277</MSBuildWarningsAsMessages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="MSTest" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
15 changes: 7 additions & 8 deletions unit/BinaryPack.Unit/BinaryPack.Unit.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net7</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net472;net7</TargetFrameworks>
<TargetFramework Condition=" '$(OS)' != 'Windows_NT' ">net7</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<MSBuildWarningsAsMessages>NU1702;MSB3277</MSBuildWarningsAsMessages>
<MSBuildWarningsAsMessages>NU1702;MSB3277</MSBuildWarningsAsMessages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IsExternalInit" Version="1.0.3" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="IsExternalInit" Version="1.0.3" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="MSTest" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit e1b836f

Please sign in to comment.