-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
name: Build FLIP Fluids for Windows | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup MSYS2 | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: MINGW64 | ||
update: true | ||
install: mingw-w64-x86_64-toolchain | ||
|
||
- name: Create MSYS2 cache directory | ||
run: | | ||
if (-Not (Test-Path 'msys64')) { | ||
New-Item -ItemType Directory -Path 'msys64' | ||
} | ||
shell: pwsh | ||
|
||
- name: Cache MSYS2 | ||
uses: actions/cache@v3 | ||
with: | ||
path: msys64 | ||
key: msys2 | ${{ runner.os }} | ${{ hashFiles('**/build.py') }} | ||
restore-keys: | | ||
msys2 | ${{ runner.os }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Create Python cache directories | ||
run: | | ||
if (-Not (Test-Path "$env:USERPROFILE\.cache\pip")) { | ||
New-Item -ItemType Directory -Path "$env:USERPROFILE\.cache\pip" | ||
} | ||
if (-Not (Test-Path "$env:USERPROFILE\.local")) { | ||
New-Item -ItemType Directory -Path "$env:USERPROFILE\.local" | ||
} | ||
shell: pwsh | ||
|
||
- name: Cache Python packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ env.HOME }}\.cache\pip | ||
${{ env.HOME }}\.local | ||
key: python-packages | ${{ hashFiles('requirements.txt') }} | ||
|
||
if: exists('${{ env.HOME }}\\.cache\\pip') || exists('${{ env.HOME }}\\.local') | ||
|
||
- name: Install Python packages | ||
run: pip install -r requirements.txt | ||
|
||
- name: Cache Python packages after install | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ env.HOME }}\.cache\pip | ||
${{ env.HOME }}\.local | ||
key: python-packages | ${{ hashFiles('requirements.txt') }} | ${{ runner.os }} | ||
|
||
if: steps.cache-python.outputs.cache-hit != 'true' | ||
|
||
- name: Install CMake | ||
uses: jwlawson/actions-setup-cmake@v1.14 | ||
|
||
- name: Add MinGW to PATH | ||
run: echo "${{ github.workspace }}/msys64/mingw64/bin" >> $GITHUB_PATH | ||
shell: bash | ||
|
||
- name: Clone FLIP Fluids repository | ||
run: git clone https://github.com/rlguy/Blender-FLIP-Fluids.git | ||
|
||
- name: Build FLIP Fluids | ||
id: build_flip_fluids | ||
run: | | ||
cd Blender-FLIP-Fluids | ||
export LC_ALL=C.UTF-8 | ||
|
||
output=$(python build.py) | ||
echo "$output" | ||
|
||
version=$(echo "$output" | grep -o 'FLIP Fluids version [0-9]\+\.[0-9]\+\.[0-9]\+' | awk '{print $4}' | sort -u | head -n 1) | ||
|
||
if [[ -z "$version" ]]; then | ||
echo "Error: Version not found in output." | ||
exit 1 | ||
else | ||
|
||
trimmed_version=$(echo "$version" | xargs) | ||
|
||
echo "Extracted Version: ${trimmed_version}" | ||
|
||
echo "FLIP_FLUIDS_VERSION=${trimmed_version}" >> $GITHUB_ENV | ||
fi | ||
shell: bash | ||
|
||
- name: List build directory | ||
run: dir ./Blender-FLIP-Fluids/build/ | ||
|
||
- name: Create zip file for the add-on | ||
run: | | ||
$zipFile = './Blender-FLIP-Fluids/build/flip_fluids_addon.zip' | ||
$source = './Blender-FLIP-Fluids/build/bl_flip_fluids/flip_fluids_addon' | ||
if (Test-Path $source) { | ||
Compress-Archive -Path $source -DestinationPath $zipFile -Force | ||
Write-Host "Created zip file: $zipFile" | ||
} else { | ||
Write-Host "Source directory not found: $source" | ||
exit 1 | ||
} | ||
shell: pwsh | ||
|
||
- name: Check if zip file exists | ||
run: | | ||
if (Test-Path './Blender-FLIP-Fluids/build/flip_fluids_addon.zip') { | ||
Write-Host "File exists" | ||
} else { | ||
Write-Host "Zip file does not exist" | ||
exit 1 | ||
} | ||
shell: pwsh | ||
|
||
- name: Upload compiled addon | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: flip-fluids-addon | ||
path: Blender-FLIP-Fluids/build/ | ||
if: success() | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
make_latest: true | ||
name: Release_${{ env.FLIP_FLUIDS_VERSION }} | ||
tag_name: v${{ env.FLIP_FLUIDS_VERSION }} | ||
files: ./Blender-FLIP-Fluids/build/flip_fluids_addon.zip | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' |