Skip to content

Commit

Permalink
(undo) limit godot-itest to parse version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Oct 12, 2023
1 parent c004809 commit 1af9af3
Showing 1 changed file with 74 additions and 3 deletions.
77 changes: 74 additions & 3 deletions .github/composite/godot-itest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,82 @@ runs:
- name: "Inspect Godot version"
run: |
godotVer=$($GODOT4_BIN --version | xargs)
echo ":heavy_check_mark: Version \`$godotVer\`" >> $GITHUB_STEP_SUMMARY
gitSha=$(echo $godotVer | sed -E "s/.+custom_build\.//")
echo "GODOT_BUILT_FROM=_Built from [\`$godotVer\`](https://github.com/godotengine/godot/commit/$gitSha)._" >> $GITHUB_ENV
shell: bash

- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: ${{ inputs.rust-toolchain }}
with-llvm: ${{ inputs.with-llvm }}

- name: "Patch prebuilt version ({{ inputs.godot-prebuilt-patch }})"
if: inputs.godot-prebuilt-patch != ''
env:
VERSION: ${{ inputs.godot-prebuilt-patch }}
# sed -i'' needed for macOS compatibility, see https://stackoverflow.com/q/4247068
run: |
echo "Patch prebuilt version to $VERSION..."
# Reduce version to "major.minor" format
apiVersion=$(echo $VERSION | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')
# For newer versions, update the compatibility_minimum in .gdextension files to the respective version.
# Nothing needs to be done for 4.0.x, as compatibility_minimum didn't exist back then.
if [[ "$apiVersion" == "4.2" ]]; then
echo "Update compatibility_minimum in .gdextension files to '$apiVersion'..."
dirs=("itest" "examples")
for dir in "${dirs[@]}"; do
find "$dir" -type f -name "*.gdextension" -exec sed -i'.bak' 's/compatibility_minimum = 4\.1/compatibility_minimum = $apiVersion/' {} +
done
# Apply Cargo.toml patch for godot4-prebuilt crate
else
# Patch only needed if version is not already set
if grep -E 'godot4-prebuilt = { .+ branch = "$VERSION" }' godot-bindings/Cargo.toml; then
echo "Already has version $version; no need for patch."
else
cat << HEREDOC >> Cargo.toml
[patch."https://github.com/godot-rust/godot4-prebuilt"]
godot4-prebuilt = { git = "https://github.com//godot-rust/godot4-prebuilt", branch = "$VERSION" }
HEREDOC
echo "Patched Cargo.toml for version $version."
fi
fi
shell: bash

# else
- name: "No patch selected"
if: inputs.godot-prebuilt-patch == ''
run: |
echo "No patch selected; use default godot4-prebuilt version."
shell: bash

- name: "Build gdext (itest)"
env:
RUSTFLAGS: ${{ inputs.rust-env-rustflags }}
TARGET: ${{ inputs.rust-target }}
run: |
cargo build -p godot-ffi
echo "OUTCOME=success" >> $GITHUB_ENV
shell: bash

- name: "Conclusion"
if: failure()
if: always()
run: |
echo ":x: Failed to get version" >> $GITHUB_STEP_SUMMARY
echo "Evaluate conclusion: $OUTCOME"
case $OUTCOME in
"success")
# Do not output success for now, to keep summary focused on warnings/errors
#echo "### :heavy_check_mark: $GODOT_BUILT_FROM" > $GITHUB_STEP_SUMMARY
;;
*)
echo "### :x: Build failed" > $GITHUB_STEP_SUMMARY
exit 5
;;
esac
shell: bash

0 comments on commit 1af9af3

Please sign in to comment.