[Notes] [Git][BuildStream/buildstream][chandan/toxify-1.2] .gitlab-ci.yml: Run tests using tox



Title: GitLab

Chandan Singh pushed to branch chandan/toxify-1.2 at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • .gitlab-ci.yml
    1
    -image: buildstream/testsuite-debian:9-master-114-4cab18e3
    
    1
    +image: buildstream/testsuite-debian:9-5da27168-32c47d1c
    
    2 2
     
    
    3 3
     cache:
    
    4 4
       key: "$CI_JOB_NAME-"
    
    ... ... @@ -6,49 +6,13 @@ cache:
    6 6
         - cache/
    
    7 7
     
    
    8 8
     stages:
    
    9
    -  - prepare
    
    10 9
       - test
    
    11 10
       - post
    
    12 11
     
    
    13
    -#####################################################
    
    14
    -#                  Prepare stage                    #
    
    15
    -#####################################################
    
    16
    -
    
    17
    -# Create a source distribution
    
    18
    -#
    
    19
    -source_dist:
    
    20
    -  stage: prepare
    
    21
    -  script:
    
    22
    -
    
    23
    -  # Generate the source distribution tarball
    
    24
    -  #
    
    25
    -  - python3 setup.py sdist
    
    26
    -  - tar -ztf dist/*
    
    27
    -  - tarball=$(cd dist && echo $(ls *))
    
    28
    -
    
    29
    -  # Create an installer script
    
    30
    -  - |
    
    31
    -    cat > dist/install.sh << EOF
    
    32
    -    #!/bin/sh
    
    33
    -    tar -zxf ${tarball}
    
    34
    -    cd ${tarball%.tar.gz}
    
    35
    -    pip3 install --no-index .
    
    36
    -    EOF
    
    37
    -
    
    38
    -  # unpack tarball as `dist/buildstream` directory
    
    39
    -  - |
    
    40
    -    cat > dist/unpack.sh << EOF
    
    41
    -    #!/bin/sh
    
    42
    -    tar -zxf ${tarball}
    
    43
    -    mv ${tarball%.tar.gz} buildstream
    
    44
    -    EOF
    
    45
    -
    
    46
    -  # Make our helpers executable
    
    47
    -  - chmod +x dist/install.sh
    
    48
    -  - chmod +x dist/unpack.sh
    
    49
    -  artifacts:
    
    50
    -    paths:
    
    51
    -    - dist/
    
    12
    +variables:
    
    13
    +  INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache"
    
    14
    +  TEST_COMMAND: "tox -- --color=yes --integration"
    
    15
    +  COVERAGE_PREFIX: "${CI_JOB_NAME}."
    
    52 16
     
    
    53 17
     
    
    54 18
     #####################################################
    
    ... ... @@ -57,66 +21,53 @@ source_dist:
    57 21
     
    
    58 22
     # Run premerge commits
    
    59 23
     #
    
    60
    -.linux-tests-template: &linux-tests
    
    24
    +.tests-template: &tests
    
    61 25
       stage: test
    
    62
    -  variables:
    
    63
    -    PYTEST_ADDOPTS: "--color=yes"
    
    64
    -  script:
    
    26
    +
    
    27
    +  before_script:
    
    65 28
       # Diagnostics
    
    66 29
       - mount
    
    67 30
       - df -h
    
    68 31
     
    
    32
    +  script:
    
    33
    +  - mkdir -p "${INTEGRATION_CACHE}"
    
    69 34
       - useradd -Um buildstream
    
    70 35
       - chown -R buildstream:buildstream .
    
    71 36
     
    
    72
    -  - export INTEGRATION_CACHE="$(pwd)/cache/integration-cache"
    
    73
    -
    
    74
    -  # Unpack and get into dist/buildstream
    
    75
    -  - cd dist && ./unpack.sh
    
    76
    -  - chown -R buildstream:buildstream buildstream
    
    77
    -  - cd buildstream
    
    37
    +  # Run the tests as a simple user to test for permission issues
    
    38
    +  - su buildstream -c "${TEST_COMMAND}"
    
    78 39
     
    
    79
    -  # Run the tests from the source distribution, We run as a simple
    
    80
    -  # user to test for permission issues
    
    81
    -  - su buildstream -c 'python3 setup.py test --index-url invalid://uri --addopts --integration'
    
    82
    -
    
    83
    -  # Go back to the toplevel and collect our reports
    
    84
    -  - cd ../..
    
    85
    -  - mkdir -p coverage-linux/
    
    86
    -  - cp dist/buildstream/.coverage.* coverage-linux/coverage."${CI_JOB_NAME}"
    
    87 40
       except:
    
    88 41
       - schedules
    
    89 42
       artifacts:
    
    90 43
         paths:
    
    91
    -    - coverage-linux/
    
    44
    +    - .coverage-reports
    
    92 45
     
    
    93 46
     tests-debian-9:
    
    94
    -  image: buildstream/testsuite-debian:9-master-117-aa3a33b3
    
    95
    -  <<: *linux-tests
    
    47
    +  image: buildstream/testsuite-debian:9-5da27168-32c47d1c
    
    48
    +  <<: *tests
    
    96 49
     
    
    97 50
     tests-fedora-27:
    
    98
    -  image: buildstream/testsuite-fedora:27-master-117-aa3a33b3
    
    99
    -  <<: *linux-tests
    
    51
    +  image: buildstream/testsuite-fedora:27-5da27168-32c47d1c
    
    52
    +  <<: *tests
    
    100 53
     
    
    101 54
     tests-fedora-28:
    
    102
    -  image: buildstream/testsuite-fedora:28-master-117-aa3a33b3
    
    103
    -  <<: *linux-tests
    
    55
    +  image: buildstream/testsuite-fedora:28-5da27168-32c47d1c
    
    56
    +  <<: *tests
    
    104 57
     
    
    105 58
     tests-ubuntu-18.04:
    
    106
    -  image: buildstream/testsuite-ubuntu:18.04-master-117-aa3a33b3
    
    107
    -  <<: *linux-tests
    
    59
    +  image: buildstream/testsuite-ubuntu:18.04-5da27168-32c47d1c
    
    60
    +  <<: *tests
    
    108 61
     
    
    109 62
     tests-unix:
    
    110 63
       # Use fedora here, to a) run a test on fedora and b) ensure that we
    
    111 64
       # can get rid of ostree - this is not possible with debian-8
    
    112
    -  image: buildstream/testsuite-fedora:27-master-117-aa3a33b3
    
    113
    -  stage: test
    
    65
    +  image: buildstream/testsuite-fedora:27-5da27168-32c47d1c
    
    66
    +  <<: *tests
    
    114 67
       variables:
    
    115 68
         BST_FORCE_BACKEND: "unix"
    
    116
    -    PYTEST_ADDOPTS: "--color=yes"
    
    117
    -  script:
    
    118 69
     
    
    119
    -    - export INTEGRATION_CACHE="$(pwd)/cache/integration-cache"
    
    70
    +  script:
    
    120 71
     
    
    121 72
         # We remove the Bubblewrap and OSTree packages here so that we catch any
    
    122 73
         # codepaths that try to use them. Removing OSTree causes fuse-libs to
    
    ... ... @@ -124,39 +75,32 @@ tests-unix:
    124 75
         - dnf mark install fuse-libs
    
    125 76
         - dnf erase -y bubblewrap ostree
    
    126 77
     
    
    127
    -    # Unpack and get into dist/buildstream
    
    128
    -    - cd dist && ./unpack.sh && cd buildstream
    
    129
    -
    
    130 78
         # Since the unix platform is required to run as root, no user change required
    
    131
    -    - python3 setup.py test --index-url invalid://uri --addopts --integration
    
    79
    +    - ${TEST_COMMAND}
    
    80
    +
    
    81
    +# Lint separately from testing
    
    82
    +lint:
    
    83
    +  stage: test
    
    84
    +
    
    85
    +  before_script:
    
    86
    +  # Diagnostics
    
    87
    +  - python3 --version
    
    132 88
     
    
    133
    -    # Go back to the toplevel and collect our reports
    
    134
    -    - cd ../..
    
    135
    -    - mkdir -p coverage-unix/
    
    136
    -    - cp dist/buildstream/.coverage.* coverage-unix/coverage.unix
    
    89
    +  script:
    
    90
    +  - tox -e lint
    
    137 91
       except:
    
    138 92
       - schedules
    
    139
    -  artifacts:
    
    140
    -    paths:
    
    141
    -    - coverage-unix/
    
    142
    -    - logs-unix/
    
    143 93
     
    
    144 94
     
    
    145 95
     # Automatically build documentation for every commit, we want to know
    
    146 96
     # if building documentation fails even if we're not deploying it.
    
    147
    -# Note: We still do not enforce a consistent installation of python3-sphinx,
    
    148
    -#       as it will significantly grow the backing image.
    
    149 97
     docs:
    
    150 98
       stage: test
    
    99
    +  variables:
    
    100
    +    BST_FORCE_SESSION_REBUILD: 1
    
    151 101
       script:
    
    152
    -  - export BST_SOURCE_CACHE="$(pwd)/cache/integration-cache/sources"
    
    153
    -  - pip3 install sphinx
    
    154
    -  - pip3 install sphinx-click
    
    155
    -  - pip3 install sphinx_rtd_theme
    
    156
    -  - cd dist && ./unpack.sh && cd buildstream
    
    157
    -  - make BST_FORCE_SESSION_REBUILD=1 -C doc
    
    158
    -  - cd ../..
    
    159
    -  - mv dist/buildstream/doc/build/html public
    
    102
    +  - env BST_SOURCE_CACHE="$(pwd)/cache/integration-cache/sources" tox -e docs
    
    103
    +  - mv doc/build/html public
    
    160 104
       except:
    
    161 105
       - schedules
    
    162 106
       artifacts:
    
    ... ... @@ -170,7 +114,8 @@ docs:
    170 114
         bst_ext_ref: 1d6ab71151b93c8cbc0a91a36ffe9270f3b835f1 # 0.5.1
    
    171 115
         fd_sdk_ref: 88d7c22c2281b987faa02edd57df80d430eecf1f # 18.08.12
    
    172 116
       before_script:
    
    173
    -  - (cd dist && ./unpack.sh && cd buildstream && pip3 install .)
    
    117
    +  - pip3 install -r requirements/requirements.txt -r requirements/plugin-requirements.txt
    
    118
    +  - pip3 install --no-index .
    
    174 119
       - pip3 install --user -e ${bst_ext_url}@${bst_ext_ref}#egg=bst_ext
    
    175 120
       - git clone https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
    
    176 121
       - git -C freedesktop-sdk checkout ${fd_sdk_ref}
    
    ... ... @@ -253,21 +198,15 @@ coverage:
    253 198
       stage: post
    
    254 199
       coverage: '/TOTAL +\d+ +\d+ +(\d+\.\d+)%/'
    
    255 200
       script:
    
    256
    -    - cd dist && ./unpack.sh && cd buildstream
    
    257
    -    - pip3 install --no-index .
    
    258
    -    - mkdir report
    
    259
    -    - cd report
    
    260
    -    - cp ../../../coverage-unix/coverage.unix .
    
    261
    -    - cp ../../../coverage-linux/coverage.* .
    
    262
    -    - ls coverage.*
    
    263
    -    - coverage combine --rcfile=../.coveragerc -a coverage.*
    
    264
    -    - coverage report --rcfile=../.coveragerc -m
    
    201
    +    - cp -a .coverage-reports/ ./coverage-sources
    
    202
    +    - tox -e coverage
    
    203
    +    - cp -a .coverage-reports/ ./coverage-report
    
    265 204
       dependencies:
    
    266 205
       - tests-debian-9
    
    267 206
       - tests-fedora-27
    
    268 207
       - tests-fedora-28
    
    208
    +  - tests-ubuntu-18.04
    
    269 209
       - tests-unix
    
    270
    -  - source_dist
    
    271 210
       except:
    
    272 211
       - schedules
    
    273 212
     
    
    ... ... @@ -276,7 +215,6 @@ coverage:
    276 215
     pages:
    
    277 216
       stage: post
    
    278 217
       dependencies:
    
    279
    -  - source_dist
    
    280 218
       - docs
    
    281 219
       script:
    
    282 220
       - find public/
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]