From d2d00225193e73f0adc41f8c1d503f337be36b01 Mon Sep 17 00:00:00 2001 From: AutumnSky1010 <66455966+AutumnSky1010@users.noreply.github.com> Date: Sun, 10 Mar 2024 14:35:36 +0900 Subject: [PATCH 1/4] :hammer: Add workflow. --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fd85a2b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: .NET Core Desktop + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Debug, Release] + + runs-on: ubuntu-latest + + env: + Solution_Name: SoundMaker.sln # Replace with your solution name, i.e. MyWpfApp.sln. + Test_Project_Path: test/SoundMakerTests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + + # Execute all unit tests in the solution + - name: Execute unit tests + run: dotnet test \ No newline at end of file From e0a5ee710bab67bd6e765e91414792c2bb059525 Mon Sep 17 00:00:00 2001 From: AutumnSky1010 <66455966+AutumnSky1010@users.noreply.github.com> Date: Sun, 10 Mar 2024 14:48:39 +0900 Subject: [PATCH 2/4] :bug: Fix a yml --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd85a2b..3903944 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,9 +32,11 @@ jobs: with: dotnet-version: 6.0.x - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.0.2 + - name: Restore dependencies + run: dotnet restore + + - name: Execute build with warn as error + run: dotnet build --no-restore /warnaserror # Execute all unit tests in the solution - name: Execute unit tests From 653217c2e106ff524d85ca15f5e889044a8ef761 Mon Sep 17 00:00:00 2001 From: AutumnSky1010 <66455966+AutumnSky1010@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:48:51 +0900 Subject: [PATCH 3/4] :+1: Improve the actions --- .github/workflows/build.yml | 16 +++++++++++----- test/UseCaseTests/CreateWaveFileTest.cs | 18 +++++++++--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3903944..438042e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - configuration: [Debug, Release] + configuration: [Release] runs-on: ubuntu-latest @@ -31,12 +31,18 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.x - + + # Restore dependencies - name: Restore dependencies - run: dotnet restore + run: dotnet restore src/SoundMaker/SoundMaker.csproj; dotnet restore test/SoundMakerTests.csproj + + # Build the SoundMaker project + - name: Build the SoundMaker project with warns as errors + run: dotnet build src/SoundMaker/SoundMaker.csproj --no-restore --warnaserror - - name: Execute build with warn as error - run: dotnet build --no-restore /warnaserror + # Build the test project + - name: Build the test project + run: dotnet build test/SoundMakerTests/SoundMakerTests.csproj --no-restore # Execute all unit tests in the solution - name: Execute unit tests diff --git a/test/UseCaseTests/CreateWaveFileTest.cs b/test/UseCaseTests/CreateWaveFileTest.cs index d288769..01828ac 100644 --- a/test/UseCaseTests/CreateWaveFileTest.cs +++ b/test/UseCaseTests/CreateWaveFileTest.cs @@ -8,7 +8,7 @@ public class CreateWaveFileTest { private List<WaveCase> MonauralWaveCases { get; } = new List<WaveCase> { - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyEightKHz, @@ -20,7 +20,7 @@ public class CreateWaveFileTest SoundMaker.Sounds.ChannelType.Monaural), Path = @"Sounds\48000hz16bit1ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyEightKHz, @@ -33,7 +33,7 @@ public class CreateWaveFileTest Path = @"Sounds\48000hz8bit1ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyFourKHz, @@ -45,7 +45,7 @@ public class CreateWaveFileTest SoundMaker.Sounds.ChannelType.Monaural), Path = @"Sounds\44100hz16bit1ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyFourKHz, @@ -62,7 +62,7 @@ public class CreateWaveFileTest private List<WaveCase> StereoWaveCases { get; } = new List<WaveCase> { - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyEightKHz, @@ -74,7 +74,7 @@ public class CreateWaveFileTest SoundMaker.Sounds.ChannelType.Stereo), Path = @"Sounds\48000hz16bit2ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyEightKHz, @@ -86,7 +86,7 @@ public class CreateWaveFileTest SoundMaker.Sounds.ChannelType.Stereo), Path = @"Sounds\48000hz8bit2ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyFourKHz, @@ -98,7 +98,7 @@ public class CreateWaveFileTest SoundMaker.Sounds.ChannelType.Stereo), Path = @"Sounds\44100hz16bit2ch" }, - new WaveCase() + new() { FormatChunk = new FormatChunk( SoundMaker.WaveFile.SamplingFrequencyType.FourtyFourKHz, @@ -182,7 +182,7 @@ private void WriteFile(byte[] wave, FormatChunk format, string name) var writer = new WaveWriter(format, sound); var filePath = $"{name}.wav"; writer.Write(filePath); - Console.WriteLine($"{filePath}を書き込んだよ"); + Console.WriteLine($"Success: Write {filePath}"); } private static StereoWave GetStereo(ISoundChannel channel) From 5d2efb98cbefb6db1ab74ebf9c3078f07a95efea Mon Sep 17 00:00:00 2001 From: AutumnSky1010 <66455966+AutumnSky1010@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:50:09 +0900 Subject: [PATCH 4/4] :bug: Fix the test project path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 438042e..01116e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: # Build the test project - name: Build the test project - run: dotnet build test/SoundMakerTests/SoundMakerTests.csproj --no-restore + run: dotnet build test/SoundMakerTests.csproj --no-restore # Execute all unit tests in the solution - name: Execute unit tests