92 lines
3.0 KiB
YAML
92 lines
3.0 KiB
YAML
name: "Setup Godot"
|
|
description: "This GitHub Action automates the setup of Godot"
|
|
author: Mike Schulze <mikeschulze.lpz@gmail.com>
|
|
|
|
inputs:
|
|
godot-version:
|
|
description: "The version of Godot in which the tests should be run."
|
|
required: true
|
|
godot-status:
|
|
description: 'The Godot status (e.g., "stable", "rc1", "dev1")'
|
|
required: false
|
|
default: "stable"
|
|
dotnet-version:
|
|
description: 'The used .NET version to run the test (e.g. "net7.0", "net8.0")'
|
|
required: false
|
|
default: net8.0
|
|
project_dir:
|
|
description: "The project directory in which the action is to be executed. The specified directory must end with a path separator. e.g. ./MyProject/"
|
|
required: false
|
|
default: "./"
|
|
|
|
outputs:
|
|
godot_bin:
|
|
description: "The location of the godot executable"
|
|
value: /home/runner/godot-linux/godot
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Set Cache Name"
|
|
shell: bash
|
|
run: |
|
|
echo "CACHE_NAME=${{ runner.OS }}-Godot_v${{ inputs.godot-version }}-${{ inputs.godot-status }}-${{ inputs.dotnet-version }}" >> "$GITHUB_ENV"
|
|
|
|
- name: "Build Cache"
|
|
uses: actions/cache@v5
|
|
id: godot-cache-binary
|
|
with:
|
|
path: "/home/runner/godot-linux"
|
|
key: ${{ env.CACHE_NAME }}
|
|
restore-keys: ${{ env.CACHE_NAME }}
|
|
enableCrossOsArchive: true
|
|
|
|
- name: "Install Godot ${{ inputs.godot-version }}"
|
|
if: steps.godot-cache-binary.outputs.cache-hit != 'true'
|
|
uses: ./.gdunit4_action/godot-install
|
|
with:
|
|
godot-version: ${{ inputs.godot-version }}
|
|
godot-net: true
|
|
godot-status-version: ${{ inputs.godot-status }}
|
|
install-path: "/home/runner/godot-linux"
|
|
|
|
- name: "print restored version - ${{ inputs.godot-version }}"
|
|
shell: bash
|
|
run: |
|
|
/home/runner/godot-linux/godot --version
|
|
|
|
- name: "Set .NET SDK version"
|
|
if: ${{ steps.version_check.outcome == 'success' && !cancelled() }}
|
|
shell: bash
|
|
run: |
|
|
sdk_version=$(echo "${{ inputs.dotnet-version }}" | sed 's/^net\([0-9]\.[0-9]\)$/\1.x/')
|
|
echo "SDK_VERSION=$sdk_version" >> "$GITHUB_ENV"
|
|
echo "Using .NET version: '$sdk_version'"
|
|
|
|
- name: "Setup .NET SDK"
|
|
if: ${{ steps.version_check.outcome == 'success' && !cancelled() }}
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "${{ env.SDK_VERSION }}"
|
|
|
|
- name: "Restore .Net Project"
|
|
if: ${{ steps.version_check.outcome == 'success' && !cancelled() }}
|
|
shell: bash
|
|
run: |
|
|
cd "${{ inputs.project_dir }}"
|
|
|
|
dotnet --version
|
|
dotnet build
|
|
dotnet list package
|
|
|
|
- name: "Restore Godot project cache"
|
|
if: ${{ steps.version_check.outcome == 'success' && !cancelled() }}
|
|
env:
|
|
GODOT_BIN: "/home/runner/godot-linux/godot"
|
|
shell: bash
|
|
run: |
|
|
cd "${{ inputs.project_dir }}"
|
|
echo -e "\e[94mStart of the recovery of the project cache ...\e[0m"
|
|
$GODOT_BIN --path ./ -e --headless --quit-after 2000
|
|
echo -e "\e[94mProject cache successfully restored.\e[0m"
|