• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1include:
2  - project: 'freedesktop/ci-templates'
3    ref: 3f37cc0e461f5b0c815409bf6f55759f26a74e9c
4    file:
5      - '/templates/ci-fairy.yml'
6      - '/templates/alpine.yml'
7
8# When updating the prepare-container step, make sure to bump
9# FDO_DISTRIBUTION_TAG, otherwise the container won't get rebuilt.
10# To force a rebuild of the container, use:
11# $ git push -f -o ci.variable="FDO_FORCE_REBUILD=1"
12variables:
13  FDO_UPSTREAM_REPO: 'emersion/libdisplay-info'
14  FDO_DISTRIBUTION_TAG: '2024-06-07.0'
15
16workflow:
17  rules:
18    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
19    - if: $CI_PIPELINE_SOURCE == 'push'
20
21stages:
22  - "Contribution checks"
23  - "Prepare container"
24  - "Build and test"
25  - "Publish"
26
27check-mr:
28  extends: .fdo.ci-fairy
29  stage: "Contribution checks"
30  script:
31   - ci-fairy check-commits --signed-off-by
32   - ci-fairy check-merge-request --require-allow-collaboration
33  rules:
34    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
35      when: always
36    - when: never
37
38prepare-container:
39  extends: .fdo.container-build@alpine@x86_64
40  stage: "Prepare container"
41  variables:
42    EDID_DECODE_COMMIT: c6b859d7f0251e2433fb81bd3f67bd2011c2036c
43    FDO_BASE_IMAGE: alpine:latest
44    FDO_DISTRIBUTION_PACKAGES: |
45      build-base clang compiler-rt meson make git gcovr py3-pygments go hwdata
46    FDO_DISTRIBUTION_EXEC: |
47      grep $EDID_DECODE_COMMIT ./subprojects/edid-decode.wrap >/dev/null || \
48        (echo "Keep edid-decode.wrap and CI in sync!" && exit 1)
49      git clone git://linuxtv.org/edid-decode.git
50      cd edid-decode
51      git checkout $EDID_DECODE_COMMIT
52      meson setup build/
53      ninja -C build/
54      ninja -C build/ install
55      cd ..
56      rm -rf edid-decode
57
58      go install git.sr.ht/~emersion/gyosu@latest
59      mv ~/go/bin/gyosu /usr/bin/
60      rm -rf ~/go
61  rules:
62    - when: on_success
63
64testing-check:
65  extends: .fdo.distribution-image@alpine
66  stage: "Build and test"
67  script:
68   - |
69     # Check if the origin of all test EDIDs is documented
70     for f in ./test/data/*.edid; do
71       grep -q "^$(basename ${f%.edid})\s" ./test/data/README.md ||
72         (echo "$f not in README.md" && exit 1)
73     done
74     # Check if the test references checked in the repo match what we have in CI
75     meson setup build/
76     ninja -C build/ gen-test-data
77     git diff --quiet ||
78       (echo "Checked in reference output does not match generated reference output" && exit 1)
79  rules:
80    - when: on_success
81
82build-gcc:
83  extends: .fdo.distribution-image@alpine
84  stage: "Build and test"
85  script:
86    - CC=gcc meson setup build/ --fatal-meson-warnings -Dwerror=true -Db_coverage=true
87    - ninja -C build/
88    - ninja -C build/ test
89    - ninja -C build/ -j1 coverage-xml coverage-html
90  artifacts:
91    when: always
92    paths:
93      - build/meson-logs/
94    reports:
95      junit: build/meson-logs/testlog.junit.xml
96      coverage_report:
97        coverage_format: cobertura
98        path: build/meson-logs/coverage.xml
99  rules:
100    - when: on_success
101
102build-clang:
103  extends: .fdo.distribution-image@alpine
104  stage: "Build and test"
105  script:
106    - CC=clang meson setup build/ --fatal-meson-warnings -Dwerror=true -Db_sanitize=address,undefined -Db_lundef=false
107    - ninja -C build/
108    - UBSAN_OPTIONS=halt_on_error=1 ninja -C build/ test
109  artifacts:
110    when: always
111    paths:
112      - build/meson-logs/
113    reports:
114      junit: build/meson-logs/testlog.junit.xml
115  rules:
116    - when: on_success
117
118build-docs:
119  extends: .fdo.distribution-image@alpine
120  stage: "Build and test"
121  script:
122    - gyosu -I$PWD/include/ -fexported-symbols='di_*'
123      -ffile-prefix-map=$PWD/include/= -fsite-name=libdisplay-info
124      -o public $PWD/include/libdisplay-info/
125  artifacts:
126    paths:
127      - public/
128  rules:
129    - when: on_success
130
131pages:
132  extends: .fdo.distribution-image@alpine
133  stage: "Publish"
134  script:
135    - "true"
136  artifacts:
137    paths:
138      - public/
139  rules:
140    - if: '$CI_PROJECT_PATH == "emersion/libdisplay-info" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
141      when: on_success
142    - when: never
143