New workflow for stable IfcOpenShell-Python releases

Typically every 2 months
This commit is contained in:
Dion Moult
2024-06-11 14:42:22 +10:00
parent 5e6fe5e3cf
commit dea2b6e367
4 changed files with 99 additions and 24 deletions
+1 -1
View File
@@ -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 }}
@@ -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
@@ -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}}"
+31 -6
View File
@@ -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)