Skip to content

Commit

Permalink
Remove some testing leftovers from PR #250 (#252)
Browse files Browse the repository at this point in the history
Fixes: #250
  • Loading branch information
ssbarnea authored Aug 14, 2024
1 parent a615966 commit 4f92145
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
10 changes: 10 additions & 0 deletions .github/check-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -eu
JOBS_PRODUCING_COVERAGE=7
declare -a FOUND_FILES
# IFS=$'\n' FOUND_FILES=( $(find . -name coverage.xml) )
while IFS='' read -r line; do FOUND_FILES+=("$line"); done < <(find . -name coverage.xml)

if [ "${#FOUND_FILES[@]}" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then
echo "::error::Broken CI/CD setup, found ${#FOUND_FILES[@]} coverage.xml file(s) instead of expected ${JOBS_PRODUCING_COVERAGE}. Found: ${FOUND_FILES[*]}"
exit 1
fi
22 changes: 8 additions & 14 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ concurrency:
cancel-in-progress: true

env:
ANSIBLE_FORCE_COLOR: 1
FORCE_COLOR: 1 # tox, pytest
PY_COLORS: 1

Expand All @@ -39,13 +40,12 @@ jobs:
other_names: |
lint
py39:tox -e py39-sanity;tox -e py39-unit;tox -e py39-integration;tox -e coverage
py312:tox -e py312-sanity;tox -e py312-unit;tox -e py312-integration;tox -e coverage
# py310:tox -e py310-sanity;tox -e py310-unit; tox -e py310-integration; tox -e coverage
# py311:tox -e py311-sanity;tox -e py311-unit; tox -e py311-integration; tox -e coverage
# py312:tox -e py312-sanity;tox -e py312-unit; tox -e py312-integration; tox -e coverage
# py39-macos:tox -e py39-sanity;tox -e py39-unit; tox -e py39-integration; tox -e coverage
# py312-macos:tox -e py312-sanity;tox -e py312-unit; tox -e py312-integration; tox -e coverage
# py311-linux-arm64:tox -e py312-sanity;tox -e py312-unit; tox -e py312-integration; tox -e coverage
py310:tox -e py310-sanity;tox -e py310-unit; tox -e py310-integration;tox -e coverage
py311:tox -e py311-sanity;tox -e py311-unit; tox -e py311-integration;tox -e coverage
py312:tox -e py312-sanity;tox -e py312-unit; tox -e py312-integration;tox -e coverage
py39-macos:tox -e py39-sanity;tox -e py39-unit;tox -e py39-integration;tox -e coverage
py312-macos:tox -e py312-sanity;tox -e py312-unit;tox -e py312-integration;tox -e coverage
py311-linux-arm64:tox -e py312-sanity;tox -e py312-unit;tox -e py312-integration;tox -e coverage
# ^ arm64 runner is using py311 for matching python version used in AAP 2.5
platforms: linux,macos,linux-arm64:ubuntu-24.04-arm64-2core
skip_explode: "1"
Expand Down Expand Up @@ -183,13 +183,7 @@ jobs:
path: .

- name: Check for expected number of coverage reports
run: |
JOBS_PRODUCING_COVERAGE=2
FIND_FILES="find */tests/output/reports -name 'coverage.xml'"
if [ "$($FIND_FILES | wc -l | bc)" -ne "${JOBS_PRODUCING_COVERAGE}" ]; then
echo "::error::Number of coverage.xml files was not the expected one (${JOBS_PRODUCING_COVERAGE}): $($FIND_FILES | xargs echo)"
exit 0
fi
run: .github/check-coverage.sh

- name: Upload coverage data
uses: codecov/codecov-action@v4
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ ci:
for more information, see https://pre-commit.ci
skip:
# These will not run on pre-commit.ci due to required network access:
- ansible-test-sanity
- tox
# These will not run on pre-commit.ci
- ansible-test-sanity # requires network access
- shellcheck # no docker
- tox # requires network access
exclude: "^.*\\.md$"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -18,6 +19,10 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
language_version: python3
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.13.1
hooks:
Expand Down
6 changes: 2 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ setenv =
PIP_NO_BUILD_ISOLATION = 1
PYTHONUNBUFFERED = 1
passenv =
ANSIBLE_FORCE_COLOR
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
Expand Down Expand Up @@ -75,10 +76,7 @@ commands =
# risky: not safe for development it affects user setup
ansible-galaxy collection install .
# use same coverage location as ansible-test:
coverage run --data-file=tests/output/coverage/integration.coverage -m pytest tests/integration -vvv -s {posargs} -k test_url_check_source_sanity
; sh -c "coverage combine -a -q --data-file=tests/output/coverage/integration.combined tests/output/coverage/integration*.coverage"
; sh -c "coverage report --data-file=tests/output/coverage/integration.combined --show-missing --skip-empty --include=extensions/*,plugins/*,tests/\*"
; bash -c "coverage xml --data-file=tests/output/coverage/integration.coverage -o {envdir}/coverage.xml --fail-under=0"
coverage run --data-file=tests/output/coverage/integration.coverage -m pytest tests/integration -vvv -s {posargs}

[testenv:unit,py{39,310,311,312,313}-unit]
description =
Expand Down

0 comments on commit 4f92145

Please sign in to comment.