Skip to content

Commit

Permalink
Merge pull request #12 from chickensoft-games/feat/everything
Browse files Browse the repository at this point in the history
refactor: rework project, use new introspection generator, combine mixins
  • Loading branch information
jolexxa authored Jun 10, 2024
2 parents 9e3f5da + e098d42 commit 5cd2822
Show file tree
Hide file tree
Showing 61 changed files with 2,799 additions and 1,014 deletions.
75 changes: 0 additions & 75 deletions .github/workflows/auto_release.yaml

This file was deleted.

113 changes: 0 additions & 113 deletions .github/workflows/publish.yaml

This file was deleted.

138 changes: 138 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: "📦 Release"
on:
workflow_dispatch:
inputs:
bump:
description: "version bump method: major, minor, patch"
type: choice
options:
- major
- minor
- patch
required: true
default: patch

jobs:
publish:
name: 📦 Release
runs-on: ubuntu-latest
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BASIC }}
lfs: true
submodules: "recursive"
fetch-depth: 0 # So we can get all tags.

- name: 🔎 Read Current Project Version
id: current-version
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: "0.0.0-devbuild"

- name: 🖨 Print Current Version
run: |
echo "Current Version: ${{ steps.current-version.outputs.tag }}"
- name: 🧮 Compute Next Version
uses: chickensoft-games/next-godot-csproj-version@v1
id: next-version
with:
project-version: ${{ steps.current-version.outputs.tag }}
godot-version: global.json
bump: ${{ inputs.bump }}

- name: ✨ Print Next Version
run: |
echo "Next Version: ${{ steps.next-version.outputs.version }}"
# Write version to file so .NET will build correct version.
- name: 📝 Write Version to File
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "0.0.0-devbuild"
replace: ${{ steps.next-version.outputs.version }}
regex: false
include: Chickensoft.AutoInject/Chickensoft.AutoInject.csproj

- name: 🖨 Copy Source to Source-Only package
run: |
# Copy source files from Chickensoft.AutoInject.Tests/src/**/*.cs
# to Chickensoft.AutoInject/src/**/*.cs
#
# Because source-only packages are hard to develop and test, we
# actually keep the source that goes in the source-only package inside
# the test project to make it easier to develop and test.
#
# we can always copy it right before publishing the package.
mkdir -p Chickensoft.AutoInject/src
cp -v -r Chickensoft.AutoInject.Tests/src/* Chickensoft.AutoInject/src/
- name: 🤐 Suppress Warnings From Files
run: |
# Define the multiline prefix and suffix
PREFIX="#pragma warning disable
#nullable enable
"
SUFFIX="
#nullable restore
#pragma warning restore"
# Function to add prefix and suffix to a file
add_prefix_suffix() {
local file="$1"
# Create a temporary file
tmp_file=$(mktemp)
# Add prefix, content of the file, and suffix to the temporary file
{
echo "$PREFIX"
cat "$file"
echo "$SUFFIX"
} > "$tmp_file"
# Move the temporary file to the original file
mv "$tmp_file" "$file"
}
# Export the function and variables so they can be used by find
export -f add_prefix_suffix
export PREFIX
export SUFFIX
# Find all files and apply the function
find Chickensoft.AutoInject/src -type f -name "*.cs" -exec bash -c 'add_prefix_suffix "$0"' {} \;
- name: 💽 Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
# Use the .NET SDK from global.json in the root of the repository.
global-json-file: global.json

- name: 🛠 Build Source-Only Package
working-directory: Chickensoft.AutoInject
run: |
dotnet build -c Release
- name: 🔎 Get Package Path
id: package-path
run: |
package=$(find ./Chickensoft.AutoInject/nupkg -name "*.nupkg")
echo "package=$package" >> "$GITHUB_OUTPUT"
echo "📦 Found package: $package"
- name: ✨ Create Release
env:
GITHUB_TOKEN: ${{ secrets.GH_BASIC }}
run: |
version="${{ steps.next-version.outputs.version }}"
gh release create --title "v$version" --generate-notes "$version" \
"${{ steps.package-path.outputs.package }}"
- name: 🛜 Publish to Nuget
run: |
dotnet nuget push "${{ steps.package-path.outputs.package }}" \
--api-key "${{ secrets.NUGET_API_KEY }}" \
--source "https://api.nuget.org/v3/index.json" --skip-duplicate
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Chickensoft.AutoInject/nupkg/

Chickensoft.AutoInject.Tests/coverage/*
!Chickensoft.AutoInject.Tests/coverage/.gdignore

Expand All @@ -9,5 +7,5 @@ obj/
.generated/
.vs/
.DS_Store
nupkg/*
!nupkg/.gitkeep
Chickensoft.AutoInject/nupkg/
!Chickensoft.AutoInject/nupkg/.gitkeep
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"editor.formatOnSave": true,
"editor.formatOnType": false
},
// Required to keep the C# language server from getting confused about which
// solution to open.
"dotnet.defaultSolution": "Chickensoft.AutoInject.sln",
"csharp.semanticHighlighting.enabled": true,
"editor.semanticHighlighting.enabled": true,
// C# doc comment colorization gets lost with semantic highlighting, but we
Expand Down Expand Up @@ -157,4 +160,4 @@
}
},
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
}
}
21 changes: 8 additions & 13 deletions Chickensoft.AutoInject.Tests/Chickensoft.AutoInject.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<LangVersion>10.0</LangVersion>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>Chickensoft.AutoInject.Tests</RootNamespace>
<!-- Required for some nuget packages to work -->
Expand All @@ -20,18 +20,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Chickensoft.GoDotTest" Version="1.4.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="Shouldly" Version="4.2.1" />

<PackageReference Include="Chickensoft.GoDotTest" Version="1.5.3" />
<PackageReference Include="Chickensoft.GodotTestDriver" Version="3.0.0" />
<!-- Bring your own assertion library for tests! -->
<!-- We're using Shouldly for this example, but you can use anything. -->
<PackageReference Include="Shouldly" Version="4.1.0" />
<!-- LightMock is a mocking library that can run without reflection. -->
<PackageReference Include="LightMock.Generator" Version="1.2.2" />
<!-- LightMoq is a Chickensoft package which makes it more like Moq. -->
<PackageReference Include="LightMoq" Version="0.1.0" />
<PackageReference Include="Chickensoft.SuperNodes" Version="1.8.0" PrivateAssets="all" OutputItemType="analyzer" />
<PackageReference Include="Chickensoft.SuperNodes.Types" Version="1.8.0" />
<!-- Include project to test. -->
<!-- <PackageReference Include="Chickensoft.AutoInject" Version="1.0.0" PrivateAssets="all" /> -->
<PackageReference Include="Chickensoft.GodotNodeInterfaces" Version="2.2.4" />
<PackageReference Include="Chickensoft.Introspection" Version="1.2.0" />
<PackageReference Include="Chickensoft.Introspection.Generator" Version="1.2.0" PrivateAssets="all" OutputItemType="analyzer" />
</ItemGroup>
</Project>
Loading

0 comments on commit 5cd2822

Please sign in to comment.