From e7ce6761e11a37e511f84489224d4491b4c9f004 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 25 May 2021 12:59:19 +0100 Subject: [PATCH] Use Appveyor to build Windows packages The script was executed both by this repos' appveyor config (to run the tests) and by the psycopg2-wheels config (to build the packages). Now there are two different workflows to execute for tests and to build packages. The only way to swap them is to change the project config it seems, in . --- .appveyor/packages.yml | 88 ++++++++++++++++++++++++++++ .appveyor.yml => .appveyor/tests.yml | 7 +-- scripts/appveyor.py | 16 +---- 3 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 .appveyor/packages.yml rename .appveyor.yml => .appveyor/tests.yml (91%) diff --git a/.appveyor/packages.yml b/.appveyor/packages.yml new file mode 100644 index 00000000..628475c9 --- /dev/null +++ b/.appveyor/packages.yml @@ -0,0 +1,88 @@ +version : 2.x.{build} + +clone_folder: C:\Project + +# We use the configuration to specify the package name +configuration: + - psycopg2 + - psycopg2-binary + +environment: + matrix: + # For Python versions available on Appveyor, see + # https://www.appveyor.com/docs/windows-images-software/#python + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019, PY_VER: "39", PY_ARCH: "32"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019, PY_VER: "39", PY_ARCH: "64"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "38", PY_ARCH: "32"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "38", PY_ARCH: "64"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "37", PY_ARCH: "32"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "37", PY_ARCH: "64"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "36", PY_ARCH: "32"} + - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "36", PY_ARCH: "64"} + + WORKFLOW: packages + + OPENSSL_VERSION: "1_1_1h" + POSTGRES_VERSION: "13_0" + + PSYCOPG2_TESTDB: psycopg2_test + PSYCOPG2_TESTDB_USER: postgres + PSYCOPG2_TESTDB_HOST: localhost + + PGUSER: postgres + PGPASSWORD: Password12! + PGSSLMODE: require + + # Add CWD to perl library path for PostgreSQL build on VS2019 + PERL5LIB: . + + # Select according to the service enabled + POSTGRES_DIR: C:\Program Files\PostgreSQL\9.6\ + + # The python used in the build process, not the one packages are built for + PYEXE: C:\Python36\python.exe + +matrix: + fast_finish: false + +services: + # Note: if you change this service also change POSTGRES_DIR + - postgresql96 + +cache: + # Rebuild cache if following file changes + # (See the file to zap the cache manually) + - C:\Others -> scripts\appveyor.cache_rebuild + +# Script called before repo cloning +# init: + +# Repository gets cloned, Cache is restored + +install: + - "%PYEXE% scripts\\appveyor.py install" + +# PostgreSQL server starts now + +build: off + +build_script: + - "%PYEXE% scripts\\appveyor.py build_script" + +after_build: + - "%PYEXE% scripts\\appveyor.py after_build" + +before_test: + - "%PYEXE% scripts\\appveyor.py before_test" + +test_script: + - "%PYEXE% scripts\\appveyor.py test_script" + +artifacts: + - path: dist\psycopg2-*\*.whl + name: wheel + - path: dist\psycopg2-*\*.exe + name: exe + + +# vim: set ts=4 sts=4 sw=4: diff --git a/.appveyor.yml b/.appveyor/tests.yml similarity index 91% rename from .appveyor.yml rename to .appveyor/tests.yml index d7edc0d7..e1b7c52b 100644 --- a/.appveyor.yml +++ b/.appveyor/tests.yml @@ -3,11 +3,6 @@ version : 2.x.{build} clone_folder: C:\Project environment: - global: - # MSVC Express 2008's setenv.cmd failes if /E:ON and /V:ON are not - # enabled in the batch script interpreter - CMD_IN_ENV: cmd /E:ON /V:ON /C .\appveyor\run_with_env.cmd - matrix: # For Python versions available on Appveyor, see # https://www.appveyor.com/docs/windows-images-software/#python @@ -20,6 +15,8 @@ environment: - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "36", PY_ARCH: "32"} - {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "36", PY_ARCH: "64"} + WORKFLOW: tests + OPENSSL_VERSION: "1_1_1h" POSTGRES_VERSION: "13_0" diff --git a/scripts/appveyor.py b/scripts/appveyor.py index 428a6b48..39b3ebe2 100755 --- a/scripts/appveyor.py +++ b/scripts/appveyor.py @@ -699,13 +699,8 @@ class Options: @property def is_wheel(self): """Are we building the wheel packages or just the extension?""" - project_name = os.environ['APPVEYOR_PROJECT_NAME'] - if project_name == 'psycopg2': - return False - elif project_name == 'psycopg2-wheels': - return True - else: - raise Exception(f"unexpected project name: {project_name}") + workflow = os.environ["WORKFLOW"] + return workflow == "packages" @property def py_dir(self): @@ -801,12 +796,7 @@ class Options: @property def package_dir(self): - """ - The directory containing the psycopg code checkout dir. - - Building psycopg it is clone_dir, building the wheels it is a submodule. - """ - return self.clone_dir / 'psycopg2' if self.is_wheel else self.clone_dir + return self.clone_dir @property def dist_dir(self):