--- # Author: Clayton Craft image: alpine:latest # defaults for "only" # We need to run the CI jobs in a "merge request specific context", if CI is # running in a merge request. Otherwise the environment variable that holds the # merge request ID is not available. This means, we must set the "only" # variable accordingly - and if we only do it for one job, all other jobs will # not get executed. So have the defaults here, and use them in all jobs that # should run on both the master branch, and in merge requests. # https://docs.gitlab.com/ee/ci/merge_request_pipelines/index.html#excluding-certain-jobs .only-default: &only-default only: - master - merge_requests - tags static-code-analysis: <<: *only-default before_script: - .ci/prepare.sh script: - su pmos -c "test/static_code_analysis.sh" vermin: image: alpine:latest <<: *only-default before_script: - "apk -q add py3-pip" - "pip3 -q --disable-pip-version-check install vermin" script: - ".ci/vermin.sh" # MR settings # (Checks for "Allow commits from members who can merge to the target branch") mr-settings: only: - merge_requests before_script: - apk -q add python3 script: - wget -q "https://gitlab.com/postmarketOS/ci-common/-/raw/master/check_mr_settings.py" - python3 ./check_mr_settings.py pytest: <<: *only-default before_script: - .ci/prepare.sh script: - su pmos -c .ci/pytest.sh after_script: # Move logs so it can be saved as artifacts - "[[ -f /home/pmos/.local/var/pmbootstrap/log.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log.txt $CI_PROJECT_DIR/log.txt" - "[[ -f /home/pmos/.local/var/pmbootstrap/log_testsuite.txt ]] && mv /home/pmos/.local/var/pmbootstrap/log_testsuite.txt $CI_PROJECT_DIR/log_testsuite.txt" - "[[ -f /home/pmos/.config/pmbootstrap.cfg ]] && cp /home/pmos/.config/pmbootstrap.cfg $CI_PROJECT_DIR/pmbootstrap.cfg" - "dmesg > $CI_PROJECT_DIR/dmesg.txt" artifacts: when: always paths: - "log.txt" - "log_testsuite.txt" - "dmesg.txt" - "pmbootstrap.cfg" expire_in: 1 week