Merge/ariza #143
Workflow file for this run
This file contains 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: Test PR | |
on: | |
pull_request: | |
paths-ignore: ["**/docker.yaml", "docs"] | |
env: | |
NUM_WORKERS: 2 | |
TEST_DATA_FOLDER: ${{ github.workspace }}/test_data | |
jobs: | |
test: | |
name: ${{ matrix.python-version }}--${{ matrix.runs-on }} | |
runs-on: ${{ matrix.runs-on }} | |
if: ${{ !contains(github.event.pull_request.title, '[skip ci]') }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
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: cormorack/http:latest | |
ports: | |
- 8080:80 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags. | |
- name: Set up Python | |
uses: actions/setup-python@v4.7.1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- 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 | |
# We only want to install this on one run, because otherwise we'll have | |
# duplicate annotations. | |
- name: Install error reporter | |
if: ${{ matrix.python-version == '3.9' }} | |
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: Copying test data to services | |
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/ | |
# Add the following steps for downloading and unzipping test data | |
- name: Download Test Data from Google Drive | |
run: | | |
wget --load-cookies /tmp/cookies.txt "https://drive.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://drive.google.com/uc?export=download&id=1ofiSQ4zDwXfHE65tow4_jDIceBYHNW_8' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1ofiSQ4zDwXfHE65tow4_jDIceBYHNW_8" -O test_data.zip && rm -rf /tmp/cookies.txt | |
unzip -n test_data.zip -d ${{ env.TEST_DATA_FOLDER }} | |
- name: Finding changed files | |
id: files | |
uses: Ana06/get-changed-files@v2.2.0 | |
with: | |
format: 'csv' | |
- name: Print Changed files | |
run: echo "${{ steps.files.outputs.added_modified_renamed }}" | |
- name: Running all Tests | |
if: contains(github.event.pull_request.title, '[all tests ci]') | |
run: | | |
pytest -vvv -rx --numprocesses=${{ env.NUM_WORKERS }} --max-worker-restart=3 --cov=echopype --cov-report=xml --log-cli-level=WARNING --disable-warnings | |
- name: Running Tests | |
if: ${{ !contains(github.event.pull_request.title, '[all tests ci]') }} | |
run: | | |
python .ci_helpers/run-test.py --pytest-args="--log-cli-level=WARNING,-vvv,-rx,--numprocesses=${{ env.NUM_WORKERS }},--max-worker-restart=3,--disable-warnings" --include-cov ${{ steps.files.outputs.added_modified_renamed }} | |
- name: Upload code coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: RUNNER_OS,PYTHON_VERSION | |
name: codecov-umbrella | |
fail_ci_if_error: false |