Merge pull request #7103 from RayyanAnsari/msys2-ci

Use MSYS2 for Windows CI
This commit is contained in:
TW 2022-10-27 15:06:34 +02:00 committed by GitHub
commit 7aeae7cf7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 78 deletions

View File

@ -1,27 +0,0 @@
version: '{build}'
environment:
matrix:
- PYTHON: C:\Python38-x64
# Disable automatic builds
build: off
# Build artifacts: all wheel and exe files in the dist folder
artifacts:
- path: 'dist\*.whl'
- path: 'dist\*.exe'
install:
- ps: scripts\win-download-openssl.ps1
- ps: |
& $env:PYTHON\python.exe -m venv borg-env
borg-env\Scripts\activate.ps1
python -m pip install -U pip
pip install -r requirements.d/development.txt
pip install wheel pyinstaller
build_script:
- ps: |
borg-env\Scripts\activate.ps1
scripts\win-build.ps1

27
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Windows CI
on: [push, pull_request]
jobs:
msys2-ucrt64:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
- name: Install dependencies
run: ./scripts/msys2-install-deps
- name: Build
run: ./scripts/msys2-build
- name: Test
run: ./dist/borg.exe -V
- uses: actions/upload-artifact@v3
with:
name: borg-windows
path: dist/borg.exe

5
scripts/msys2-build Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
python setup.py build_ext --inplace
python setup.py bdist_wheel
pyinstaller -y scripts/borg.exe.spec

View File

@ -0,0 +1,4 @@
#!/bin/bash
pacman -S --needed --noconfirm git mingw-w64-ucrt-x86_64-{toolchain,pkgconf,zstd,lz4,xxhash,openssl,python,cython,python-setuptools,python-wheel,python-pkgconfig,python-packaging,python-msgpack,python-argon2_cffi,python-pip}
pip install pyinstaller

View File

@ -1,18 +0,0 @@
# Build a wheel and single file executable
# Configure the build environment
& $PSScriptRoot\win-setup-build-env.ps1
# Clean the old build
python setup.py clean
# Build the extension inplace
python setup.py build_ext --inplace
# Run pip install to install install_requires of borg.
pip install -v -e .
# Build the wheel
python setup.py bdist_wheel
pyinstaller -y scripts/borg.exe.spec

View File

@ -1,15 +0,0 @@
# Download and extract the prebuilt openssl libraries provided by the python developers.
# The file is extracted to the .\external directory.
$url = "https://github.com/python/cpython-bin-deps/archive/openssl-bin-1.1.1c.zip"
$dest = "external"
$ErrorActionPreference = "Stop"
Write-Output "Downloading OpenSSL from cpython-bin-deps repository ..."
Invoke-WebRequest $url -OutFile openssl.zip
Write-Output "Extracting OpenSSL"
Expand-Archive -Path openssl.zip -DestinationPath $dest -Force
Remove-Item -Path openssl.zip

View File

@ -1,18 +0,0 @@
# Configure the environment such that borg can be built and run.
# Note that building borg requires OpenSSL which is not available by default.
# Use the win-download-openssl.ps1 script to get correct OpenSSL version.
$opensslPath = Resolve-Path "$PSScriptRoot\..\external\cpython-bin-deps-openssl-bin-1.1.1c\$env:PROCESSOR_ARCHITECTURE"
if(!(Test-Path $opensslPath)) {
Write-Host "OpenSSL not found! Please run win-download-openssl.ps1 and check if your platform is supported."
exit
}
$env:BORG_OPENSSL_PREFIX = $opensslPath
$env:BORG_USE_BUNDLED_B2 = "YES"
$env:BORG_USE_BUNDLED_LZ4 = "YES"
$env:BORG_USE_BUNDLED_ZSTD = "YES"
$env:BORG_USE_BUNDLED_XXHASH = "YES"
Write-Host "Environment configured for borg. The following variables where set:"
Write-Host ( Get-ChildItem Env: | Where-Object { $_.Name.StartsWith("BORG_") } | Out-String )