[pre-commit.ci] auto fixes from pre-commit.com hooks #1873
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: Pytest, build docker image, push to GHCR | |
| on: [pull_request, push] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| env: | |
| # https://github.com/pytest-dev/pytest/issues/2042#issuecomment-429289164 | |
| PY_IGNORE_IMPORTMISMATCH: 1 | |
| jobs: | |
| pytest: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-14] | |
| deps: | |
| - label: Latest | |
| # we can't specify `tophu` for conda, not available on mac | |
| # Numba pin: https://github.com/numba/numba/blob/release0.61/numba/__init__.py#L42-L45 | |
| spec: >- | |
| isce3-cpu | |
| dask | |
| numpy<2.3 | |
| fail-fast: true | |
| name: ${{ matrix.os }} • ${{ matrix.deps.label }} | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup environment | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-file: conda-env.yml | |
| environment-name: dolphin-env | |
| # persist on the same day. | |
| cache-environment-key: environment-${{ steps.date.outputs.date }} | |
| cache-downloads-key: downloads-${{ steps.date.outputs.date }} | |
| generate-run-shell: false | |
| create-args: ${{ matrix.deps.spec }} | |
| condarc: | | |
| channels: | |
| - conda-forge | |
| - name: Install | |
| # TODO: remove ortools pin when fixed: https://github.com/google/or-tools/issues/4674 | |
| run: | | |
| python -m pip install --no-deps . | |
| - name: Install test dependencies | |
| # Remove pytest pin when fixed: https://github.com/pytest-dev/pytest-cov/issues/693 | |
| run: | | |
| python -m pip install -r tests/requirements.txt "pytest<8.4" "ortools!=9.13.*" | |
| python -m pip install --no-deps \ | |
| git+https://github.com/isce-framework/tophu@main \ | |
| "snaphu>=0.4.0" | |
| - name: Enable numba boundscheck for better error catching | |
| run: | | |
| echo "NUMBA_BOUNDSCHECK=1" >> $GITHUB_ENV | |
| echo "TQDM_DISABLE=1" >> $GITHUB_ENV | |
| - name: Test (with numba boundscheck on) | |
| run: | | |
| pytest -n0 --capture=no -vv | |
| # https://community.codecov.com/t/numba-jitted-methods-are-not-captured-by-codecov/2649 | |
| # - name: Coverage report | |
| # uses: codecov/codecov-action@v2 | |
| dockerize: # Based on Mintpy: https://github.com/insarlab/MintPy/blob/5ca554fef324b816f9130feec567e2cf463e41d2/.github/workflows/build-n-publish-to-pypi.yml | |
| name: Build Docker image and push to GitHub Container Registry | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Set environment variables for docker build | |
| run: | | |
| pip install setuptools_scm # Install setuptools_scm to get version number | |
| # Save version number from CLI | |
| version=$(python -m setuptools_scm) | |
| sanitized_version=${version//+/-} # Replace all '+' with '-' | |
| echo "DOLPHIN_VERSION=${sanitized_version}" >> $GITHUB_ENV | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build, tag, and push image to Github Container Registry | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ env.DOLPHIN_VERSION }} | |
| labels: | | |
| org.opencontainers.image.created=${{ env.CI_JOB_TIMESTAMP }} | |
| org.opencontainers.image.version=${{ env.DOLPHIN_VERSION }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| - name: Add develop tag | |
| if: github.ref == 'refs/heads/main' | |
| uses: akhilerm/[email protected] | |
| with: | |
| src: ghcr.io/${{ github.repository }}:${{ env.DOLPHIN_VERSION }} | |
| dst: ghcr.io/${{ github.repository }}:develop | |
| - name: Add latest tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: akhilerm/[email protected] | |
| with: | |
| src: ghcr.io/${{ github.repository }}:${{ env.DOLPHIN_VERSION }} | |
| dst: ghcr.io/${{ github.repository }}:latest |