Skip to content

Commit

Permalink
ci: add gdext to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Aug 1, 2024
1 parent 5498b3e commit 343ab67
Show file tree
Hide file tree
Showing 130 changed files with 191 additions and 8 deletions.
87 changes: 81 additions & 6 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,100 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json

# We need to include this action here instead of in another workflow since
# workflows aren't triggered by other workflows.
publish:
build:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
name: Build for ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch: x86_64
artifact_name: librivet_plugin_godot.so
- os: macos-latest
target: x86_64-apple-darwin
arch: x86_64
artifact_name: librivet_plugin_godot.dylib
- os: macos-latest
target: aarch64-apple-darwin
arch: arm64
artifact_name: librivet_plugin_godot.dylib
- os: windows-latest
target: x86_64-pc-windows-msvc
arch: x86_64
artifact_name: rivet_plugin_godot.dll

steps:
- uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Build
run: |
cd rust/rivet-plugin-godot
cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-cdylib
path: rust/target/${{ matrix.target }}/release/${{ matrix.artifact_name }}

publish:
needs: [release-please, build]
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
name: Publish new version to Godot Asset Store
name: Publish to Godot Asset Store

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

- name: Replace placeholders in asset template
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Prepare release assets
run: |
rm -rf godot/addons/rivet/native/
mkdir -p godot/addons/rivet/native/
cp artifacts/ubuntu-latest-x86_64-cdylib/* godot/addons/rivet/native/linux-x86_64/
cp artifacts/windows-latest-x86_64-cdylib/* godot/addons/rivet/native/windows-x86_64/
cp artifacts/macos-latest-x86_64-cdylib/* godot/addons/rivet/native/macos-x86_64/
cp artifacts/macos-latest-arm64-cdylib/* godot/addons/rivet/native/macos-arm64/
sed -i 's/{{ context.release.tag_name }}/${{ needs.release-please.outputs.tag_name }}/g' .asset-template.json
sed -i 's/{{ env.GITHUB_SHA }}/${{ needs.release-please.outputs.release_sha }}/g' .asset-template.json
- name: Update gdextension config
run: |
cat > godot/addons/rivet/rivet_toolchain.gdextension << EOL
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.1
reloadable = true
[libraries]
linux.debug.x86_64 = "res://addons/rivet/native/linux-x86_64/librivet_plugin_godot.so"
linux.release.x86_64 = "res://addons/rivet/native/linux-x86_64/librivet_plugin_godot.so"
windows.debug.x86_64 = "res://addons/rivet/native/windows-x86_64/rivet_plugin_godot.dll"
windows.release.x86_64 = "res://addons/rivet/native/windows-x86_64/rivet_plugin_godot.dll"
macos.debug.x86_64 = "res://addons/rivet/native/macos-x86_64/librivet_plugin_godot.dylib"
macos.release.x86_64 = "res://addons/rivet/native/macos-x86_64/librivet_plugin_godot.dylib"
macos.debug.arm64 = "res://addons/rivet/native/macos-arm64/librivet_plugin_godot.dylib"
macos.release.arm64 = "res://addons/rivet/native/macos-arm64/librivet_plugin_godot.dylib"
EOL
- name: Godot Asset Lib
uses: deep-entertainment/[email protected]
working-directory: godot/
with:
action: addEdit
username: ${{ secrets.GODOT_ASSET_LIBRARY_USERNAME }}
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: test

on:
pull_request:

permissions:
contents: write
pull-requests: write

jobs:
build:
name: Build for ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
arch: x86_64
artifact_name: librivet_plugin_godot.so
- os: macos-latest
target: x86_64-apple-darwin
arch: x86_64
artifact_name: librivet_plugin_godot.dylib
- os: macos-latest
target: aarch64-apple-darwin
arch: arm64
artifact_name: librivet_plugin_godot.dylib
- os: windows-latest
target: x86_64-pc-windows-msvc
arch: x86_64
artifact_name: rivet_plugin_godot.dll

steps:
- uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Build
run: |
cd rust/rivet-plugin-godot
cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.arch }}-cdylib
path: rust/target/${{ matrix.target }}/release/${{ matrix.artifact_name }}

publish:
needs: [build]
runs-on: ubuntu-latest
name: Publish to Godot Asset Store

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

- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Prepare release assets
run: |
rm -rf addons/rivet/native/
mkdir -p addons/rivet/native/
cp artifacts/ubuntu-latest-x86_64-cdylib/* addons/rivet/native/linux-x86_64/
cp artifacts/windows-latest-x86_64-cdylib/* addons/rivet/native/windows-x86_64/
cp artifacts/macos-latest-x86_64-cdylib/* addons/rivet/native/macos-x86_64/
cp artifacts/macos-latest-arm64-cdylib/* addons/rivet/native/macos-arm64/
sed -i 's/{{ context.release.tag_name }}/${{ needs.release-please.outputs.tag_name }}/g' .asset-template.json
sed -i 's/{{ env.GITHUB_SHA }}/${{ needs.release-please.outputs.release_sha }}/g' .asset-template.json
- name: Update gdextension config
run: |
cat > addons/rivet/rivet_toolchain.gdextension << EOL
[configuration]
entry_symbol = "gdext_rust_init"
compatibility_minimum = 4.1
reloadable = true
[libraries]
linux.debug.x86_64 = "res://addons/rivet/native/linux-x86_64/librivet_plugin_godot.so"
linux.release.x86_64 = "res://addons/rivet/native/linux-x86_64/librivet_plugin_godot.so"
windows.debug.x86_64 = "res://addons/rivet/native/windows-x86_64/rivet_plugin_godot.dll"
windows.release.x86_64 = "res://addons/rivet/native/windows-x86_64/rivet_plugin_godot.dll"
macos.debug.x86_64 = "res://addons/rivet/native/macos-x86_64/librivet_plugin_godot.dylib"
macos.release.x86_64 = "res://addons/rivet/native/macos-x86_64/librivet_plugin_godot.dylib"
macos.debug.arm64 = "res://addons/rivet/native/macos-arm64/librivet_plugin_godot.dylib"
macos.release.arm64 = "res://addons/rivet/native/macos-arm64/librivet_plugin_godot.dylib"
EOL
- name: Godot Asset Lib
uses: deep-entertainment/[email protected]
with:
action: addEdit
username: ${{ secrets.GODOT_ASSET_LIBRARY_USERNAME }}
password: ${{ secrets.GODOT_ASSET_LIBRARY_PASSWORD }}
assetId: 1881
assetTemplate: .asset-template.json
baseUrl: https://godotengine.org/asset-library/api
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
1 change: 1 addition & 0 deletions addons/rivet/native/target
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion godot/addons/rivet/native/target

This file was deleted.

3 changes: 2 additions & 1 deletion rust/rivet-plugin-godot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ godot = { git = "https://github.com/godot-rust/gdext", branch = "master", featur
serde = "1.0"
serde_json = "1.0"
tokio = { version = "1.27", default-features = false, features = ["rt"] }
toolchain = { path = "../../../cli/rivet-toolchain", package = "rivet-toolchain" }
# toolchain = { path = "../../../cli/rivet-toolchain", package = "rivet-toolchain" }
toolchain = { git = "https://github.com/rivet-gg/cli.git", rev = "f2fde5227f4672e408e54d2f95d017a919f39b4b", package = "rivet-toolchain" }

0 comments on commit 343ab67

Please sign in to comment.