v0.2.1 #56
Workflow file for this run
This file contains hidden or 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 Build and Distribution | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| release: | |
| types: [published] | |
| jobs: | |
| test-pip-build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build twine wheel setuptools | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package with twine | |
| shell: bash # Required for Windows, otherwise glob pattern will fail | |
| run: twine check dist/* | |
| - name: Install package from wheel | |
| shell: bash # Required for Windows, otherwise glob pattern will fail | |
| run: pip install dist/*.whl | |
| - name: Test import | |
| run: | | |
| python -c "from TDLM import tdlm; print('TDLM imported successfully')" | |
| python -c "import TDLM; print(f'TDLM version: {TDLM.__version__}')" | |
| - name: Run basic tests | |
| run: | | |
| pip install pytest pytest-cov | |
| pytest tests/ -v | |
| - name: Upload pip artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
| with: | |
| name: pip-dist | |
| path: dist/ | |
| test-conda-build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Miniconda | |
| uses: conda-incubator/setup-miniconda@v2 | |
| with: | |
| auto-update-conda: true | |
| python-version: ${{ matrix.python-version }} | |
| channels: conda-forge,defaults | |
| channel-priority: strict | |
| miniconda-version: "latest" | |
| - name: Install conda-build | |
| shell: bash -l {0} | |
| run: | | |
| conda install conda-build | |
| - name: Build conda package | |
| shell: bash -l {0} | |
| run: | | |
| conda build . --output-folder conda-dist | |
| - name: Test conda package installation | |
| shell: bash -l {0} | |
| run: | | |
| # Create a fresh environment and install the package | |
| conda create -n test-env python=${{ matrix.python-version }} -y | |
| conda activate test-env | |
| conda install -c ./conda-dist pytdlm -y | |
| - name: Test conda package import | |
| shell: bash -l {0} | |
| run: | | |
| conda activate test-env | |
| python -c "from TDLM import tdlm; print('TDLM imported successfully')" | |
| python -c "import TDLM; print(f'TDLM version: {TDLM.__version__}')" | |
| - name: Run tests in conda environment | |
| shell: bash -l {0} | |
| run: | | |
| conda activate test-env | |
| conda install pytest pytest-cov -y | |
| pytest tests/ -v | |
| - name: Upload conda artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
| with: | |
| name: conda-dist | |
| path: conda-dist/ | |
| # test-environment-yml: | |
| # runs-on: ubuntu-latest | |
| # needs: test-conda-build # ensures the conda build job completes before this job runs | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # | |
| # - name: Download conda artifact | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # name: conda-dist | |
| # path: conda-dist | |
| # | |
| # - name: Set up Miniconda | |
| # uses: conda-incubator/setup-miniconda@v2 | |
| # with: | |
| # auto-update-conda: true | |
| # python-version: 3.9 | |
| # channels: conda-forge,defaults | |
| # | |
| # - name: Create environment from environment.yml | |
| # shell: bash -l {0} | |
| # run: | | |
| # conda env create -f environment.yml | |
| # | |
| # - name: Test environment | |
| # shell: bash -l {0} | |
| # run: | | |
| # conda activate pytdlm | |
| # python -c "import numpy, pandas, tabulate, tqdm; print('All dependencies imported successfully')" | |
| # | |
| # # Install the pre-built conda package | |
| # PACKAGE_PATH=$(find conda-dist -name "*.tar.bz2" | head -1) | |
| # echo "Installing package: $PACKAGE_PATH" | |
| # conda install $PACKAGE_PATH -y | |
| # python -c "from TDLM import tdlm; print('TDLM imported successfully')" | |
| # python -c "import TDLM; print(f'TDLM version: {TDLM.__version__}')" | |
| # | |
| # - name: Run tests in conda environment | |
| # shell: bash -l {0} | |
| # run: | | |
| # conda activate pytdlm | |
| # pytest tests/ -v | |