Skip to content
Snippets Groups Projects
Commit 02357e38 authored by Tristan Maat's avatar Tristan Maat
Browse files

.gitlab-ci.yml: Drop root privileges for some tests

parent c1c20402
No related branches found
No related tags found
Loading
Pipeline #
...@@ -15,16 +15,22 @@ before_script: ...@@ -15,16 +15,22 @@ before_script:
- df -h - df -h
# Store cache in the project directory # Store cache in the project directory
- mkdir -p "$(pwd)/cache" - if [ -d "$(pwd)/cache" ]; then chmod -R a+rw "$(pwd)/cache"; fi
- export XDG_CACHE_HOME="$(pwd)/cache" - export XDG_CACHE_HOME="$(pwd)/cache"
- adduser -m buildstream
# Run premerge commits # Run premerge commits
# #
pytest: pytest:
stage: test stage: test
script: script:
- python3 setup.py test - chmod -R a+rw .
# We run as a simple user to test for permission issues
- su buildstream -c 'python3 setup.py test'
- mkdir -p coverage-pytest/ - mkdir -p coverage-pytest/
- chmod -R a+rw coverage-pytest/
- cp .coverage.* coverage-pytest/coverage.pytest - cp .coverage.* coverage-pytest/coverage.pytest
artifacts: artifacts:
paths: paths:
...@@ -37,10 +43,16 @@ integration_linux: ...@@ -37,10 +43,16 @@ integration_linux:
script: script:
- pip3 install --no-index . - pip3 install --no-index .
- chown -R buildstream:buildstream integration-tests
- chown -R buildstream:buildstream /home/buildstream/.gnupg
- cd integration-tests - cd integration-tests
- ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test
# We run as a simple user to test for permission issues
- su buildstream -c './run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test'
- cd .. - cd ..
- mkdir -p coverage-linux/ - mkdir -p coverage-linux/
- chmod -R a+rw coverage-linux/
- cp integration-tests/.coverage coverage-linux/coverage.linux - cp integration-tests/.coverage coverage-linux/coverage.linux
- cp -a integration-tests/tmp/logs logs-linux - cp -a integration-tests/tmp/logs logs-linux
...@@ -59,7 +71,10 @@ pytest_unix: ...@@ -59,7 +71,10 @@ pytest_unix:
# disappear unless we mark it as user-installed. # disappear unless we mark it as user-installed.
- dnf mark install fuse-libs - dnf mark install fuse-libs
- dnf erase -y bubblewrap ostree - dnf erase -y bubblewrap ostree
# Since the unix platform is required to run as root, no user change required
- python3 setup.py test - python3 setup.py test
- mkdir -p coverage-pytest-unix - mkdir -p coverage-pytest-unix
- cp .coverage.* coverage-pytest-unix/coverage.pytest-unix - cp .coverage.* coverage-pytest-unix/coverage.pytest-unix
artifacts: artifacts:
...@@ -73,7 +88,10 @@ integration_unix: ...@@ -73,7 +88,10 @@ integration_unix:
script: script:
- pip3 install --no-index . - pip3 install --no-index .
- cd integration-tests - cd integration-tests
# Since the unix platform is required to run as root, no user change required
- ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test - ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test
- cd .. - cd ..
- mkdir -p coverage-unix/ - mkdir -p coverage-unix/
- cp integration-tests/.coverage coverage-unix/coverage.unix - cp integration-tests/.coverage coverage-unix/coverage.unix
......
...@@ -3,6 +3,7 @@ test=pytest ...@@ -3,6 +3,7 @@ test=pytest
[tool:pytest] [tool:pytest]
addopts = --verbose --basetemp ./tmp --pep8 --cov=buildstream --cov-config .coveragerc addopts = --verbose --basetemp ./tmp --pep8 --cov=buildstream --cov-config .coveragerc
norecursedirs = integration-tests*
python_files = tests/*/*.py python_files = tests/*/*.py
pep8maxlinelength = 119 pep8maxlinelength = 119
pep8ignore = pep8ignore =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment