Fix and test sdist builds; reduce sdist size #13
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: test-sdist | |
on: | |
pull_request: | |
types: [opened, reopened, labeled, synchronize] | |
jobs: | |
build: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensure tags are fetched for versioning | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Update Python pip, build | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip build | |
- name: Create source distribution | |
shell: bash -l {0} | |
run: | | |
python -m build --sdist . | |
- name: Upload source dist as build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-source-distribution | |
path: dist | |
test: | |
needs: build | |
name: Install on Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensure tags are fetched for versioning | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Find MSVC and set environment variables | |
shell: bash -l {0} | |
env: | |
MSVC_PREFIX: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC' | |
run: | | |
echo "Available MSVC installations:" | |
ls "$MSVC_PREFIX" | |
MSVC_BIN=$(ls "$MSVC_PREFIX" | tail -n 1)\\bin\\HostX64\\x64 | |
CC="$MSVC_PREFIX\\$MSVC_BIN\\cl.exe" | |
echo "CC: $CC" | |
echo "CC=$CC" >> $GITHUB_ENV | |
CC_LD="$MSVC_PREFIX\\$MSVC_BIN\\link.exe" | |
echo "CC_LD: $CC_LD" | |
echo "CC_LD=$CC_LD" >> $GITHUB_ENV | |
- name: Download artifacts to Windows environment | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
merge-multiple: true | |
- name: List Files | |
run: | | |
pwd | |
ls -R | |
- name: Update pip and install test requirements | |
shell: bash -l {0} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r tests_and_analysis/tox_requirements.txt | |
- name: Install from sdist | |
shell: bash -l {0} | |
run: python -m pip install $(find dist -name 'euphonic-*.tar.gz') | |
- name: run tests | |
shell: bash -l {0} | |
run: python tests_and_analysis/test/run_tests.py --report | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Unit test results (Windows from sdist) | |
path: tests_and_analysis/test/reports/junit_report*.xml | |
publish-test-results: | |
needs: test | |
runs-on: ubuntu-latest | |
if: success() || failure() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
junit_files: artifacts/**/junit_report*.xml |