deism #59
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
| # This workflow will upload a Python Package using Twine when a release is created | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: deism | |
| on: | |
| release: | |
| types: [published, prereleased] | |
| jobs: | |
| build-and-publish: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-13, macos-latest, windows-latest] | |
| python-version: ['3.9', '3.10', '3.11'] | |
| exclude: | |
| - os: macos-latest | |
| python-version: 3.9 | |
| permissions: | |
| id-token: write # OIDC token required for authentication | |
| # contents: read | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v3 | |
| # Step 2: Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Step 3: Install system dependencies for gmsh (Ubuntu only) | |
| - name: Install system dependencies | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libglu1-mesa-dev libgl1-mesa-dev build-essential | |
| # Step 4: Install dependencies using pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip # Ensure pip is up-to-date | |
| pip install -r requirements.txt # Install dependencies from requirements.txt | |
| - name: Build package | |
| run: | | |
| # Add ARCHFLAGS for macOS to build universal binary | |
| if [[ "$RUNNER_OS" == "macOS" ]]; then | |
| export ARCHFLAGS="-arch x86_64 -arch arm64" | |
| fi | |
| python -m pip install -e . | |
| shell: bash | |
| - name: Test with pytest | |
| run: | | |
| pip install -U pytest setuptools build wheel twine | |
| ls -l deism/tests | |
| pytest | |
| # Build wheels (platform-specific) | |
| - name: Build wheels (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| pip install auditwheel | |
| python -m build --wheel | |
| auditwheel repair dist/*.whl | |
| twine check dist/* | |
| - name: Build wheels (macOS/Windows) | |
| if: matrix.os != 'ubuntu-latest' | |
| run: | | |
| python -m build --wheel | |
| twine check dist/* | |
| # Build source distribution on all platforms | |
| - name: Build source distribution | |
| run: | | |
| python -m build --sdist | |
| twine check dist/* | |
| # Publish wheels to PyPI (only for production releases, not prereleases, all platforms) | |
| - name: Publish wheels to PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease | |
| run: | | |
| python -m pip install --upgrade twine | |
| twine upload --skip-existing dist/*.whl | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.API_TOKEN }} | |
| # Publish source distribution (only for production releases, all platforms) | |
| - name: Publish source distribution to PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' && !github.event.release.prerelease | |
| run: | | |
| python -m pip install --upgrade twine | |
| twine upload --skip-existing dist/*.tar.gz | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.API_TOKEN }} |