From dea2b6e367658f26634c26a1d67f0fb34ea52c1b Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 11 Jun 2024 14:42:22 +1000 Subject: [PATCH] New workflow for stable IfcOpenShell-Python releases Typically every 2 months --- .github/workflows/ci-blenderbim-daily.yml | 2 +- ...pi.yml => ci-ifcopenshell-python-pypi.yml} | 22 ++----- .github/workflows/ci-ifcopenshell-python.yml | 62 +++++++++++++++++++ src/ifcopenshell-python/Makefile | 37 +++++++++-- 4 files changed, 99 insertions(+), 24 deletions(-) rename .github/workflows/{ci-ifcopenshell-pypi.yml => ci-ifcopenshell-python-pypi.yml} (71%) create mode 100644 .github/workflows/ci-ifcopenshell-python.yml diff --git a/.github/workflows/ci-blenderbim-daily.yml b/.github/workflows/ci-blenderbim-daily.yml index 63e9c2e4f4..0aeb7edff9 100644 --- a/.github/workflows/ci-blenderbim-daily.yml +++ b/.github/workflows/ci-blenderbim-daily.yml @@ -71,7 +71,7 @@ jobs: cp -r src/blenderbim src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} && cd src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} && make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }} - - name: Upload Zip file to release + - name: Upload zip file to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci-ifcopenshell-pypi.yml b/.github/workflows/ci-ifcopenshell-python-pypi.yml similarity index 71% rename from .github/workflows/ci-ifcopenshell-pypi.yml rename to .github/workflows/ci-ifcopenshell-python-pypi.yml index 5ee327e15c..933167bbf3 100644 --- a/.github/workflows/ci-ifcopenshell-pypi.yml +++ b/.github/workflows/ci-ifcopenshell-python-pypi.yml @@ -1,19 +1,7 @@ -name: ci-ifcopenshell-pypi +name: ci-ifcopenshell-python-pypi on: workflow_dispatch: - schedule: - # ┌───────────── minute (0 - 59) - # │ ┌───────────── hour (0 - 23) - # │ │ ┌───────────── day of the month (1 - 31) - # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) - # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) - # * * * * * - - cron: "0 0 18 * *" - push: - paths: - - '.github/workflows/ci-ifcopenshell-pypi.yml' - env: major: 0 @@ -40,19 +28,19 @@ jobs: config: - { name: "Windows Build", - short_name: win, + short_name: win64, } - { name: "Linux Build", - short_name: linux + short_name: linux64 } - { name: "MacOS Build", - short_name: macos + short_name: macos64 } - { name: "MacOS ARM Build", - short_name: macosm1 + short_name: macosm164 } steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci-ifcopenshell-python.yml b/.github/workflows/ci-ifcopenshell-python.yml new file mode 100644 index 0000000000..7d477f666f --- /dev/null +++ b/.github/workflows/ci-ifcopenshell-python.yml @@ -0,0 +1,62 @@ +name: ci-ifcopenshell-python + +on: + workflow_dispatch: + +jobs: + activate: + runs-on: ubuntu-latest + if: | + github.repository == 'IfcOpenShell/IfcOpenShell' + steps: + - name: Set env + run: echo ok go + + build: + needs: activate + name: ${{ matrix.config.name }}-${{ matrix.pyver }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + pyver: [py39, py310, py311, py312] + config: + - { + name: "Windows Build", + short_name: win64, + } + - { + name: "Linux Build", + short_name: linux64 + } + - { + name: "MacOS Build", + short_name: macos64 + } + - { + name: "MacOS ARM Build", + short_name: macosm164 + } + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 # https://github.com/actions/setup-python + with: + python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + - run: echo ${{ env.DATE }} + - name: Get current version + id: version + run: echo "::set-output name=version::$(cat ../../VERSION)" + - name: Compile + run: | + cp -r src/ifcopenshell-python src/ifcopenshell_${{ matrix.config.short_name }}_${{ matrix.pyver }} && + cd src/ifcopenshell_${{ matrix.config.short_name }}_${{ matrix.pyver }} && + make zip PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }} + - name: Upload zip file to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: src/ifcopenshell_${{ matrix.config.short_name }}_${{ matrix.pyver }}/dist/ifcopenshell-python-${{ steps.version.outputs.version }}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip + asset_name: ifcopenshell-python-${{ steps.version.outputs.version }}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip + overwrite: true + body: "IfcOpenShell-Python Build ifcopenshell-python-${{steps.version.outputs.version}}" diff --git a/src/ifcopenshell-python/Makefile b/src/ifcopenshell-python/Makefile index 62cc08626a..b999afabef 100644 --- a/src/ifcopenshell-python/Makefile +++ b/src/ifcopenshell-python/Makefile @@ -1,6 +1,6 @@ VERSION:=$(shell cat ../../VERSION) PYVERSION:=py311 -PLATFORM:=linux +PLATFORM:=linux64 SED:=sed -i ifeq ($(OS),Windows_NT) @@ -31,19 +31,21 @@ ifeq ($(PYVERSION), py312) PYNUMBER:=312 endif -ifeq ($(PLATFORM), linux) +ifeq ($(PLATFORM), linux64) PLATFORMTAG:=manylinux_2_31_x86_64 endif -ifeq ($(PLATFORM), macos) +ifeq ($(PLATFORM), macos64) PLATFORMTAG:=macosx_10_15_x86_64 endif -ifeq ($(PLATFORM), macosm1) +ifeq ($(PLATFORM), macosm164) PLATFORMTAG:=macosx_11_0_arm64 endif -ifeq ($(PLATFORM), win) +ifeq ($(PLATFORM), win64) PLATFORMTAG:=win_amd64 endif +IOS_URL:=https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-$(PYNUMBER)-v0.8.0-90ae709-$(PLATFORM).zip + .PHONY: test test: pytest -p no:pytest-blender test @@ -79,6 +81,29 @@ coverage: clean: rm -rf htmlcov +.PHONY: zip +zip: +ifndef PLATFORM + $(error PLATFORM is not set) +endif + rm -rf dist + mkdir -p dist/working + mkdir -p dist/ifcopenshell + cp -r ifcopenshell/* dist/ifcopenshell/ + + cd dist/working && wget $(IOS_URL) + cd dist/working && unzip ifcopenshell-python* + cp -r dist/working/ifcopenshell/ifcopenshell_wrapper.py dist/ifcopenshell/ +ifeq ($(PLATFORM), win) + cp -r dist/working/ifcopenshell/_ifcopenshell_wrapper.pyd dist/ifcopenshell/ +else + cp -r dist/working/ifcopenshell/_ifcopenshell_wrapper.so dist/ifcopenshell/ +endif + rm -rf dist/working + $(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' dist/ifcopenshell/__init__.py + cd dist && zip -r ifcopenshell-python-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ifcopenshell + rm -rf dist/ifcopenshell + .PHONY: dist dist: ifndef PLATFORM @@ -89,7 +114,7 @@ endif mkdir -p dist/ifcopenshell cp -r ifcopenshell/* dist/ifcopenshell/ - cd dist/working && wget https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-$(PYNUMBER)-v0.8.0-90ae709-$(PLATFORM)64.zip + cd dist/working && wget $(IOS_URL) cd dist/working && unzip ifcopenshell-python* cp -r dist/working/ifcopenshell/ifcopenshell_wrapper.py dist/ifcopenshell/ ifeq ($(PLATFORM), win)