.gitlab-ci.yml 2.75 KB
Newer Older
1 2 3
---

# global settings
4
image: alpine:latest
5 6 7 8 9 10
after_script:
  - .gitlab-ci/move_logs.sh $CI_PROJECT_DIR
stages:
  - first
  - second

11 12 13 14 15 16 17 18 19 20 21 22 23 24
# 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

25 26 27
# device documentation
wiki:
  stage: first
28
  <<: *only-default
29 30 31 32 33 34 35 36
  before_script:
    - apk -q add python3
  script:
    - .gitlab-ci/check_devices_in_wiki.py --booting

# static code analysis (shellcheck is not in Alpine, so we use Debian)
py-sh-static:
  stage: first
37
  <<: *only-default
38 39 40 41 42 43 44
  image: python:3.6-slim-stretch
  before_script:
    - apt -q update >/dev/null
    - apt -y install flake8 shellcheck >/dev/null
  script:
    - .gitlab-ci/static_code_analysis.sh

45 46 47 48 49 50 51 52 53
# coding style check
clang-format-static:
  stage: first
  <<: *only-default
  before_script:
    - apk -q add clang git
  script:
    - .gitlab-ci/static_clang-format.sh

54 55 56
# aports checks (generic)
aports-static:
  stage: first
57
  <<: *only-default
58 59 60
  before_script:
    - .gitlab-ci/install_pmbootstrap.sh pytest
  script:
61
    - apk -q add git
62
    - su pmos -c "pmbootstrap kconfig check"
63 64
    - su pmos -c ".gitlab-ci/run_testcases.sh
        -m 'not pmaports_upstream_compat'"
65
    - su pmos -c ".gitlab-ci/check_changed_aports_versions.py"
66 67 68 69 70 71 72 73
  artifacts:
    when: on_failure
    paths:
      - log.txt
      - log_testsuite_pmaports.txt
      - pmbootstrap.cfg
    expire_in: 1 week

74 75 76 77 78 79 80 81 82 83 84
# MR settings
# (Checks for "Allow commits from members who can merge to the target branch")
mr-settings:
  stage: first
  only:
    - merge_requests
  before_script:
    - apk -q add python3
  script:
    - .gitlab-ci/check_mr_settings.py

85 86 87
# aports checks (upstream compatibility)
aports-static-upstream:
  stage: second
88 89
  only:
    - master@postmarketOS/pmaports
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
  before_script:
    - .gitlab-ci/install_pmbootstrap.sh pytest
  script:
    - su pmos -c ".gitlab-ci/run_testcases.sh
        -m 'pmaports_upstream_compat'"
  artifacts:
    when: on_failure
    paths:
      - log.txt
      - log_testsuite_pmaports.txt
      - pmbootstrap.cfg
    expire_in: 1 week

# build changed aports
aports-build:
  stage: second
106
  <<: *only-default
107 108 109
  before_script:
    - .gitlab-ci/install_pmbootstrap.sh git
  script:
110
    - PYTHONUNBUFFERED=1 su pmos -c ".gitlab-ci/build_changed_aports.py"