Skip to content

Commit

Permalink
Merge branch 'main' into ci/enable_sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang authored May 8, 2024
2 parents 6670492 + a7aadb7 commit b3377b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:
uses: actions/checkout@v3
- name: Build ota-test_base docker image
run: |
docker-compose -f docker/docker-compose_tests.yml build
docker compose -f docker/docker-compose_tests.yml build
- name: Execute pytest with coverage trace under ota-test_base container
run: |
set -o pipefail
mkdir -p test_result
docker compose -f docker/docker-compose_tests.yml up --abort-on-container-exit
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
continue-on-error: true
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ build
# local vscode configs
.devcontainer
.vscode

# local test artifacts
test_result/
2 changes: 1 addition & 1 deletion docker/docker-compose_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ services:
dockerfile: ./docker/test_base/Dockerfile
image: ota-test_base
network_mode: bridge
command: "python3 -m pytest"
container_name: ota-test
volumes:
- ../pyproject.toml:/ota-client/pyproject.toml:ro
- ../.flake8:/ota-client/.flake8:ro
- ../otaclient:/ota-client/otaclient:ro
- ../tests:/ota-client/tests:ro
- ../test_result:/ota-client/test_result:rw
6 changes: 4 additions & 2 deletions docker/test_base/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ TESTS_DEPENDENCIES="${OTA_CLIENT_DIR}/tests/requirements.txt"
python3 -m pip install --no-cache-dir -q -r $TESTS_DEPENDENCIES

# exec the input params
echo "execute command..."
exec "$@"
echo "execute test with coverage"
cd "${OTA_CLIENT_DIR}"
coverage run -m pytest --junit-xml=test_result/pytest.xml "${@:-}"
coverage xml -o test_result/coverage.xml

0 comments on commit b3377b9

Please sign in to comment.