Merge pull request #1648 from LOCEANlloydizard/fix-warnings #468
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: build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: ["**/docker.yaml"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NUM_WORKERS: auto | |
| USE_POOCH: "True" | |
| ECHOPYPE_DATA_VERSION: v0.11.1a2 | |
| ECHOPYPE_DATA_BASEURL: https://github.com/OSOceanAcoustics/echopype/releases/download/{version}/ | |
| XDG_CACHE_HOME: ${{ github.workspace }}/.cache | |
| jobs: | |
| unit-tests: | |
| name: unit--${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Remove docker-compose python | |
| run: sed -i "/docker-compose/d" requirements-dev.txt | |
| - name: Install dev tools | |
| run: python -m pip install -r requirements-dev.txt | |
| - name: Install echopype | |
| run: python -m pip install -e ".[plot]" | |
| - name: Install pooch (needed by conftest) | |
| run: python -m pip install pooch | |
| - name: Run unit tests | |
| run: | | |
| pytest -m unit -vvv -rx --numprocesses=auto \ | |
| --cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| flags: unit | |
| env_vars: RUNNER_OS,PYTHON_VERSION | |
| name: codecov-unit | |
| fail_ci_if_error: false | |
| integration-tests: | |
| name: integration--${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| runs-on: [ubuntu-latest] | |
| experimental: [false] | |
| services: | |
| # TODO: figure out how to update tag when there's a new one | |
| minio: | |
| image: cormorack/minioci:latest | |
| ports: | |
| - 9000:9000 | |
| httpserver: | |
| image: httpd:2.4 | |
| ports: | |
| - 8080:80 | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| - name: Free disk space | |
| if: runner.os == 'Linux' | |
| run: | | |
| set -eux | |
| echo "Before cleanup:" | |
| df -h | |
| for p in /usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL; do | |
| if [ -d "$p" ]; then | |
| echo "Removing $p (size: $(du -sh "$p" | cut -f1))" | |
| sudo rm -rf "$p" | |
| else | |
| echo "Not present: $p" | |
| fi | |
| done | |
| sudo apt-get clean | |
| sudo rm -rf /var/lib/apt/lists/* | |
| echo "After cleanup:" | |
| df -h | |
| - name: Set up Python | |
| uses: actions/setup-python@v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: System usage (baseline) | |
| if: runner.os == 'Linux' | |
| run: | | |
| set -eux | |
| echo "== Disk ==" | |
| df -h | |
| echo "== Memory ==" | |
| free -h | |
| echo "== Swap ==" | |
| swapon --show || true | |
| echo "== Top memory processes ==" | |
| ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 20 || true | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Set environment variables | |
| run: | | |
| echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
| - name: Remove docker-compose python | |
| run: sed -i "/docker-compose/d" requirements-dev.txt | |
| - name: Install dev tools | |
| run: python -m pip install -r requirements-dev.txt | |
| - name: Cache echopype test data | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.XDG_CACHE_HOME }}/echopype | |
| key: ep-data-${{ env.ECHOPYPE_DATA_VERSION }} | |
| - name: Ensure pooch (for GitHub assets) | |
| run: python -m pip install "pooch>=1.8" | |
| - name: Install error reporter | |
| if: ${{ matrix.python-version == '3.13' }} | |
| run: python -m pip install pytest-github-actions-annotate-failures | |
| - name: Install echopype | |
| run: python -m pip install -e ".[plot]" | |
| - name: Print installed packages | |
| run: python -m pip list | |
| - name: System usage (after install) | |
| if: runner.os == 'Linux' | |
| run: | | |
| set -eux | |
| df -h | |
| free -h | |
| du -h -d 2 "${{ env.XDG_CACHE_HOME }}" || true | |
| ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 20 || true | |
| - name: Pre-fetch Pooch test data | |
| run: | | |
| pytest --collect-only -q | |
| - name: Copy test data to MinIO and HTTP server | |
| run: | | |
| python .ci_helpers/docker/setup-services.py --deploy --data-only --http-server ${{ job.services.httpserver.id }} | |
| # Check data endpoint | |
| curl http://localhost:8080/data/ | |
| - name: System usage (after services) | |
| if: runner.os == 'Linux' | |
| run: | | |
| set -eux | |
| df -h | |
| free -h | |
| du -h -d 2 "${{ env.XDG_CACHE_HOME }}" || true | |
| docker system df || true | |
| ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 20 || true | |
| - name: Running integration tests | |
| shell: bash -l {0} | |
| run: | | |
| pytest -m integration -vvv -rx --numprocesses=${{ env.NUM_WORKERS }} --max-worker-restart=3 \ | |
| --cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| flags: integration | |
| env_vars: RUNNER_OS,PYTHON_VERSION | |
| name: codecov-integration | |
| fail_ci_if_error: false | |
| - name: System usage (final) | |
| if: always() && runner.os == 'Linux' | |
| run: | | |
| set -eux | |
| echo "== Disk ==" | |
| df -h | |
| echo "== Memory ==" | |
| free -h | |
| echo "== Cache dir ==" | |
| du -h -d 2 "${{ env.XDG_CACHE_HOME }}" || true | |
| echo "== Docker ==" | |
| docker system df || true | |
| echo "== Top memory processes ==" | |
| ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 30 || true |