Skip to content

Commit

Permalink
Merge pull request #22 from HelloYeew/ci
Browse files Browse the repository at this point in the history
Add basic CI workflow
  • Loading branch information
HelloYeew authored Jun 21, 2024
2 parents 82d48c1 + 8d6a928 commit 7be3cba
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 16 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 14 additions & 14 deletions Renako.Game.Tests/Visual/Miscellaneous/TestSceneGameplayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ 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;
private RenakoSpriteText hitText;
private RenakoSpriteText missText;
private RenakoSpriteText clockText;

private DrawablePool<note> notePool;
private DrawablePool<indicator> indicatorPool;
private DrawablePool<Note> notePool;
private DrawablePool<Indicator> indicatorPool;
private DrawablePool<hitResult> hitResultPool;

private Container lane1;
Expand All @@ -56,8 +56,8 @@ public partial class TestSceneGameplayTest : GameDrawableTestScene
[BackgroundDependencyLoader]
private void load(TextureStore textureStore)
{
Add(notePool = new DrawablePool<note>(50));
Add(indicatorPool = new DrawablePool<indicator>(20));
Add(notePool = new DrawablePool<Note>(50));
Add(indicatorPool = new DrawablePool<Indicator>(20));
Add(hitResultPool = new DrawablePool<hitResult>(20));

BackgroundScreenStack.ChangeBackground(textureStore.Get("Screen/fallback-beatmap-background.jpg"));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -504,7 +504,7 @@ private void updateScoreText()
missText.Text = $"Miss: {stats.Miss}";
}

private class statistics
private class Statistics
{
public double Score { get; set; }

Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ protected void PressKeyOnce(Key key)
/// </summary>
protected void WaitForScreen()
{
AddWaitStep("wait for screen", DebugUtils.IsNUnitRunning ? 1000 : 10);
AddWaitStep("wait for screen", DebugUtils.IsNUnitRunning ? 10000 : 10);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7be3cba

Please sign in to comment.