forked from OSOceanAcoustics/echopype
-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (89 loc) · 3.86 KB
/
pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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