Skip to content

Commit

Permalink
Merge pull request galaxyproject#13358 from mvdbeek/codecoverage
Browse files Browse the repository at this point in the history
Report code coverage (for pytest test suites)
  • Loading branch information
mvdbeek authored Feb 18, 2022
2 parents f13faf8 + 4dca001 commit fa3ae1d
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 24 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ jobs:
path: .venv
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}-api
- name: Run tests
run: ./run_tests.sh --skip_flakey_fails -api
run: ./run_tests.sh --coverage --skip_flakey_fails -api
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: api
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/api_paste.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ jobs:
path: .venv
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}-api-paste
- name: Run tests
run: ./run_tests.sh --skip_flakey_fails -api
run: ./run_tests.sh --coverage --skip_flakey_fails -api
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: api-paste
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/cwl_conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ jobs:
path: .venv
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}
- name: Run tests
run: ./run_tests.sh --skip_flakey_fails -cwl lib/galaxy_test/api/cwl -- -m "${{ matrix.marker }} and ${{ matrix.conformance-version }}"
run: ./run_tests.sh --coverage --skip_flakey_fails -cwl lib/galaxy_test/api/cwl -- -m "${{ matrix.marker }} and ${{ matrix.conformance-version }}"
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: cwl-conformance
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ jobs:
path: .venv
key: gxy-venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}-framework
- name: Run tests
run: ./run_tests.sh --framework
run: ./run_tests.sh --coverage --framework
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: framework
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ jobs:
- name: Run tests
run: |
. .ci/minikube-test-setup/start_services.sh
./run_tests.sh -integration test/integration -- --num-shards=4 --shard-id=${{ matrix.chunk }}
./run_tests.sh --coverage -integration test/integration -- --num-shards=4 --shard-id=${{ matrix.chunk }}
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: integration
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/integration_selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ jobs:
yarn-lock-file: 'galaxy root/client/yarn.lock'
- uses: nanasess/setup-chromedriver@master
- name: Run tests
run: ./run_tests.sh -integration test/integration_selenium
run: ./run_tests.sh --coverage -integration test/integration_selenium
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: integration-selenium
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ jobs:
yarn-lock-file: 'galaxy root/client/yarn.lock'
- uses: nanasess/setup-chromedriver@master
- name: Run tests
run: ./run_tests.sh -selenium lib/galaxy_test/selenium -- --num-shards=3 --shard-id=${{ matrix.chunk }}
run: ./run_tests.sh --coverage -selenium lib/galaxy_test/selenium -- --num-shards=3 --shard-id=${{ matrix.chunk }}
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: selenium
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/selenium_beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ jobs:
yarn-lock-file: 'galaxy root/client/yarn.lock'
- uses: nanasess/setup-chromedriver@master
- name: Run tests
run: ./run_tests.sh -selenium lib/galaxy_test/selenium -- --num-shards=3 --shard-id=${{ matrix.chunk }}
run: ./run_tests.sh --coverage -selenium lib/galaxy_test/selenium -- --num-shards=3 --shard-id=${{ matrix.chunk }}
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: selenium-beta-history
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ jobs:
key: tox-cache-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('galaxy root/requirements.txt') }}-unit
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get -y install ffmpeg
- name: Install tox
run: pip install tox
- name: Run tests
run: tox -e unit
run: ./run_tests.sh --coverage -u
working-directory: 'galaxy root'
- uses: codecov/codecov-action@v2
with:
flags: py-unit
working-directory: 'galaxy root'
- uses: actions/upload-artifact@v2
if: failure()
with:
Expand Down
2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ fi
export GALAXY_TEST_TOOL_CONF
if [ "$test_script" = 'pytest' ]; then
if [ "$coverage_arg" = '--with-coverage' ]; then
coverage_arg="--cov-report term --cov=lib"
coverage_arg="--cov-report xml --cov-report term --cov=lib"
fi
if [ -n "$marker" ]; then
marker_args=(-m "$marker")
Expand Down
17 changes: 5 additions & 12 deletions scripts/common_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,23 @@ if [ $SET_VENV -eq 1 ] && [ $CREATE_VENV -eq 1 ]; then
if command -v virtualenv >/dev/null; then
virtualenv -p "$GALAXY_PYTHON" "$GALAXY_VIRTUAL_ENV"
else
vvers=16.7.9
vurl="https://files.pythonhosted.org/packages/source/v/virtualenv/virtualenv-${vvers}.tar.gz"
vsha=0d62c70883c0342d59c11d0ddac0d954d0431321a41ab20851facf2b222598f3
min_python_version=3.7
vurl="https://bootstrap.pypa.io/virtualenv/${min_python_version}/virtualenv.pyz"
vtmp=$(mktemp -d -t galaxy-virtualenv-XXXXXX)
vsrc="$vtmp/$(basename $vurl)"
# SSL certificates are not checked to prevent problems with messed
# up client cert environments. We verify the download using a known
# good sha256 sum instead.
echo "Fetching $vurl"
if command -v curl >/dev/null; then
curl --insecure -L -o "$vsrc" "$vurl"
curl -L -o "$vsrc" "$vurl"
elif command -v wget >/dev/null; then
wget --no-check-certificate -O "$vsrc" "$vurl"
wget -O "$vsrc" "$vurl"
else
"$GALAXY_PYTHON" -c "try:
from urllib import urlretrieve
except:
from urllib.request import urlretrieve
urlretrieve('$vurl', '$vsrc')"
fi
echo "Verifying $vsrc checksum is $vsha"
"$GALAXY_PYTHON" -c "import hashlib; assert hashlib.sha256(open('$vsrc', 'rb').read()).hexdigest() == '$vsha', '$vsrc: invalid checksum'"
tar zxf "$vsrc" -C "$vtmp"
"$GALAXY_PYTHON" "$vtmp/virtualenv-$vvers/virtualenv.py" "$GALAXY_VIRTUAL_ENV"
"$GALAXY_PYTHON" "$vsrc" "$GALAXY_VIRTUAL_ENV"
rm -rf "$vtmp"
fi
fi
Expand Down

0 comments on commit fa3ae1d

Please sign in to comment.