Add comprehensive test suite (#21) #290
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: CD | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| pypi: | |
| name: build and deploy to PyPI | |
| if: github.repository == 'ACCESS-NRI/ACCESS-MOPPeR' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| runs-on: "ubuntu-latest" | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Install build dependencies | |
| run: python -m pip install build twine | |
| - name: Build distributions | |
| shell: bash -l {0} | |
| run: | | |
| git clean -xdf | |
| pyproject-build | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| conda: | |
| name: build and deploy to conda (${{ matrix.os }}) | |
| needs: pypi | |
| if: always() && needs.pypi.result == 'success' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macOS-latest, ubuntu-latest] | |
| python-version: [3.11] | |
| steps: | |
| - name: Debug matrix info | |
| run: | | |
| echo "Running on: ${{ matrix.os }}" | |
| echo "Python version: ${{ matrix.python-version }}" | |
| echo "Runner OS: ${{ runner.os }}" | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Wait for PyPI propagation | |
| run: | | |
| echo "Waiting for PyPI package to be available..." | |
| PACKAGE_NAME="access-mopper" | |
| VERSION=$(python -c "import versioneer; print(versioneer.get_version())") | |
| echo "Looking for package: ${PACKAGE_NAME}==${VERSION}" | |
| # Wait up to 10 minutes for the package to be available | |
| for i in {1..60}; do | |
| echo "Attempt $i/60: Checking PyPI availability..." | |
| if pip index versions ${PACKAGE_NAME} 2>/dev/null | grep -q "${VERSION}"; then | |
| echo "✅ Package ${PACKAGE_NAME}==${VERSION} is available on PyPI!" | |
| break | |
| fi | |
| if [ $i -eq 60 ]; then | |
| echo "❌ Package not found on PyPI after 10 minutes" | |
| exit 1 | |
| fi | |
| echo "Package not yet available, waiting 10 seconds..." | |
| sleep 10 | |
| done | |
| - name: Setup conda environment | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniconda-version: "latest" | |
| python-version: ${{ matrix.python-version }} | |
| environment-file: .conda/environment.yml | |
| auto-update-conda: false | |
| auto-activate-base: false | |
| show-channel-urls: true | |
| - name: Build and upload the conda package | |
| uses: ACCESS-NRI/action-build-and-upload-conda-packages@v2.0.1 | |
| with: | |
| meta_yaml_dir: .conda | |
| python-version: ${{ matrix.python-version }} | |
| user: accessnri | |
| label: main | |
| token: ${{ secrets.anaconda_token }} |