Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
lokimckay committed Jun 2, 2024
0 parents commit 9342c01
Show file tree
Hide file tree
Showing 107 changed files with 7,080 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

# LFS
*.png filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.glb filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
27 changes: 27 additions & 0 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Full CI

on:
push:
paths:
- "addons/godot-rapier-3d/**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Regex for a version number such as v0.2.1
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened

jobs:
build:
uses: ./.github/workflows/jobs-build.yml

test:
uses: ./.github/workflows/jobs-test.yml
needs: [build]

release:
uses: ./.github/workflows/jobs-release.yml
needs: [build, test]
204 changes: 204 additions & 0 deletions .github/workflows/jobs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
name: jobs/build

on:
workflow_call:

env:
ADDON_DIR: addons/godot-rapier-3d
RUST_DIR: addons/godot-rapier-3d/rust
BIN_DIR: addons/godot-rapier-3d/bin

jobs:
build:
name: Build - ${{ matrix.release_for }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- release_for: linux-gnu32
runner: ubuntu-latest
target: i686-unknown-linux-gnu
compiler: cross
archive: linux-gnu-x86_32
archive_ext: .tar.gz
bin: libgodot_rapier_3d.so

- release_for: linux-gnu64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
compiler: cross
archive: linux-gnu-x86_64
archive_ext: .tar.gz
bin: libgodot_rapier_3d.so

- release_for: linux-arm64
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
compiler: cross
archive: linux-arm64
archive_ext: .tar.gz
bin: libgodot_rapier_3d.so

- release_for: windows-msvc32
runner: windows-latest
target: i686-pc-windows-msvc
compiler: cross
archive: windows-msvc-x86_32
archive_ext: .zip
bin: godot_rapier_3d.dll

- release_for: windows-msvc64
runner: windows-latest
target: x86_64-pc-windows-msvc
compiler: cross
archive: windows-msvc-x86_64
archive_ext: .zip
bin: godot_rapier_3d.dll

- release_for: macos-amd64
runner: macos-latest
target: x86_64-apple-darwin
compiler: cross
archive: macos-amd-x86_64
archive_ext: .zip
bin: libgodot_rapier_3d.dylib

- release_for: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
compiler: cross
archive: macos-arm-x86_64
archive_ext: .zip
bin: libgodot_rapier_3d.dylib

steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1 # https://bun.sh/guides/runtime/cicd

- name: Cache rust target dir
id: cache-rust-target
uses: actions/cache@v4
with:
key: cache-rust-target-${{ hashFiles('addons/godot-rapier-3d/rust/Cargo.lock') }}
path: "${{ env.RUST_DIR }}/target"

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install Cross
if: matrix.compiler == 'cross'
shell: bash
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cross
working-directory: ${{ env.RUST_DIR }}

- name: Build rust binary
run: ${{ matrix.compiler }} build --verbose --locked --release --target ${{ matrix.target }}
working-directory: ${{ env.RUST_DIR }}

- name: Move rust binary
run: |
mkdir ${{ env.BIN_DIR }}
mv ${{ env.RUST_DIR }}/target/${{ matrix.target }}/release/${{ matrix.bin }} ${{ env.BIN_DIR }}/${{ matrix.target }}-${{ matrix.bin }}
- name: Replace .gdextension config
shell: bash
run: |
rm godot-rapier-3d.gdextension
mv godot-rapier-3d.gdext.dist godot-rapier-3d.gdextension
- name: Add VERSION.txt
shell: bash
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
${{ env.VERSION }} > ${{ env.ADDON_DIR }}/VERSION.txt
- name: Copy LICENSE.txt
run: cp LICENSE.txt ${{ env.ADDON_DIR }}

- name: Package as archive
shell: bash
run: |
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
7z a godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }} -xr!rust ./addons/
7z a godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }} godot-rapier-3d.gdextension
7z l godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }}
else
tar czvf godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }} --exclude=rust ./addons/godot-rapier-3d/ godot-rapier-3d.gdextension
tar ztvf godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }}
fi
- name: Upload rust binary artifact
uses: actions/upload-artifact@v4
with:
name: gr3d-rust-binary-${{ matrix.release_for }}
path: "${{ env.BIN_DIR }}/*godot_rapier_3d*"

- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: godot-rapier-3d--${{ matrix.archive }}${{ matrix.archive_ext }}
path: "godot-rapier-3d-*"

- name: bun ci/debug.ts
shell: bash
run: bun ci/debug.ts
if: always()

# ---

package:
name: Package all binaries
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1 # https://bun.sh/guides/runtime/cicd

- name: Download all rust binary artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: gr3d-rust-binary-*
path: ${{ env.BIN_DIR }}

- name: Replace .gdextension config
shell: bash
run: |
rm godot-rapier-3d.gdextension
mv godot-rapier-3d.gdext.dist godot-rapier-3d.gdextension
- name: Add VERSION.txt
shell: bash
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
${{ env.VERSION }} > ${{ env.ADDON_DIR }}/VERSION.txt
- name: Copy LICENSE.txt
run: cp LICENSE.txt ${{ env.ADDON_DIR }}

- name: Create package
run: |
7z a godot-rapier-3d--all.zip -xr!rust ./addons/
7z a godot-rapier-3d--all.zip -xr!rust godot-rapier-3d.gdextension
tar czvf godot-rapier-3d--all.tar.gz --exclude=rust ./addons/godot-rapier-3d/ godot-rapier-3d.gdextension
- name: Upload .zip
uses: actions/upload-artifact@v4
with:
name: godot-rapier-3d--all.zip
path: "godot-rapier-3d--all.zip"

- name: Upload .tar.gz
uses: actions/upload-artifact@v4
with:
name: godot-rapier-3d--all.tar.gz
path: "godot-rapier-3d--all.tar.gz"

- name: bun ci/debug.ts
shell: bash
run: bun ci/debug.ts
if: always()
38 changes: 38 additions & 0 deletions .github/workflows/jobs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: jobs/release

on:
workflow_call:

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1 # https://bun.sh/guides/runtime/cicd

- name: Download all packages
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: godot-rapier-3d-*

- name: Download determinism diffs
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: determinism-diffs*

- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
godot-rapier-3d-*
determinism-diffs.zip
generate_release_notes: true

- name: bun ci/debug.ts
shell: bash
run: bun ci/debug.ts
if: always()
Loading

0 comments on commit 9342c01

Please sign in to comment.