Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aabbf87dda | |||
| 7e31787d37 | |||
| f1259587fd | |||
| 7f913e3af0 | |||
| 5433c34a4d | |||
| 2c52e93660 | |||
| 3c3b24cf98 | |||
| 3012b0ebcb | |||
| e3eb29daa4 | |||
| 3359c8f275 | |||
| cfc5007d00 | |||
| 0a630457be | |||
| fa124c2312 |
+211
-254
@@ -1,101 +1,110 @@
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
python: circleci/python@1.3.2
|
||||
# Using windows for builds
|
||||
win: circleci/windows@2.4.0
|
||||
# Upload artifacts to s3
|
||||
aws-s3: circleci/aws-s3@2.0.0
|
||||
|
||||
commands:
|
||||
install-specklepy-windows: # Reusable job for installing `specklepy` for windows machines
|
||||
parameters:
|
||||
python-version:
|
||||
type: string
|
||||
default: "" # leave blank for blender v2.93
|
||||
steps:
|
||||
- when:
|
||||
condition: << parameters.python-version >>
|
||||
steps:
|
||||
- run:
|
||||
name: Upgrade python version << parameters.python-version >>
|
||||
shell: powershell.exe
|
||||
command: |
|
||||
choco upgrade python --version=<< parameters.python-version >>
|
||||
refreshenv
|
||||
python --version
|
||||
- run:
|
||||
name: Install specklepy into modules directory
|
||||
shell: powershell.exe
|
||||
command: |
|
||||
$pyarr=(python --version).split(' ')[1].split('.')
|
||||
$pyver=($pyarr[0..1] -join '.')
|
||||
echo "using python version:" $pyver
|
||||
$specklepy=(python patch_version.py)
|
||||
python -m pip install --target=./modules-$pyver specklepy==$specklepy
|
||||
win: circleci/windows@5.0.0
|
||||
|
||||
jobs:
|
||||
build-connector-win: # Reusable job for basic connectors
|
||||
executor:
|
||||
name: win/default # comes with python 3.7.3
|
||||
shell: cmd.exe
|
||||
parameters:
|
||||
slug:
|
||||
type: string
|
||||
default: "blender"
|
||||
installer:
|
||||
type: boolean
|
||||
default: false
|
||||
package-connector:
|
||||
docker:
|
||||
- image: cimg/python:3.11.0
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Setup SEMVER value
|
||||
command: |
|
||||
SEMVER=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
|
||||
echo $SEMVER > ./SEMVER
|
||||
python3 patch_version.py $SEMVER
|
||||
- run:
|
||||
name: install dependencies
|
||||
command: poetry install --only main
|
||||
- run:
|
||||
name: export package dependencies
|
||||
command: ./export_dependencies.sh
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- bpy_speckle
|
||||
- patch_installer.py
|
||||
- SEMVER
|
||||
|
||||
build-connector-zip:
|
||||
docker:
|
||||
- image: cimg/python:3.11.0
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- install-specklepy-windows
|
||||
- install-specklepy-windows:
|
||||
python-version: "3.9.10"
|
||||
- install-specklepy-windows:
|
||||
python-version: "3.10.2"
|
||||
- run: &restore_semver
|
||||
name: Restore Semver
|
||||
command: SEMVER=$(cat ./SEMVER) && echo $SEMVER
|
||||
- run:
|
||||
name: Patch
|
||||
name: Package to Zip
|
||||
command: zip -r bpy_speckle.zip bpy_speckle
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- bpy_speckle.zip
|
||||
|
||||
get-ci-tools: # Clones our ci tools and persists them to the workspace
|
||||
docker:
|
||||
- image: cimg/base:2021.01
|
||||
steps:
|
||||
- add_ssh_keys:
|
||||
fingerprints:
|
||||
- "77:64:03:93:c5:f3:1d:a6:fd:bd:fb:d1:05:56:ca:e9"
|
||||
- run:
|
||||
name: I know Github as a host
|
||||
command: |
|
||||
mkdir ~/.ssh
|
||||
touch ~/.ssh/known_hosts
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
- run:
|
||||
name: Clone
|
||||
command: git clone git@github.com:specklesystems/speckle-sharp-ci-tools.git speckle-sharp-ci-tools
|
||||
- run:
|
||||
command: cd speckle-sharp-ci-tools
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools
|
||||
|
||||
build-installer-win:
|
||||
executor:
|
||||
name: win/default
|
||||
shell: cmd.exe
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Patch installer
|
||||
shell: powershell.exe
|
||||
command:
|
||||
| # If no tag, use 0.0.0.1 and don't make any YML (for testing only!)
|
||||
$tag = if([string]::IsNullOrEmpty($env:CIRCLE_TAG)) { "0.0.0" } else { $env:CIRCLE_TAG }
|
||||
$semver = if($tag.Contains('/')) {$tag.Split("/")[1] } else { $tag }
|
||||
$ver = if($semver.Contains('-')) {$semver.Split("-")[0] } else { $semver }
|
||||
$version = "$($ver).$($env:CIRCLE_BUILD_NUM)"
|
||||
$channel = if($semver.Contains('-')) { "prerelease" } else { "latest" }
|
||||
New-Item -Force "speckle-sharp-ci-tools/Installers/blender/$channel.yml" -ItemType File -Value "version: $semver"
|
||||
echo $semver
|
||||
python patch_version.py $semver
|
||||
command: python patch_installer.py (Get-Content -Raw SEMVER)
|
||||
- run:
|
||||
name: Create Innosetup signing cert
|
||||
shell: powershell.exe
|
||||
command: |
|
||||
echo $env:PFX_B64 > "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.txt"
|
||||
certutil -decode "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.txt" "speckle-sharp-ci-tools\SignTool\AEC Systems Ltd.pfx"
|
||||
- run:
|
||||
name: Installer
|
||||
shell: cmd.exe #does not work in powershell
|
||||
command: speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\blender.iss /Sbyparam=$p
|
||||
- when:
|
||||
condition: << parameters.installer >>
|
||||
steps:
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers/blender/blender-*.exe
|
||||
|
||||
build-connector-mac:
|
||||
build-installer-mac:
|
||||
macos:
|
||||
xcode: 12.5.1
|
||||
parameters:
|
||||
slug:
|
||||
type: string
|
||||
default: "blender-mac"
|
||||
installername:
|
||||
type: string
|
||||
default: "SpeckleBlenderInstall"
|
||||
runtime:
|
||||
type: string
|
||||
default: "osx-x64"
|
||||
installer:
|
||||
type: boolean
|
||||
default: false
|
||||
slug:
|
||||
type: string
|
||||
installer_path:
|
||||
type: string
|
||||
default: speckle-sharp-ci-tools/Mac/SpeckleBlenderInstall
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
@@ -108,90 +117,55 @@ jobs:
|
||||
- run:
|
||||
name: Install dotnet
|
||||
command: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin
|
||||
- run:
|
||||
name: Build & Patch Version
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/[a-zA-Z-]*\///')
|
||||
VER=$(echo "$SEMVER" | sed -e 's/-beta//')
|
||||
VERSION=$(echo $VER.$CIRCLE_BUILD_NUM)
|
||||
CHANNEL=$(if [[ "$VERSION" == *"-"* ]]; then echo $(cut -d "-" -f2 \<\<\< $VERSION); else echo latest; fi)
|
||||
mkdir -p speckle-sharp-ci-tools/Installers/<< parameters.slug >>
|
||||
if [ "${CIRCLE_TAG}" ]; then echo "version: $SEMVER" > "speckle-sharp-ci-tools/Installers/<< parameters.slug >>/$CHANNEL.yml"; fi
|
||||
python3 patch_version.py $SEMVER
|
||||
# update python and package dependencies
|
||||
- when:
|
||||
condition:
|
||||
and:
|
||||
# - << parameters.installer >>
|
||||
- equal: [osx-x64, << parameters.runtime >>]
|
||||
steps:
|
||||
- run:
|
||||
name: Install python 3.10
|
||||
command: |
|
||||
brew install python@3.10
|
||||
brew link --overwrite python@3.10
|
||||
- run:
|
||||
name: Package specklepy dependencies for blender 3.1 & 3.2
|
||||
command: |
|
||||
python3 --version
|
||||
python3 -m pip install --target=./modules-intel-3.10 specklepy==$(python3 -m patch_version)
|
||||
zip -r modules-intel-3.10.zip modules-intel-3.10/
|
||||
cp modules-intel-3.10.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
|
||||
- run:
|
||||
name: Zip Connector files
|
||||
command: |
|
||||
zip -r << parameters.slug >>.zip bpy_speckle/
|
||||
- run: *restore_semver
|
||||
- run:
|
||||
name: Copy connector files to installer
|
||||
command: |
|
||||
mkdir -p speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles/
|
||||
cp << parameters.slug >>.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
|
||||
python3 patch_version.py > speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles/specklepy_ver.yml
|
||||
|
||||
mkdir -p <<parameters.installer_path >>/.installationFiles/
|
||||
cp bpy_speckle.zip << parameters.installer_path >>/.installationFiles
|
||||
- run:
|
||||
name: Build Mac installer
|
||||
command: ~/.dotnet/dotnet publish speckle-sharp-ci-tools/Mac/<<parameters.installername>>/<<parameters.installername>>.sln -r << parameters.runtime >> -c Release
|
||||
command: ~/.dotnet/dotnet publish << parameters.installer_path >>/SpeckleBlenderInstall.sln -r << parameters.runtime >> -c Release
|
||||
- run:
|
||||
name: Zip installer
|
||||
command: |
|
||||
cd speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/<< parameters.runtime >>/
|
||||
zip -r << parameters.slug >>.zip ./
|
||||
- store_artifacts:
|
||||
path: speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/<< parameters.runtime >>/<< parameters.slug >>.zip
|
||||
- run:
|
||||
name: Copy to installer location
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/[a-zA-Z-]*\///')
|
||||
cp speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/<< parameters.runtime >>/<< parameters.slug >>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<< parameters.slug >>-$SEMVER.zip
|
||||
- when:
|
||||
condition: << parameters.installer >>
|
||||
steps:
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
SEMVER=$(cat ./SEMVER)
|
||||
echo $SEMVER
|
||||
mkdir -p speckle-sharp-ci-tools/Installers/blender
|
||||
(cd <<parameters.installer_path>>/bin/Release/net6.0/<< parameters.runtime >>/publish/ && zip -r - ./) > << parameters.slug >>-${SEMVER}.zip
|
||||
cp << parameters.slug >>-${SEMVER}.zip speckle-sharp-ci-tools/Installers/blender/
|
||||
|
||||
get-ci-tools: # Clones our ci tools and persists them to the workspace
|
||||
docker:
|
||||
- image: cimg/base:2021.01
|
||||
steps:
|
||||
- run: # Could not get ssh to work, so using a personal token
|
||||
name: Clone
|
||||
command: git clone https://$GITHUB_TOKEN@github.com/specklesystems/speckle-sharp-ci-tools.git speckle-sharp-ci-tools
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools
|
||||
- speckle-sharp-ci-tools/Installers/blender/<< parameters.slug >>*.zip
|
||||
|
||||
|
||||
deploy-connector-new:
|
||||
build-installer-manual:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
- image: cimg/base:2021.01
|
||||
parameters:
|
||||
slug:
|
||||
type: string
|
||||
default: bpy_speckle
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run: *restore_semver
|
||||
- run:
|
||||
name: Copy zip with semver
|
||||
command: |
|
||||
SEMVER=$(cat ./SEMVER)
|
||||
mkdir -p speckle-sharp-ci-tools/Installers/blender
|
||||
cp bpy_speckle.zip speckle-sharp-ci-tools/Installers/blender/<< parameters.slug >>-${SEMVER}.zip
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers/blender/<< parameters.slug >>*.zip
|
||||
|
||||
deploy-connector:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
parameters:
|
||||
file_slug:
|
||||
type: string
|
||||
os:
|
||||
@@ -208,143 +182,126 @@ jobs:
|
||||
- run:
|
||||
name: Install Manager Feed CLI
|
||||
command: dotnet tool install --global Speckle.Manager.Feed
|
||||
- run: *restore_semver
|
||||
- run:
|
||||
name: Upload new version
|
||||
# this is where the installer gets the semver baked into the file name
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
SEMVER=$(cat ./SEMVER)
|
||||
echo $SEMVER
|
||||
/root/.dotnet/tools/Speckle.Manager.Feed deploy \
|
||||
-s << parameters.slug >> \
|
||||
-s blender \
|
||||
-v ${SEMVER} \
|
||||
-u https://releases.speckle.dev/installers/<< parameters.slug >>/<< parameters.file_slug >>-${SEMVER}.<< parameters.extension >> \
|
||||
-u https://releases.speckle.dev/installers/blender/<< parameters.file_slug >>-${SEMVER}.<< parameters.extension >> \
|
||||
-o << parameters.os >> \
|
||||
-a << parameters.arch >> \
|
||||
-f speckle-sharp-ci-tools/Installers/<< parameters.file_slug >>/<< parameters.file_slug >>-${SEMVER}.<< parameters.extension >>
|
||||
-f speckle-sharp-ci-tools/Installers/blender/<< parameters.file_slug >>-${SEMVER}.<< parameters.extension >>
|
||||
|
||||
workflows:
|
||||
build: # build the installers, but don't persist to workspace for deployment
|
||||
jobs:
|
||||
- package-connector:
|
||||
filters: &build_filters
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(?:\.[0-9]+)?/
|
||||
|
||||
- build-connector-zip:
|
||||
requires:
|
||||
- package-connector
|
||||
filters: *build_filters
|
||||
|
||||
- get-ci-tools:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- /ci\/.*/
|
||||
- build-connector-win:
|
||||
name: Windows Build
|
||||
requires:
|
||||
- get-ci-tools
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- /ci\/.*/
|
||||
- build-connector-mac:
|
||||
name: Mac ARM Build
|
||||
slug: blender-mac-arm
|
||||
runtime: osx-arm64
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-connector-mac:
|
||||
name: Mac Intel Build
|
||||
slug: blender-mac-intel
|
||||
runtime: osx-x64
|
||||
requires:
|
||||
- get-ci-tools
|
||||
deploy: # build installers and deploy
|
||||
jobs:
|
||||
- get-ci-tools:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
filters: *build_filters
|
||||
|
||||
- build-connector-win:
|
||||
name: Windows Build
|
||||
slug: blender
|
||||
installer: true
|
||||
- build-installer-win:
|
||||
context: innosetup
|
||||
name: Windows Installer Build
|
||||
requires:
|
||||
- package-connector
|
||||
- get-ci-tools
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
filters: *build_filters
|
||||
|
||||
- build-connector-mac:
|
||||
name: Mac ARM Build
|
||||
slug: blender-mac-arm
|
||||
runtime: osx-arm64
|
||||
installer: true
|
||||
requires:
|
||||
- get-ci-tools
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
|
||||
- build-connector-mac:
|
||||
name: Mac Intel Build
|
||||
slug: blender-mac-intel
|
||||
runtime: osx-x64
|
||||
installer: true
|
||||
requires:
|
||||
- get-ci-tools
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
|
||||
- deploy-connector-new:
|
||||
name: deploy-win
|
||||
slug: blender
|
||||
- deploy-connector:
|
||||
context: do-spaces-speckle-releases
|
||||
name: deploy-windows
|
||||
file_slug: blender
|
||||
os: Win
|
||||
extension: exe
|
||||
os: WIN
|
||||
arch: Any
|
||||
extension: exe
|
||||
requires:
|
||||
- Windows Build
|
||||
- Mac ARM Build
|
||||
- Manual Installer Build
|
||||
- Windows Installer Build
|
||||
- Mac Intel Build
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
- Mac ARM Build
|
||||
filters: &deploy_filters
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?(?:\.[0-9]+)?/
|
||||
|
||||
- deploy-connector-new:
|
||||
name: deploy-mac-intel
|
||||
slug: blender
|
||||
file_slug: blender-mac-intel
|
||||
os: OSX
|
||||
arch: Intel
|
||||
extension: zip
|
||||
- build-installer-mac:
|
||||
name: Mac ARM Build
|
||||
slug: blender-mac-arm
|
||||
runtime: osx-arm64
|
||||
requires:
|
||||
- Windows Build
|
||||
- Mac ARM Build
|
||||
- Mac Intel Build
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
|
||||
- deploy-connector-new:
|
||||
- get-ci-tools
|
||||
- build-connector-zip
|
||||
filters: *build_filters
|
||||
|
||||
- deploy-connector:
|
||||
context: do-spaces-speckle-releases
|
||||
name: deploy-mac-arm
|
||||
slug: blender
|
||||
file_slug: blender-mac-arm
|
||||
os: OSX
|
||||
arch: Arm
|
||||
extension: zip
|
||||
requires:
|
||||
- Windows Build
|
||||
- Mac ARM Build
|
||||
- Manual Installer Build
|
||||
- Windows Installer Build
|
||||
- Mac Intel Build
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
- Mac ARM Build
|
||||
filters: *deploy_filters
|
||||
|
||||
- build-installer-mac:
|
||||
name: Mac Intel Build
|
||||
slug: blender-mac-intel
|
||||
runtime: osx-x64
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-connector-zip
|
||||
filters: *build_filters
|
||||
|
||||
- deploy-connector:
|
||||
context: do-spaces-speckle-releases
|
||||
name: deploy-mac-intel
|
||||
file_slug: blender-mac-intel
|
||||
os: OSX
|
||||
arch: Intel
|
||||
extension: zip
|
||||
requires:
|
||||
- Manual Installer Build
|
||||
- Windows Installer Build
|
||||
- Mac Intel Build
|
||||
- Mac ARM Build
|
||||
filters: *deploy_filters
|
||||
|
||||
- build-installer-manual:
|
||||
name: Manual Installer Build
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-connector-zip
|
||||
filters: *build_filters
|
||||
|
||||
- deploy-connector:
|
||||
context: do-spaces-speckle-releases
|
||||
name: deploy-manual
|
||||
file_slug: bpy_speckle
|
||||
os: Any
|
||||
arch: Any
|
||||
extension: zip
|
||||
requires:
|
||||
- Manual Installer Build
|
||||
- Windows Installer Build
|
||||
- Mac Intel Build
|
||||
- Mac ARM Build
|
||||
filters: *deploy_filters
|
||||
@@ -6,73 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
update_issue:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get project data
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
|
||||
ORGANIZATION: specklesystems
|
||||
PROJECT_NUMBER: 9
|
||||
run: |
|
||||
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
|
||||
query($org: String!, $number: Int!) {
|
||||
organization(login: $org){
|
||||
projectNext(number: $number) {
|
||||
id
|
||||
fields(first:20) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
settings
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
|
||||
|
||||
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
||||
|
||||
echo "$PROJECT_ID"
|
||||
echo "$STATUS_FIELD_ID"
|
||||
|
||||
echo 'DONE_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .settings | fromjson | .options[] | select(.name== "Done") | .id' project_data.json) >> $GITHUB_ENV
|
||||
echo "$DONE_ID"
|
||||
|
||||
- name: Add Issue to project #it's already in the project, but we do this to get its node id!
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
|
||||
ISSUE_ID: ${{ github.event.issue.node_id }}
|
||||
run: |
|
||||
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
|
||||
mutation($project:ID!, $id:ID!) {
|
||||
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
|
||||
projectNextItem {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
|
||||
|
||||
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
|
||||
|
||||
- name: Update Status
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
|
||||
ISSUE_ID: ${{ github.event.issue.node_id }}
|
||||
run: |
|
||||
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
|
||||
mutation($project:ID!, $status:ID!, $id:ID!, $value:String!) {
|
||||
set_status: updateProjectNextItemField(
|
||||
input: {
|
||||
projectId: $project
|
||||
itemId: $id
|
||||
fieldId: $status
|
||||
value: $value
|
||||
}
|
||||
) {
|
||||
projectNextItem {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f status=$STATUS_FIELD_ID -f id=$ITEM_ID -f value=${{ env.DONE_ID }}
|
||||
|
||||
uses: specklesystems/github-actions/.github/workflows/project-add-issue.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
issue-id: ${{ github.event.issue.node_id }}
|
||||
|
||||
@@ -6,45 +6,7 @@ on:
|
||||
|
||||
jobs:
|
||||
track_issue:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get project data
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
|
||||
ORGANIZATION: specklesystems
|
||||
PROJECT_NUMBER: 9
|
||||
run: |
|
||||
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
|
||||
query($org: String!, $number: Int!) {
|
||||
organization(login: $org){
|
||||
projectNext(number: $number) {
|
||||
id
|
||||
fields(first:20) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
settings
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
|
||||
|
||||
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
|
||||
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
|
||||
|
||||
- name: Add Issue to project
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GHPROJECT_TOKEN}}
|
||||
ISSUE_ID: ${{ github.event.issue.node_id }}
|
||||
run: |
|
||||
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
|
||||
mutation($project:ID!, $id:ID!) {
|
||||
addProjectNextItem(input: {projectId: $project, contentId: $id}) {
|
||||
projectNextItem {
|
||||
id
|
||||
}
|
||||
}
|
||||
}' -f project=$PROJECT_ID -f id=$ISSUE_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
|
||||
|
||||
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
|
||||
uses: specklesystems/github-actions/.github/workflows/project-add-issue.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
issue-id: ${{ github.event.issue.node_id }}
|
||||
+2
-1
@@ -12,4 +12,5 @@ __pycache__/
|
||||
Installers/
|
||||
modules/
|
||||
.tool-versions
|
||||
requirements.txt
|
||||
requirements.txt
|
||||
SEMVER
|
||||
+11
-9
@@ -1,4 +1,15 @@
|
||||
import bpy
|
||||
from bpy_speckle.installer import ensure_dependencies
|
||||
|
||||
ensure_dependencies()
|
||||
|
||||
from specklepy.logging import metrics
|
||||
|
||||
from bpy_speckle.ui import *
|
||||
from bpy_speckle.properties import *
|
||||
from bpy_speckle.operators import *
|
||||
from bpy_speckle.callbacks import *
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
bl_info = {
|
||||
"name": "SpeckleBlender 2.0",
|
||||
@@ -18,15 +29,6 @@ bl_info = {
|
||||
Import SpeckleBlender classes
|
||||
"""
|
||||
|
||||
from specklepy.api.client import SpeckleClient # , SpeckleCache
|
||||
from specklepy.logging import metrics
|
||||
|
||||
from bpy_speckle.ui import *
|
||||
from bpy_speckle.properties import *
|
||||
from bpy_speckle.operators import *
|
||||
from bpy_speckle.callbacks import *
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
"""
|
||||
Add load handler to initialize Speckle when
|
||||
loading a Blender file
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
from pathlib import Path
|
||||
from importlib import import_module, invalidate_caches
|
||||
|
||||
import bpy
|
||||
import sys
|
||||
|
||||
print("Starting Speckle Blender installation")
|
||||
print(sys.executable)
|
||||
|
||||
PYTHON_PATH = sys.executable
|
||||
|
||||
|
||||
|
||||
def modules_path() -> Path:
|
||||
modules_path = Path(bpy.utils.script_path_user(), "addons", "modules")
|
||||
modules_path.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
# set user modules path at beginning of paths for earlier hit
|
||||
if sys.path[1] != modules_path:
|
||||
sys.path.insert(1, modules_path)
|
||||
|
||||
return modules_path
|
||||
|
||||
|
||||
print(f"Found blender modules path {modules_path()}")
|
||||
|
||||
|
||||
def is_pip_available() -> bool:
|
||||
try:
|
||||
import_module("pip") # noqa F401
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
|
||||
|
||||
def ensure_pip() -> None:
|
||||
print("Installing pip... "),
|
||||
|
||||
from subprocess import run
|
||||
|
||||
completed_process = run([PYTHON_PATH, "-m", "ensurepip"])
|
||||
|
||||
if completed_process.returncode == 0:
|
||||
print("Successfully installed pip")
|
||||
else:
|
||||
raise Exception("Failed to install pip.")
|
||||
|
||||
|
||||
def get_requirements_path() -> Path:
|
||||
# we assume that a requirements.txt exists next to the __init__.py file
|
||||
path = Path(Path(__file__).parent, "requirements.txt")
|
||||
assert path.exists()
|
||||
return path
|
||||
|
||||
|
||||
def install_requirements() -> None:
|
||||
# set up addons/modules under the user
|
||||
# script path. Here we'll install the
|
||||
# dependencies
|
||||
path = modules_path()
|
||||
print(f"Installing Speckle dependencies to {path}")
|
||||
|
||||
from subprocess import run
|
||||
|
||||
completed_process = run(
|
||||
[
|
||||
PYTHON_PATH,
|
||||
"-m",
|
||||
"pip",
|
||||
"install",
|
||||
"-t",
|
||||
str(path),
|
||||
"-r",
|
||||
str(get_requirements_path()),
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
|
||||
if completed_process.returncode != 0:
|
||||
print("Please try manually installing speckle-blender")
|
||||
raise Exception(
|
||||
"""
|
||||
Failed to install speckle-blender.
|
||||
See console for manual install instruction.
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def install_dependencies() -> None:
|
||||
if not is_pip_available():
|
||||
ensure_pip()
|
||||
|
||||
install_requirements()
|
||||
|
||||
|
||||
def _import_dependencies() -> None:
|
||||
import_module("specklepy")
|
||||
# the code above doesn't work for now, it fails on importing graphql-core
|
||||
# despite that, the connector seams to be working as expected
|
||||
# But it would be nice to make this solution work
|
||||
# it would ensure that all dependencies are fully loaded
|
||||
# requirements = get_requirements_path().read_text()
|
||||
# reqs = [
|
||||
# req.split(" ; ")[0].split("==")[0].split("[")[0].replace("-", "_")
|
||||
# for req in requirements.split("\n")
|
||||
# if req and not req.startswith(" ")
|
||||
# ]
|
||||
# for req in reqs:
|
||||
# print(req)
|
||||
# import_module("specklepy")
|
||||
|
||||
|
||||
def ensure_dependencies() -> None:
|
||||
try:
|
||||
_import_dependencies()
|
||||
print("Found all dependencies, proceed with loading")
|
||||
except ImportError:
|
||||
print("Failed to load all dependencies, trying to install them...")
|
||||
install_dependencies()
|
||||
|
||||
invalidate_caches()
|
||||
_import_dependencies()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ensure_dependencies()
|
||||
@@ -4,6 +4,7 @@ User account operators
|
||||
import bpy
|
||||
from bpy_speckle.functions import _report
|
||||
from bpy_speckle.clients import speckle_clients
|
||||
from bpy_speckle.properties.scene import SpeckleSceneSettings
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.api.models import Stream, User
|
||||
from specklepy.api.credentials import get_local_accounts
|
||||
@@ -23,12 +24,14 @@ class LoadUsers(bpy.types.Operator):
|
||||
|
||||
_report("Loading users...")
|
||||
|
||||
users = context.scene.speckle.users
|
||||
speckle : SpeckleSceneSettings = context.scene.speckle
|
||||
users = speckle.users
|
||||
|
||||
context.scene.speckle.users.clear()
|
||||
speckle.users.clear()
|
||||
speckle_clients.clear()
|
||||
|
||||
profiles = get_local_accounts()
|
||||
active_user_index = 0
|
||||
|
||||
for profile in profiles:
|
||||
user = users.add()
|
||||
@@ -49,10 +52,10 @@ class LoadUsers(bpy.types.Operator):
|
||||
_report(ex)
|
||||
users.remove(len(users) - 1)
|
||||
if profile.isDefault:
|
||||
context.scene.speckle.active_user = str(len(users) - 1)
|
||||
active_user_index = len(users) - 1
|
||||
|
||||
context.scene.speckle.active_user_index = int(context.scene.speckle.active_user)
|
||||
bpy.ops.speckle.load_user_streams()
|
||||
speckle.active_user_index = int(speckle.active_user) #TODO: what is this?
|
||||
speckle.active_user = str(active_user_index)
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
if context.area:
|
||||
|
||||
@@ -73,7 +73,7 @@ class SpeckleUserObject(bpy.types.PropertyGroup):
|
||||
name: StringProperty(default="Speckle User")
|
||||
email: StringProperty(default="user@speckle.xyz")
|
||||
company: StringProperty(default="SpeckleSystems")
|
||||
authToken: StringProperty(default="")
|
||||
authToken: StringProperty(default="", subtype='PASSWORD')
|
||||
streams: CollectionProperty(type=SpeckleStreamObject)
|
||||
active_stream: IntProperty(default=0)
|
||||
|
||||
|
||||
@@ -121,7 +121,8 @@ class VIEW3D_PT_SpeckleUser(bpy.types.Panel):
|
||||
user = speckle.users[int(speckle.active_user)]
|
||||
col.label(text="{} ({})".format(user.server_name, user.server_url))
|
||||
col.label(text="{} ({})".format(user.name, user.email))
|
||||
|
||||
|
||||
col.operator("speckle.users_load", text="", icon="FILE_REFRESH")
|
||||
|
||||
class VIEW3D_PT_SpeckleStreams(bpy.types.Panel):
|
||||
"""
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -o pipefail
|
||||
|
||||
poetry export --only main -o bpy_speckle/requirements.txt
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MODULES_PATH="./bpy_speckle/modules"
|
||||
|
||||
# Clean up
|
||||
rm -rf $MODULES_PATH/*
|
||||
rm -f requirements.txt
|
||||
|
||||
# Export poetry dependencies
|
||||
poetry lock --no-update
|
||||
poetry export -f requirements.txt --with dev --without-hashes > requirements.txt
|
||||
|
||||
# Install dependencies via pip
|
||||
python -m pip install -r requirements.txt -t $MODULES_PATH
|
||||
@@ -0,0 +1,20 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def patch_installer(tag: str):
|
||||
"""Patches the installer with the correct connector version and specklepy version"""
|
||||
tag = tag.replace("\n", "")
|
||||
iss_file = "speckle-sharp-ci-tools/blender.iss"
|
||||
iss_path = Path(iss_file)
|
||||
lines = iss_path.read_text().split("\n")
|
||||
lines.insert(12, f'#define AppVersion "{tag.split("-")[0]}"')
|
||||
lines.insert(13, f'#define AppInfoVersion "{tag}"')
|
||||
|
||||
iss_path.write_text("\n".join(lines))
|
||||
print(f"Patched installer with connector v{tag}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
tag = sys.argv[1]
|
||||
patch_installer(tag)
|
||||
@@ -1,7 +1,6 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def patch_connector(tag):
|
||||
"""Patches the connector version within the connector init file"""
|
||||
bpy_file = "bpy_speckle/__init__.py"
|
||||
@@ -19,48 +18,13 @@ def patch_connector(tag):
|
||||
with open(bpy_file, "w") as file:
|
||||
file.writelines(lines)
|
||||
|
||||
|
||||
def patch_installer(tag):
|
||||
"""Patches the installer with the correct connector version and specklepy version"""
|
||||
iss_file = "speckle-sharp-ci-tools/blender.iss"
|
||||
|
||||
py_tag = get_specklepy_version()
|
||||
with open(iss_file, "r") as file:
|
||||
lines = file.readlines()
|
||||
lines.insert(11, f'#define SpecklepyVersion "{py_tag}"\n')
|
||||
lines.insert(12, f'#define AppVersion "{tag.split("-")[0]}"\n')
|
||||
lines.insert(13, f'#define AppInfoVersion "{tag}"\n')
|
||||
|
||||
with open(iss_file, "w") as file:
|
||||
file.writelines(lines)
|
||||
print(f"Patched installer with connector v{tag} and specklepy v{py_tag}")
|
||||
|
||||
|
||||
def get_specklepy_version():
|
||||
"""Get version of specklepy to install from the pyproject.toml"""
|
||||
version = "2.3.3"
|
||||
with open("pyproject.toml", "r") as f:
|
||||
lines = [line for line in f if line.startswith("specklepy = ")]
|
||||
if not lines:
|
||||
raise Exception("Could not find specklepy in pyproject.toml")
|
||||
match = re.search(r"[0-9]+(\.[0-9]+)*", lines[0])
|
||||
if match:
|
||||
version = match[0]
|
||||
return version
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print(get_specklepy_version())
|
||||
return
|
||||
|
||||
tag = sys.argv[1]
|
||||
if not re.match(r"([0-9]+)\.([0-9]+)\.([0-9]+)", tag):
|
||||
raise ValueError(f"Invalid tag provided: {tag}")
|
||||
|
||||
print(f"Patching version: {tag}")
|
||||
patch_connector(tag.split("-")[0])
|
||||
patch_installer(tag)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Generated
+506
-346
File diff suppressed because it is too large
Load Diff
+6
-5
@@ -7,16 +7,17 @@ license = "Apache-2.0"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.8, <4.0.0"
|
||||
specklepy = "^2.9.1"
|
||||
specklepy = "^2.11.4"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
# [tool.poetry.group.local_specklepy.dependencies]
|
||||
# specklepy = {path = "../specklepy", develop = true}
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
numpy = "^1.23.5"
|
||||
fake-bpy-module-latest = "^20221006"
|
||||
black = "^22.10.0"
|
||||
pylint = "^2.15.7"
|
||||
|
||||
[tool.poetry.group.local_specklepy.dependencies]
|
||||
specklepy = {path = "../specklepy", develop = true}
|
||||
ruff = "^0.0.166"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
||||
Reference in New Issue
Block a user