Skip to content

Commit

Permalink
feat: added the GitHub Actions and cleaned up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
shahabganji committed Apr 21, 2024
2 parents ecf6c11 + 2a1142b commit 879b12b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Test

on:
push:
pull_request:
branches:
- main
- dev

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup .NET SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x' # You can specify the version you need

- name: Restore Dependencies
run: dotnet restore CodeJoyRide.sln

- name: Build Solution
run: dotnet build CodeJoyRide.sln --configuration Release

- name: Run Tests
run: dotnet test CodeJoyRide.sln --configuration Release --no-restore --verbosity normal
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

### New Rules

| Rule ID | Category | Severity | Notes |
|---------|----------|----------|--------------------------------------------------|
| AB0002 | Usage | Warning | The speed must be lower than the Speed of Light. |
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
CJR001 | Usage | Error | The speed must be lower than the Speed of Light.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### New Rules

| Rule ID | Category | Severity | Notes |
|---------|----------|----------|-------|
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public class MaybeSemanticAnalyzer : DiagnosticAnalyzer
private const string Category = "Usage";

private static readonly DiagnosticDescriptor Rule = new(DiagnosticId, Title, MessageFormat, Category,
DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description
, customTags: [WellKnownDiagnosticTags.NotConfigurable]
);

// Keep in mind: you have to list your rules here.
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
Expand Down
6 changes: 3 additions & 3 deletions CodeJoyRide.Fx/Maybe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public IEnumerable<T> AsEnumerable()
yield return this._value;
}

public T Unwrap(T defaultValue = default) => this.IsNone ? defaultValue : this._value;
public T Unwrap(T defaultValue) => this.IsNone ? defaultValue : this._value;
public T Unwrap(Func<T> defaultValueFunc) => this.IsNone ? defaultValueFunc() : this._value;

public Task<T> UnwrapAsync(Func<Task<T>> defaultValueFuncAsync)
Expand All @@ -83,7 +83,7 @@ public Task<T> UnwrapAsync(Func<Task<T>> defaultValueFuncAsync)
public bool Equals(Maybe<T> other)
=> IsSome == other.IsSome && (IsNone || this._value!.Equals(other._value));

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
return obj is Maybe<T> other && Equals(other);
}
Expand All @@ -92,7 +92,7 @@ public override int GetHashCode()
{
unchecked
{
return (IsSome.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(_value);
return (IsSome.GetHashCode() * 397) ^ EqualityComparer<T>.Default.GetHashCode(_value!);
}
}

Expand Down
8 changes: 8 additions & 0 deletions CodeJoyRide.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{D3C4A25F-0
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{A6A1F426-676D-4413-93B2-B9DD6A25736A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{F37F6912-F8AE-4B03-8EB0-966358BC757B}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build_and_test.yaml = .github\workflows\build_and_test.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -45,5 +52,6 @@ Global
{3D0FED8B-0509-4407-B66C-AFC7971956C3} = {1B62324C-07F0-45FA-A1F5-C5CAD91A6AC5}
{906D80E7-ED31-4D3E-A47D-7ABF8F6153FB} = {1B62324C-07F0-45FA-A1F5-C5CAD91A6AC5}
{5508C6E9-856E-4B08-8BFD-D05803BAE144} = {85459589-7B8D-43F5-977D-64D13E685F71}
{F37F6912-F8AE-4B03-8EB0-966358BC757B} = {A6A1F426-676D-4413-93B2-B9DD6A25736A}
EndGlobalSection
EndGlobal

0 comments on commit 879b12b

Please sign in to comment.