diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fc9ee9f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +on: [push, pull_request] +name: Continuous Integration +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + test: + name: Test + runs-on: ${{matrix.os.fullname}} + strategy: + fail-fast: false + matrix: + os: + - { prettyname: Windows, fullname: windows-latest } + - { prettyname: macOS, fullname: macos-latest } + - { prettyname: Linux, fullname: ubuntu-latest } + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install .NET 8.0.x + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: | + dotnet build -c Debug -warnaserror Renako.Desktop.slnf + + - name: Test + run: | + dotnet test -- NUnit.ConsoleOut=0 + shell: pwsh \ No newline at end of file diff --git a/Renako.Game.Tests/Visual/Miscellaneous/TestSceneGameplayTest.cs b/Renako.Game.Tests/Visual/Miscellaneous/TestSceneGameplayTest.cs index 9d37b31..e285285 100644 --- a/Renako.Game.Tests/Visual/Miscellaneous/TestSceneGameplayTest.cs +++ b/Renako.Game.Tests/Visual/Miscellaneous/TestSceneGameplayTest.cs @@ -26,7 +26,7 @@ public partial class TestSceneGameplayTest : GameDrawableTestScene private Container playfield; private Container drawablePlayfield; private Circle player; - private statistics stats = new statistics(); + private Statistics stats = new Statistics(); private RenakoSpriteText scoreText; private RenakoSpriteText criticalText; private RenakoSpriteText breakText; @@ -34,8 +34,8 @@ public partial class TestSceneGameplayTest : GameDrawableTestScene private RenakoSpriteText missText; private RenakoSpriteText clockText; - private DrawablePool notePool; - private DrawablePool indicatorPool; + private DrawablePool notePool; + private DrawablePool indicatorPool; private DrawablePool hitResultPool; private Container lane1; @@ -56,8 +56,8 @@ public partial class TestSceneGameplayTest : GameDrawableTestScene [BackgroundDependencyLoader] private void load(TextureStore textureStore) { - Add(notePool = new DrawablePool(50)); - Add(indicatorPool = new DrawablePool(20)); + Add(notePool = new DrawablePool(50)); + Add(indicatorPool = new DrawablePool(20)); Add(hitResultPool = new DrawablePool(20)); BackgroundScreenStack.ChangeBackground(textureStore.Get("Screen/fallback-beatmap-background.jpg")); @@ -295,13 +295,13 @@ private Container createLane() }; } - private note addNote(PlayfieldNote playfieldNote) + private Note addNote(PlayfieldNote playfieldNote) { if (!notePool.IsLoaded) return null; float x = getLaneX(playfieldNote.Lane); - note n = notePool.Get(noteObject => + Note n = notePool.Get(noteObject => { noteObject.Position = new Vector2(x, -200); noteObject.LifetimeEnd = Clock.CurrentTime + fade_in_time * 2 + move_time + 250; @@ -332,7 +332,7 @@ private void addHitAnimation(Lane lane) if (!indicatorPool.IsLoaded) return; - indicator indicatorDrawable = indicatorPool.Get(indicatorObject => + Indicator indicatorDrawable = indicatorPool.Get(indicatorObject => { indicatorObject.Position = new Vector2(getLaneX(lane), 200); indicatorObject.LifetimeEnd = Clock.CurrentTime + 500; @@ -436,7 +436,7 @@ private class PlayfieldNote { public Lane Lane { get; set; } - public note DrawableNote { get; set; } + public Note DrawableNote { get; set; } public double Time { get; set; } public bool IsDrawn { get; set; } @@ -504,7 +504,7 @@ private void updateScoreText() missText.Text = $"Miss: {stats.Miss}"; } - private class statistics + private class Statistics { public double Score { get; set; } @@ -514,9 +514,9 @@ private class statistics public int Miss { get; set; } // More than 200ms } - private partial class note : PoolableDrawable + private partial class Note : PoolableDrawable { - public note() + public Note() { Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -535,9 +535,9 @@ public note() } } - private partial class indicator : PoolableDrawable + private partial class Indicator : PoolableDrawable { - public indicator() + public Indicator() { Anchor = Anchor.Centre; Origin = Anchor.Centre; diff --git a/Renako.Game.Tests/Visual/RenakoManualInputManagerTestScene.cs b/Renako.Game.Tests/Visual/RenakoManualInputManagerTestScene.cs index dc60dbe..8fe3f6d 100644 --- a/Renako.Game.Tests/Visual/RenakoManualInputManagerTestScene.cs +++ b/Renako.Game.Tests/Visual/RenakoManualInputManagerTestScene.cs @@ -158,6 +158,6 @@ protected void PressKeyOnce(Key key) /// protected void WaitForScreen() { - AddWaitStep("wait for screen", DebugUtils.IsNUnitRunning ? 1000 : 10); + AddWaitStep("wait for screen", DebugUtils.IsNUnitRunning ? 10000 : 10); } } diff --git a/Renako.Game.Tests/Visual/Screens/TestSceneSongSelectionScreen.cs b/Renako.Game.Tests/Visual/Screens/TestSceneSongSelectionScreen.cs index 9d09d58..b869d7b 100644 --- a/Renako.Game.Tests/Visual/Screens/TestSceneSongSelectionScreen.cs +++ b/Renako.Game.Tests/Visual/Screens/TestSceneSongSelectionScreen.cs @@ -25,7 +25,11 @@ public partial class TestSceneSongSelectionScreen : RenakoGameDrawableManualnput protected new void SetUp() { beatmapsCollection.GenerateTestCollection(); - // Disable idle mode for testing. + } + + protected override void LoadComplete() + { + base.LoadComplete(); configManager.SetValue(RenakoSetting.DisableIdleMode, true); }