diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 4f067327d..b9391bc6d 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -21,9 +21,9 @@ jobs: os: [windows-latest, macOS-13, ubuntu-latest] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -37,7 +37,7 @@ jobs: python setup.py bdist_wheel ls dist/* - name: Save wheel - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl path: dist/wntr* @@ -52,11 +52,11 @@ jobs: fail-fast: false steps: - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Download wheel - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: wntr_${{ matrix.python-version }}_${{ matrix.os }}.whl - name: Install wntr @@ -76,9 +76,9 @@ jobs: os: [windows-latest, macOS-13, ubuntu-latest] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -94,33 +94,35 @@ jobs: coverage run --context=${{ matrix.os }}.py${{ matrix.python-version }} --source=wntr --omit="*/tests/*","*/sim/network_isolation/network_isolation.py","*/sim/aml/evaluator.py" --append -m pytest --doctest-glob="*.rst" documentation env: COVERAGE_FILE: .coverage.${{ matrix.python-version }}.${{ matrix.os }} - - name: Save coverage - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: coverage + name: .coverage.${{ matrix.python-version }}.${{ matrix.os }} path: .coverage.${{ matrix.python-version }}.${{ matrix.os }} + include-hidden-files: true combine_reports: needs: [ pytest_coverage ] runs-on: ubuntu-latest steps: - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.11 - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install coverage run: | python -m pip install --upgrade pip pip install -r requirements.txt python -m pip install -e . - # pip install coveralls + pip install coveralls - name: Download coverage artifacts from test matrix - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: - name: coverage + pattern: .coverage.*.ubuntu-latest # coverage from other OS cause problems - name: Setup coverage and combine reports + run: coverage combine .coverage.*.ubuntu-latest + - name: Create coverage report run: | echo "[paths]" > .coveragerc echo "source = " >> .coveragerc @@ -129,55 +131,21 @@ jobs: echo " D:\\a\\WNTR\\WNTR\\wntr" >> .coveragerc echo " /home/runner/work/WNTR/WNTR/wntr" >> .coveragerc echo " /Users/runner/work/WNTR/WNTR/wntr" >> .coveragerc - coverage combine - - name: Create coverage report - run: | + echo " ${{ github.workspace }}/wntr" >> .coveragerc coverage report coverage json --pretty-print coverage html --show-contexts - name: Save coverage JSON - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-json path: coverage.json - name: Save coverage html - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: coverage + name: coverage-html path: htmlcov - - combine_reports_upload_coveralls: - needs: [ pytest_coverage ] - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - uses: actions/checkout@v2 - - name: Install coverage - run: | - python -m pip install --upgrade pip - pip install coveralls - pip install -r requirements.txt - python -m pip install -e . - - name: Download coverage artifacts from test matrix - uses: actions/download-artifact@v2 - with: - name: coverage - - name: Setup coverage and combine reports - run: | - echo "[paths]" > .coveragerc - echo "source = " >> .coveragerc - echo " wntr/" >> .coveragerc - echo " wntr\\" >> .coveragerc - echo " D:\\a\\WNTR\\WNTR\\wntr" >> .coveragerc - echo " /home/runner/work/WNTR/WNTR/wntr" >> .coveragerc - echo " /Users/runner/work/WNTR/WNTR/wntr" >> .coveragerc - coverage combine - name: Push to coveralls - run: | - coveralls --service=github + run: coveralls --service=github --rcfile=.coveragerc env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e4de3db7..a976f3e41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,48 +10,72 @@ on: jobs: wheels: + name: Build distribution 📦 on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-2019, macOS-13, ubuntu-20.04] + os: [windows-latest, macOS-13, macos-13, ubuntu-latest] steps: - - uses: actions/checkout@v3 + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Build wheels - uses: pypa/cibuildwheel@v2.11.1 + uses: pypa/cibuildwheel@79b0dd328794e1180a7268444d46cdf12e1abd01 # v2.21.0 env: CIBW_ENVIRONMENT: BUILD_WNTR_EXTENSIONS='true' - CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* + CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-* CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *-musllinux*" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl source: + name: Make SDist artifact 📦 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: actions/setup-python@v5 with: python-version: '3.11' - - name: build the sdist - run: | - python -m pip install --upgrade build - python -m build --sdist - - uses: actions/upload-artifact@v3 + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: + name: cibw-sdist path: dist/*.tar.gz publish-to-pypi: + name: Publish Python 🐍 distribution 📦 to PyPI needs: [wheels, source] runs-on: ubuntu-latest + environment: + name: release + permissions: + id-token: write if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - - uses: actions/download-artifact@v3 + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + + - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: - name: artifact + pattern: cibw-* path: dist + merge-multiple: true - - uses: pypa/gh-action-pypi-publish@release/v1 + - uses: pypa/gh-action-pypi-publish@0ab0b79471669eb3a4d647e625009c62f9f3b241 # release/v1 with: user: __token__ password: ${{ secrets.PYPI_WNTR_API_TOKEN }} diff --git a/requirements.txt b/requirements.txt index 8ffd8b319..da4347a42 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ folium utm openpyxl geopandas<1.0 +fiona<1.10 rtree # Documentation