mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
38381f44b9
To avoid running in a situation when some builds are using one tag and some are using another and then unstable repo script fails to find builds for some platforms.
187 lines
6.6 KiB
YAML
187 lines
6.6 KiB
YAML
name: ci-bonsai-daily
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '.github/workflows/ci-bonsai-daily.yml'
|
|
- 'src/bonsai/**'
|
|
- 'src/ifcopenshell-python/ifcopenshell/**'
|
|
- 'src/bcf/bcf/**'
|
|
- 'src/ifcclash/ifcclash/**'
|
|
- 'src/ifccobie/**'
|
|
- 'src/ifcdiff/**'
|
|
- 'src/ifccsv/**'
|
|
- 'src/ifcpatch/ifcpatch/**'
|
|
- 'src/ifc4d/ifc4d/**'
|
|
- 'src/ifc5d/ifc5d/**'
|
|
- 'src/ifccityjson/**'
|
|
branches:
|
|
- v0.8.0
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
activate:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.repository == 'IfcOpenShell/IfcOpenShell'
|
|
outputs:
|
|
timestamp: ${{ steps.timestamp.outputs.timestamp }}
|
|
steps:
|
|
- name: Get current timestamp
|
|
id: timestamp
|
|
# Include hours and minutes to release tag
|
|
# to avoid possibility of unstable repo's index.json
|
|
# pointing to the new file when index.json itself wasn't yet updated.
|
|
run: echo "timestamp=$(date +'%y%m%d%H%M')" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
needs: activate
|
|
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
pyver: [py311, py312, py313]
|
|
config:
|
|
- {
|
|
name: "Windows Build",
|
|
short_name: win,
|
|
}
|
|
- {
|
|
name: "Linux Build",
|
|
short_name: linux,
|
|
}
|
|
- {
|
|
name: "MacOS Build",
|
|
short_name: macos,
|
|
}
|
|
- {
|
|
name: "MacOS ARM Build",
|
|
short_name: macosm1,
|
|
}
|
|
exclude:
|
|
# Python 3.13 is needed for Blender 5.1+ and Blender dropped Intel Mac support in 5.0.
|
|
- pyver: py313
|
|
config:
|
|
short_name: macos
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
|
with:
|
|
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
|
python-version: '3.11'
|
|
- name: Get current version
|
|
id: version
|
|
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
|
|
- name: Compile
|
|
run: |
|
|
cd src/bonsai && make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }}
|
|
- name: Find zip file name
|
|
id: find_zip
|
|
run: |
|
|
filepath=$(ls src/bonsai/dist/bonsai_*.zip)
|
|
echo "filepath=$filepath" >> $GITHUB_OUTPUT
|
|
echo "filename=$(basename $filepath)" >> $GITHUB_OUTPUT
|
|
- name: Upload zip file to release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: ${{ steps.find_zip.outputs.filepath }}
|
|
asset_name: ${{ steps.find_zip.outputs.filename }}
|
|
release_name: "bonsai-${{steps.version.outputs.version}}-alpha${{ needs.activate.outputs.timestamp }} (unstable)"
|
|
tag: "bonsai-${{steps.version.outputs.version}}-alpha${{ needs.activate.outputs.timestamp }}"
|
|
overwrite: true
|
|
body: "See README in https://github.com/IfcOpenShell/bonsai_unstable_repo/ on how to setup autoupdates for daily Bonsai builds."
|
|
|
|
update-extensions-repo-and-run-tests:
|
|
needs: [build]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout bonsai_unstable_repo repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: IfcOpenShell/bonsai_unstable_repo
|
|
token: ${{ secrets.IFCOPENBOT_TOKEN }}
|
|
path: bonsai_unstable_repo
|
|
|
|
- name: Download Blender and run critical tests
|
|
run: |
|
|
# Ensure Bonsai and ifcsverchok enable/disable works before uploading to extensions repo.
|
|
|
|
# Download Blender.
|
|
wget -q -O blender.tar.xz https://download.blender.org/release/Blender5.0/blender-5.0.1-linux-x64.tar.xz
|
|
tar -xf blender.tar.xz
|
|
|
|
# Setup Blender.
|
|
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
|
|
export PATH="$PATH:$BLENDER_PATH"
|
|
blender --version
|
|
|
|
# Setup unstable repo to get Bonsai build.
|
|
cd bonsai_unstable_repo
|
|
pip install -r requirements.txt
|
|
python setup_extensions_repo.py --last-tag
|
|
cd ..
|
|
bonsai_zip="$(pwd)/$(ls bonsai_unstable_repo/bonsai_py311*-linux-x64.zip)"
|
|
|
|
# Install Bonsai.
|
|
blender --command extension install-file -r user_default -e $bonsai_zip
|
|
blender --command extension list
|
|
|
|
git clone https://github.com/IfcOpenShell/IfcOpenShell.git IfcOpenShell
|
|
|
|
# Reregister Bonsai.
|
|
# Note that running it in background might miss some errors
|
|
# (e.g. tools are not registered in background mode).
|
|
blender --background --python IfcOpenShell/src/bonsai/scripts/reregister_bonsai.py
|
|
|
|
# Install sverchok.
|
|
wget -q -O sverchok.zip https://github.com/nortikin/sverchok/archive/refs/heads/master.zip
|
|
# ifcsverchok expecting sverchok to be named "sverchok" and not "sverchok-master".
|
|
unzip -q sverchok.zip
|
|
mv sverchok-master sverchok
|
|
zip -q -r sverchok.zip sverchok
|
|
rm -r sverchok
|
|
blender --command extension install-file -r user_default sverchok.zip
|
|
|
|
# Install ifcsverchok.
|
|
cd IfcOpenShell/src/ifcsverchok
|
|
make dist
|
|
sverchok_zip="$(pwd)/dist/$(ls dist)"
|
|
blender --command extension install-file -r user_default $sverchok_zip
|
|
|
|
- name: Update index.json on extensions repo
|
|
run: |
|
|
set -x -e
|
|
|
|
# Setup Blender.
|
|
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
|
|
export PATH="$PATH:$BLENDER_PATH"
|
|
blender --version
|
|
|
|
cd bonsai_unstable_repo
|
|
git config --global user.name 'IfcOpenBot'
|
|
git config --global user.email 'IfcOpenBot@users.noreply.github.com'
|
|
git add index.json
|
|
git add readme.md
|
|
git commit -m "Update index.json"
|
|
git push
|
|
|
|
- name: Run bonsai tests
|
|
run: |
|
|
set -x -e
|
|
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
|
|
export PATH="$PATH:$BLENDER_PATH"
|
|
blender --version
|
|
|
|
# Install Sun Position extension.
|
|
blender --online-mode --command extension sync
|
|
blender --online-mode --command extension install --enable --sync sun_position
|
|
|
|
cd IfcOpenShell/src/bonsai
|
|
pip install pytest-blender
|
|
pip install pytest-bdd
|
|
blender --background --python scripts/setup_pytest.py
|
|
blender --python-expr "import bonsai; print(bonsai.bbim_semver); import ifcopenshell; print(ifcopenshell.version)" --background
|
|
make test
|