Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introducing GodotEnv #10

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
480 changes: 480 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions .github/workflows/install_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: 🤖 Install Tests
on:
push:
pull_request:

jobs:
install_tests:
name: 🖼 Visual Tests with ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# Only run the workflow if it's not a PR or if it's a PR from a fork.
# This prevents duplicate workflows from running on PR's that originate
# from the repository itself.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
strategy:
# Don't cancel other runners if one fails.
fail-fast: false
matrix:
# Also try windows-2019?
os: [macos-latest, ubuntu-latest, windows-2019]
defaults:
run:
# Use bash shells on all platforms.
shell: bash
steps:
- name: 🧾 Checkout
uses: actions/checkout@v3

- 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: 📦 Restore Dependencies
run: dotnet restore

- name: 🦺 Build Projects
run: dotnet build

- name: 🛣 Add Current Installation To Path
# Gets the last line of the output from the installation and adds it to the path.
working-directory: GodotEnv
run: |
# Use tool to install Godot. Last line of output is the path to the
# symlink that always points to the active version of Godot.
dotnet run -- godot install 4.0.1

- name: 🤖 Check Godot Location
working-directory: GodotEnv
run: |
# Get path to the symlink that always points to the active version of
# Godot.
GODOT_SYMLINK="$(dotnet run -- godot env path)"

# Make sure we can use Godot.
$GODOT_SYMLINK --version

echo "✅ Godot location is in path!"

- name: 🌴 Set GODOT System Environment Variable
working-directory: GodotEnv
run: |
dotnet run -- godot env setup

- name: 🧪 Verify GODOT System Environment Variable
working-directory: GodotEnv
run: |
# Make sure we can retrieve environment variable on all systems.
VERIFY_GODOT=$(dotnet run -- godot env get)
echo "GODOT=$VERIFY_GODOT"
if [ -z "$VERIFY_GODOT" ]; then
echo "❌ GODOT environment variable is empty!"
exit 1
fi

- name: 🗑 Uninstall
working-directory: GodotEnv
run: |
echo "Before uninstall:"
dotnet run -- godot list
echo "Uninstalling..."
dotnet run -- godot uninstall 4.0.1
echo "After uninstall:"
dotnet run -- godot list
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Chicken/bin
Chicken/obj
Chicken/nupkg
Chicken.Tests/bin
Chicken.Tests/obj
Chicken.Tests/coverage
Chicken.Tests/badges
Chicken/addons
Chicken/.addons
Chicken/addons.json
Chicken/addons.jsonc
GodotEnv/bin
GodotEnv/obj
GodotEnv/nupkg
GodotEnv.Tests/bin
GodotEnv.Tests/obj
GodotEnv.Tests/coverage
GodotEnv.Tests/badges
GodotEnv/addons
GodotEnv/.addons
GodotEnv/addons.json
GodotEnv/addons.jsonc
27 changes: 4 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,16 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug Chicken CLI",
"name": "Debug GodotEnv CLI",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Chicken/bin/Debug/net6.0/Chickensoft.Chicken.dll",
"program": "${workspaceFolder}/GodotEnv/bin/Debug/net6.0/Chickensoft.GodotEnv.dll",
"args": [
"--debug",
"${input:args}"
],
"cwd": "${workspaceFolder}/Chicken",
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "neverOpen"
},
{
"name": "Debug Create",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Chicken/bin/Debug/net6.0/Chickensoft.Chicken.dll",
"args": [
"create",
"BestGodot3Game",
"-e",
"[email protected]:chickensoft-games/godot_3_game.git",
"--",
"--title",
"BestGodot3Game"
],
"cwd": "${workspaceFolder}/Chicken",
"cwd": "${workspaceFolder}/GodotEnv",
"console": "integratedTerminal",
"stopAtEntry": false,
"internalConsoleOptions": "neverOpen"
Expand Down
166 changes: 166 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"[csharp]": {
"editor.codeActionsOnSave": {
"source.addMissingImports": true,
"source.fixAll": false,
"source.organizeImports": true
},
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": false
},
"csharp.semanticHighlighting.enabled": true,
"editor.semanticHighlighting.enabled": true,
// C# doc comment colorization gets lost with semantic highlighting, but we
// need semantic highlighting for proper syntax highlighting with record
// shorthand.
//
// Here's a workaround for doc comment highlighting from
// https://github.com/OmniSharp/omnisharp-vscode/issues/3816
"editor.tokenColorCustomizations": {
"[*Dark*]": {
// Themes that include the word "Dark" in them.
"textMateRules": [
{
"scope": "comment.documentation",
"settings": {
"foreground": "#608B4E"
}
},
{
"scope": "comment.documentation.attribute",
"settings": {
"foreground": "#C8C8C8"
}
},
{
"scope": "comment.documentation.cdata",
"settings": {
"foreground": "#E9D585"
}
},
{
"scope": "comment.documentation.delimiter",
"settings": {
"foreground": "#808080"
}
},
{
"scope": "comment.documentation.name",
"settings": {
"foreground": "#569CD6"
}
}
]
},
"[*Light*]": {
// Themes that include the word "Light" in them.
"textMateRules": [
{
"scope": "comment.documentation",
"settings": {
"foreground": "#008000"
}
},
{
"scope": "comment.documentation.attribute",
"settings": {
"foreground": "#282828"
}
},
{
"scope": "comment.documentation.cdata",
"settings": {
"foreground": "#808080"
}
},
{
"scope": "comment.documentation.delimiter",
"settings": {
"foreground": "#808080"
}
},
{
"scope": "comment.documentation.name",
"settings": {
"foreground": "#808080"
}
}
]
},
"[*]": {
// Themes that don't include the word "Dark" or "Light" in them.
// These are some bold colors that show up well against most dark and
// light themes.
//
// Change them to something that goes well with your preferred theme :)
"textMateRules": [
{
"scope": "comment.documentation",
"settings": {
"foreground": "#0091ff"
}
},
{
"scope": "comment.documentation.attribute",
"settings": {
"foreground": "#8480ff"
}
},
{
"scope": "comment.documentation.cdata",
"settings": {
"foreground": "#0091ff"
}
},
{
"scope": "comment.documentation.delimiter",
"settings": {
"foreground": "#aa00ff"
}
},
{
"scope": "comment.documentation.name",
"settings": {
"foreground": "#ef0074"
}
}
]
}
},
"markdownlint.config": {
// Allow html in markdown.
"MD033": false,
// Allow non-unique heading names so we don't break the changelog.
"MD024": false
},
"markdownlint.ignore": [
"**/LICENSE"
],
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableMsBuildLoadProjectsOnDemand": false,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.maxFindSymbolsItems": 3000,
"omnisharp.organizeImportsOnFormat": true,
"omnisharp.useModernNet": true,
// Remove these if you're happy with your terminal profiles.
"terminal.integrated.defaultProfile.windows": "Git Bash",
"terminal.integrated.profiles.windows": {
"Command Prompt": {
"icon": "terminal-cmd",
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
]
},
"Git Bash": {
"icon": "terminal",
"source": "Git Bash"
},
"PowerShell": {
"icon": "terminal-powershell",
"source": "PowerShell"
}
},
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
}
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/Chicken/Chickensoft.Chicken.csproj",
"${workspaceFolder}/GodotEnv/Chickensoft.GodotEnv.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Chicken/Chickensoft.Chicken.csproj",
"${workspaceFolder}/GodotEnv/Chickensoft.GodotEnv.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/Chicken/Chickensoft.Chicken.csproj"
"${workspaceFolder}/GodotEnv/Chickensoft.GodotEnv.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

Thank you for your interest!

The general development flow consists of opening the subfolder `Chicken` and changing the code up as needed, and then creating or updating tests in the `Chicken.Tests` folder. You can open the root of the repo in VSCode to debug the app from the command line, but most test runs will likely be for running tests, which VSCode will allow you to do from the test file itself (make sure you have the code lens testing features enabled).
The general development flow consists of opening the subfolder `GodotEnv` and changing the code up as needed, and then creating or updating tests in the `GodotEnv.Tests` folder. You can open the root of the repo in VSCode to debug the app from the command line, but most test runs will likely be for running tests, which VSCode will allow you to do from the test file itself (make sure you have the code lens testing features enabled).

For checking test coverage (we require 100%), make sure you have [reportgenerator] installed:
To collect test coverage, you can use [reportgenerator]:

```sh
dotnet tool install -g dotnet-reportgenerator-globaltool
```

From the `Chicken.Tests` folder you can then run the following (in bash) to generate coverage.
From the `GodotEnv.Tests` folder you can then run the following (in bash) to generate coverage.

```sh
./coverage.sh
```

To run (but not debug) the tool locally, run the following from the `Chicken` folder.
To run (but not debug) the tool locally, run the following from the `GodotEnv` folder.

```sh
dotnet build
dotnet run -- --help
```

You can pass command line flags to Chicken after the double dashes `--`.
You can pass command line flags to GodotEnv after the double dashes `--`.

Lastly, you can debug the command line tool via the `Debug Chicken CLI` debug configuration in VSCode. Since this profile runs Chicken from it's project directory, it will look for an `addons.json` file in `Chicken/addons.json` and install addons to `Chicken/addons`.
Lastly, you can debug the command line tool via the `Debug GodotEnv CLI` debug configuration in VSCode. An input will open in VSCode which will allow you to type in the command line args you'd like to run the application with before debugging, making it easy to test certain commands and inputs. Since this profile runs the app from it's project directory, it will look for an `addons.json` file in `GodotEnv/addons.json` and install addons to `GodotEnv/addons` when using addons-related commands.

> `Chicken/addons`, `Chicken/.addons`, and `Chicken/addons.json` have been added to `.gitignore` so that you can create them and debug with them as needed.
> `GodotEnv/addons`, `GodotEnv/.addons`, and `GodotEnv/addons.json` have been added to `.gitignore` so that you can create them and debug with them as needed.

[reportgenerator]: https://github.com/danielpalme/ReportGenerator
Loading