-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from ales-erjavec/win-portable
[FIX] Reimplement windows portable distribution
- Loading branch information
Showing
6 changed files
with
254 additions
and
105 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
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,125 @@ | ||
name : Build Windows Portable Installer | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'releases/**' | ||
- 'testing/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-2019 | ||
timeout-minutes: 30 | ||
env: | ||
REPO: https://github.com/biolab/orange3.git | ||
BUILD_BRANCH: master | ||
BUILD_COMMIT: FETCH_HEAD | ||
BUILD_LOCAL: 1 | ||
|
||
PYTHONFAULTHANDLER: 1 | ||
PIP_NO_PIP_VERSION_CHECK: 1 | ||
PIP_CACHE_DIR: .pip-cache | ||
PIP_PREFER_BINARY: 1 | ||
|
||
BUILD_DEPS: "wheel~=0.37.0 pip~=23.2.1" | ||
ENVSPEC: ./specs/win/PY310.txt | ||
|
||
strategy: | ||
fail-fast: False | ||
matrix: | ||
include: | ||
- python-version: "3.10.11" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Checkout orange3 | ||
shell: bash | ||
run: | | ||
set -e | ||
git clone -q $REPO | ||
cd orange3 | ||
git fetch origin $BUILD_BRANCH | ||
git checkout $BUILD_COMMIT | ||
- name: Setup Pip Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: .pip-cache | ||
key: ${{ runner.os }}-py-${{ matrix.python-version }}-pip-${{ hashFiles('.github/workflows/build-win-portable.yml') }} | ||
restore-keys: | | ||
${{ runner.os }}-py-${{ matrix.python-version }}-pip | ||
- name: Prepare wheels | ||
shell: bash | ||
run: | | ||
python -m pip install $BUILD_DEPS | ||
if [[ $BUILD_LOCAL ]]; then | ||
PIP_ARGS=( -r $ENVSPEC ./orange3 ); | ||
else | ||
PIP_ARGS=( -r $ENVSPEC Orange3==$BUILD_COMMIT ); | ||
fi | ||
python -m pip wheel -w ./wheels -f ./wheels "${PIP_ARGS[@]}" orange3 | ||
ls ./wheels | ||
- name: Build installer | ||
shell: bash | ||
env: | ||
PYTHON_VERSION: ${{ matrix.python-version }} | ||
run: | | ||
export PATH="$(cygpath -u C:\\msys64\\usr\\bin):$PATH" | ||
echo PATH=$PATH | ||
mkdir dist | ||
./scripts/windows/build-win-portable.sh --no-index --find-links=./wheels --python-version $PYTHON_VERSION --pip-arg=--pre --pip-arg=-r --pip-arg=$ENVSPEC --pip-arg=Orange3 | ||
INSTALLER=( dist/Orange*.zip ) | ||
SHA256=$( sha256sum -b $INSTALLER ) | ||
echo INSTALLER = $INSTALLER | ||
echo SHA256 = $( sha256sum -b $INSTALLER ) | ||
- name: Upload installer | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: orange-win-portable-installer | ||
path: dist/Orange*.zip | ||
if-no-files-found: error | ||
|
||
test: | ||
name: Test | ||
needs: build | ||
runs-on: windows-2019 | ||
steps: | ||
- name: Download installer | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: orange-win-portable-installer | ||
|
||
- name: Install | ||
shell: bash | ||
run: | | ||
7z x "-oD:\\test-install" Orange*.zip | ||
- name: Run tests | ||
shell: bash | ||
run: | | ||
PYTHON=$(cygpath -u "D:\\test-install\\Orange\\python.exe") | ||
$PYTHON --version | ||
$PYTHON -m pip --version | ||
$PYTHON -m pip list --format=freeze | ||
# Test that orange and all dependencies are installed in a | ||
# consistent state | ||
$PYTHON -m pip install --no-index --no-cache-dir orange3 | ||
# Run test suite in the installed environment. | ||
export ORANGE_DEPRECATIONS_ERROR=1 | ||
export PYTHONWARNINGS=module | ||
$PYTHON -m unittest -v Orange.tests Orange.widgets.tests |
This file was deleted.
Oops, something went wrong.
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,129 @@ | ||
#!/usr/bin/env bash | ||
|
||
NAME=Orange3 | ||
|
||
BUILDBASE=./build | ||
DISTDIR=./dist | ||
CACHEDIR=build/download-cache | ||
|
||
PIP_INDEX_ARGS=() | ||
PIP_ARGS=() | ||
|
||
PYTHON_VERSION=${PYTHON_VERSION:-"3.10.11"} | ||
|
||
|
||
while [[ "${1:0:1}" = "-" ]]; do | ||
case $1 in | ||
-b|--build-base) | ||
BUILDBASE=${2:?}; shift 2;; | ||
--build-base=*) | ||
BUILDBASE=${1#*=}; shift 1;; | ||
-d|--dist-dir) | ||
DISTDIR=${2:?}; shift 2;; | ||
--dist-dir=*) | ||
DISTDIR=${1#*=}; shift 1;; | ||
--cache-dir) | ||
CACHEDIR=${2:?}; shift 2;; | ||
--cache-dir=*) | ||
CACHEDIR=${1#*=}; shift 1;; | ||
--python-version) | ||
PYTHON_VERSION=${2:?}; shift 2;; | ||
--python-version=*) | ||
PYTHON_VERSION=${1#*=}; shift 1;; | ||
-f|--find-links) | ||
PIP_INDEX_ARGS+=(--find-links "${2:?}"); shift 2;; | ||
--find-links=*) | ||
PIP_INDEX_ARGS+=(--find-links "${1#*=}"); shift 1;; | ||
--extra-index-url) | ||
PIP_INDEX_ARGS+=(--extra-index-url "${2:?}"); shift 2;; | ||
--extra-index-url=*) | ||
PIP_INDEX_ARGS+=(--extra-index-url "${1#*=}"); shift 1;; | ||
--no-index) | ||
PIP_INDEX_ARGS+=( --no-index ); shift 1;; | ||
--pip-arg) | ||
PIP_ARGS+=( "${2:?}" ); shift 2;; | ||
--pip-arg=*) | ||
PIP_ARGS+=( "${1#*=}" ); shift 1;; | ||
-h|--help) | ||
usage; exit 0;; | ||
-*) | ||
echo "Unknown option: $1" >&2 | ||
usage >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
DIR=$(dirname "$0") | ||
BUILDDIR="${BUILDBASE}/build/Orange" | ||
PYTHON_NUPKG="${CACHEDIR}/python-${PYTHON_VERSION}.nupkg" | ||
|
||
function download { | ||
local url=${1:?} | ||
local dest=${2:?} | ||
local tmpname="" | ||
mkdir -p $(dirname "${dest}") | ||
if [[ ! -f "${dest}" ]]; then | ||
tmpname=$(mktemp "${dest}.XXXXX") | ||
if curl -fSL -o "${tmpname}" "${url}"; then | ||
mv "${tmpname}" "${dest}" | ||
else | ||
return $? | ||
fi | ||
fi | ||
} | ||
|
||
|
||
download https://www.nuget.org/api/v2/package/python/${PYTHON_VERSION} \ | ||
"${PYTHON_NUPKG}" | ||
|
||
if [[ -e "${BUILDDIR}" ]]; then | ||
rm -r "${BUILDDIR}" | ||
fi | ||
|
||
7z x '-i!tools' -y -o"${BUILDBASE}/tmp" "${PYTHON_NUPKG}" | ||
mkdir -p $(dirname "${BUILDDIR}") | ||
mv "${BUILDBASE}/tmp/tools" "${BUILDDIR}" | ||
|
||
PYTHON="${BUILDDIR}/python.exe" | ||
|
||
"${PYTHON}" -m ensurepip | ||
"${PYTHON}" -m pip install "pip==23.3.*" wheel | ||
"${PYTHON}" -m pip install "${PIP_INDEX_ARGS[@]}" "${PIP_ARGS[@]}" | ||
|
||
mkdir -p "${BUILDDIR}/etc" | ||
cp "${DIR}/orangerc.conf" "${BUILDDIR}/etc/orangerc.conf" | ||
|
||
BUILDDIR_WIN="$(cygpath -w "${BUILDDIR}")" | ||
|
||
python -m pip install pywin32 | ||
python "${DIR}/create_shortcut.py" \ | ||
--target 'cmd.exe' \ | ||
--arguments '"/C start pythonw.exe -m Orange.canvas"' \ | ||
--working-directory "" \ | ||
--window-style Minimized \ | ||
--shortcut "${BUILDDIR_WIN}\Orange.lnk" | ||
|
||
python "${DIR}/create_shortcut.py" \ | ||
--target 'cmd.exe' \ | ||
--arguments '"/K python.exe -m Orange.canvas -l4"' \ | ||
--working-directory "" \ | ||
--shortcut "${BUILDDIR_WIN}/Orange Debug.lnk" | ||
|
||
python "${DIR}/create_shortcut.py" \ | ||
--target 'cmd.exe' \ | ||
--arguments '"/C start Orange\pythonw.exe -m Orange.canvas"' \ | ||
--working-directory "" \ | ||
--window-style Minimized \ | ||
--shortcut "${BUILDDIR_WIN}/../Orange.lnk" | ||
|
||
pushd "${BUILDBASE}/build" | ||
|
||
echo [global] > Orange/pip.ini | ||
echo prefer-binary=1 >> Orange/pip.ini | ||
|
||
zip --quiet -9 -r temp.zip Orange Orange.lnk -x '*.pyc' '*.pyo' '*/__pycache__/*' | ||
popd | ||
VERSION=$("${PYTHON}" -m pip show Orange3 | grep Version: | cut -d " " -f2) | ||
|
||
mv -f "${BUILDBASE}/build/temp.zip" "${DISTDIR}"/"${NAME}-${VERSION}.zip" |
File renamed without changes.
File renamed without changes.