Merge pull request #111 from jelmer/dependabot/pip/ruff-0.8.6 #502
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
name: Python tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12', '3.9', '3.13'] | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Work out subversion version | |
run: | | |
VER=$(curl -L https://downloads.apache.org/subversion | grep -oP 'subversion-(\K[0-9]+\.[0-9]+\.[0-9]+)' | head -1) | |
echo "SVN_VERSION=$VER" >> $GITHUB_ENV | |
- name: Install dependencies (apt) | |
run: | | |
sudo apt update | |
sudo apt install libapr1-dev libaprutil1-dev libdb5.3-dev liblz4-dev libsasl2-dev libperl-dev libserf-dev libsqlite3-dev libtool python-all-dev libneon27-gnutls-dev libutf8proc-dev | |
if: "matrix.os == 'ubuntu-latest'" | |
- name: Install dependencies (brew) | |
run: | | |
brew install subversion apr-util apr pkg-config utf8proc lz4 | |
echo "$(brew --prefix)/opt/subversion/libexec" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/apr-util/bin" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/apr/bin" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/pkg-config/bin" >> $GITHUB_PATH | |
if: "matrix.os == 'macos-latest'" | |
- name: Install dependencies (Windows) | |
run: | | |
vcpkg install apr:x64-windows apr-util:x64-windows sqlite3:x64-windows zlib:x64-windows utf8proc:x64-windows openssl:x64-windows berkeleydb:x64-windows lz4:x64-windows python2:x64-windows expat:x64-windows lz4:x64-windows | |
vcpkg integrate install | |
echo "APR_INCLUDE_DIR=$env:VCPKG_INSTALLATION_ROOT/packages/apr_x64-windows/include" >> $env:GITHUB_ENV | |
echo "APR_LINK_FLAGS=/LIBPATH:$env:VCPKG_INSTALLATION_ROOT/packages/apr_x64-windows/lib libapr-1.lib" >> $env:GITHUB_ENV | |
Get-ChildItem -Path "$env:VCPKG_INSTALLATION_ROOT/packages/apr_x64-windows/lib/*" -Recurse -Filter "*.dll" | Copy-Item -Destination "$env:GITHUB_WORKSPACE/subvertpy" | |
echo "APU_INCLUDE_DIR=$env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/include" >> $env:GITHUB_ENV | |
Get-ChildItem -Path "$env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/lib/*" -Recurse -Filter "*.dll" | Copy-Item -Destination "$env:GITHUB_WORKSPACE/subvertpy" | |
echo "APU_LINK_FLAGS=/LIBPATH:$env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/lib libaprutil-1.lib" >> $env:GITHUB_ENV | |
if: "matrix.os == 'windows-latest'" | |
- name: Locate & Exec vcvarsall.bat | |
run: | | |
$VCVarsAll = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find "VC\Auxiliary\Build\vcvarsall.bat" | |
if (-not $VCVarsAll) { | |
Write-Error "vcvarsall.bat not found" -Category NotInstalled | |
exit 1 | |
} | |
$Token = "#####ENV#####" | |
$enc = [Console]::OutputEncoding | |
[Console]::OutputEncoding = [Text.Encoding]::Unicode | |
$VCVarsAllResult = cmd /U /C "`"$VCVarsAll`" x64 && echo $TOKEN&& set" | |
[Console]::OutputEncoding = $enc | |
$TokenIndex = $VCVarsAllResult.IndexOf($Token) | |
if ($TokenIndex -eq -1) { | |
Write-Error "vcvarsall failed." | |
exit 1 | |
} | |
$VCVarsAllResult | Select-Object -Skip ($TokenIndex + 1) | ForEach-Object { | |
$k, $v = $_ -split "=", 2 | |
Write-Output "$k=$v" >> $GITHUB_ENV | |
} | |
shell: pwsh | |
if: "matrix.os == 'windows-latest'" | |
- name: Install serf (Windows) | |
run: | | |
curl -L https://downloads.apache.org/serf/serf-1.3.9.zip -o serf.zip | |
unzip -q serf.zip | |
cd serf-1.3.9 | |
curl -L http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.zip -o scons-local.zip | |
unzip -q scons-local.zip | |
python2 ./scons.py --debug=stacktrace | |
if: "matrix.os == 'windows-latest'" | |
continue-on-error: true | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
if: "matrix.os == 'windows-latest'" | |
- name: Install Subversion (Windows) | |
run: | | |
curl -L https://downloads.apache.org/subversion/subversion-$env:SVN_VERSION.zip -o subversion.zip | |
unzip -q subversion.zip | |
cd subversion-$env:SVN_VERSION | |
cp $env:VCPKG_INSTALLATION_ROOT/packages/expat_x64-windows/include/* $env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/include | |
cp $env:VCPKG_INSTALLATION_ROOT/packages/expat_x64-windows/lib/* $env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/lib | |
cp $env:VCPKG_INSTALLATION_ROOT/packages/expat_x64-windows/bin/* $env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows/bin | |
python2 gen-make.py --debug --vsnet-version=2019 --with-apr=$env:VCPKG_INSTALLATION_ROOT/packages/apr_x64-windows --with-apr-util=$env:VCPKG_INSTALLATION_ROOT/packages/apr-util_x64-windows --with-zlib=$env:VCPKG_INSTALLATION_ROOT/packages/zlib_x64-windows --with-sqlite=$env:VCPKG_INSTALLATION_ROOT/packages/sqlite3_x64-windows | |
msbuild subversion_vcnet.sln /t:__MORE__ /p:Configuration=Release | |
Copy-Item -Recurse -Path $env:GITHUB_WORKSPACE/subversion-$env::SVN_VERSION/subversion/include -Destination $env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/include/subversion-1 | |
Get-ChildItem -Path "$env:GITHUB_WORKSPACE/subversion-$env:SVN_VERSION/Release/subversion/libsvn_*/*" -Recurse | Copy-Item -Destination "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib" | |
Get-ChildItem -Path "$env:GITHUB_WORKSPACE/subversion-$env:SVN_VERSION/Release/subversion/libsvn_*/*" -Recurse -Filter "*.dll" | Copy-Item -Destination "$env:GITHUB_WORKSPACE/subvertpy" | |
echo "SVN_HEADER_PATH=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/include/subversion-1" >> $env:GITHUB_ENV | |
echo "SVN_LIBRARY_PATH=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows/lib" >> $env:GITHUB_ENV | |
if: "matrix.os == 'windows-latest'" | |
- name: Install Subversion (Linux) | |
run: | | |
curl -L https://downloads.apache.org/subversion/subversion-$SVN_VERSION.tar.gz -o subversion.tar.gz | |
tar xfz subversion.tar.gz | |
pushd subversion-$SVN_VERSION | |
./configure | |
make | |
sudo make install | |
sudo ldconfig -v | |
popd | |
if: "matrix.os == 'ubuntu-latest'" | |
- name: Install other dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U pip coverage codecov fastimport setuptools setuptools_rust | |
- name: Style checks | |
run: | | |
pip install ".[dev]" | |
python -m ruff check subvertpy tests examples | |
continue-on-error: true | |
- name: Build (Linux) | |
run: | | |
pkg-config --cflags --libs apr-1 apr-util-1 | |
pkg-config --cflags --libs libsvn_client | |
python setup.py build_ext -i | |
if: "matrix.os == 'ubuntu-latest'" | |
- name: Build (Mac OS X) | |
run: | | |
python setup.py build_ext -i | |
if: "matrix.os == 'macos-latest'" | |
- name: Build (Windows) | |
run: | | |
python setup.py build_ext -i | |
- name: Coverage test suite run | |
run: | | |
python -m coverage run -p -m unittest tests.test_suite | |
- name: Check rust formatting | |
run: | | |
cargo fmt --all -- --check |