musicxml2ly: Rewrite `<direction>` handling (12/12): Remove 'new' postfix
[lilypond/mirror.git] / .gitlab-ci.yml
blob9f3411a4b95616c1c5975176545f8c8bdadec96a
1 # This file is part of LilyPond, the GNU music typesetter.
3 # Copyright (C) 2020--2023  Jonas Hahnfeld <hahnjo@hahnjo.de>
5 # LilyPond is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # LilyPond is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 stages:
19   - build
20   - test
21   - documentation
22   - website
24 default:
25   image: registry.gitlab.com/lilypond/lilypond/ci/ubuntu-22.04:20240516
26   interruptible: true
28 # Conditionally include a file to add the tag 'lilypond' to all jobs so that
29 # they are assigned to our custom runners, but we can leave the shared runners
30 # enabled for external contributors forking the repository.
31 include:
32   - local: .gitlab-ci.lilypond.yml
33     rules:
34       - if: $CI_PROJECT_PATH == "lilypond/lilypond"
36 .if-default-branch: &if-default-branch
37   if: $CI_PROJECT_PATH == "lilypond/lilypond" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
39 .if-mr-to-default: &if-mr-to-default
40   if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
42 .if-stable-branch: &if-stable-branch
43   if: $CI_PROJECT_PATH == "lilypond/lilypond" && $CI_COMMIT_BRANCH =~ /stable\/.*/
45 .if-schedule-or-web: &if-schedule-or-web
46   if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"
48 # Source files are checked out freshly for each job. This leads to the situation
49 # that make considers the artifacts outdated and rebuilds LilyPond from scratch.
50 # .touch-build contains the command needed to touch the downloaded build files,
51 # grouped into a pre-collapsed custom section.
52 .touch-build: &touch-build
53   - echo -e "section_start:`date +%s`:touch_build[collapsed=true]\r\e[0KTouch build artifacts"
54   - make -C python --touch all
55   - make -C scripts --touch all
56   - make -C flower --touch all
57   - make -C lily --touch all
58   - make -C mf --touch all
59   - echo -e "section_end:`date +%s`:touch_build\r\e[0K"
61 variables:
62   CONFIGURE_FLAGS: "--ci"
63   # Always clone and build in the same directory to avoid problems with
64   # 'make test-baseline' and 'make check'.
65   GIT_CLONE_PATH: "/builds/lilypond/lilypond"
67 # An additional variable not set here but used below is $MAKE_FLAGS. This can
68 # be set per runner and allows to enable parallel builds. For example, set its
69 # value to "-j4 CPU_COUNT=4" in order to speed up the build.
71 build:
72   stage: build
73   rules:
74     - <<: *if-default-branch
75     - <<: *if-mr-to-default
76     - <<: *if-stable-branch
77     - <<: *if-schedule-or-web
78   script:
79     - mkdir build && cd build
80     - ../autogen.sh $CONFIGURE_FLAGS
81     - make $MAKE_FLAGS
82   artifacts:
83     untracked: true
84     exclude:
85       - "build/Documentation/out/**"
86       - "build/out/lybook-db/**"
87     expire_in: 1 week
89 build-clang:
90   stage: build
91   rules:
92     - <<: *if-default-branch
93       when: never
94     - <<: *if-mr-to-default
95     - <<: *if-stable-branch
96     - <<: *if-schedule-or-web
97   script:
98     - mkdir build && cd build
99     - ../autogen.sh $CONFIGURE_FLAGS CC=clang CXX=clang++
100     - make $MAKE_FLAGS
102 test:
103   stage: test
104   rules:
105     - <<: *if-default-branch
106       when: never
107     - <<: *if-stable-branch
108     - <<: *if-schedule-or-web
109   dependencies: [ "build" ]
110   script:
111     - cd build
112     - *touch-build
113     - make $MAKE_FLAGS test
114   artifacts:
115     when: always
116     expire_in: 1 week
117     paths:
118       - "**/*.fail.log"
120 test-baseline:
121   stage: test
122   rules:
123     - <<: *if-default-branch
124   dependencies: [ "build" ]
125   script:
126     # Needed to work around the fact that gitlab-runner changes the mode of link
127     # targets until a proper fix is merged and released:
128     # https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/3547
129     - git reset --hard
130     - cd build
131     - *touch-build
132     - make $MAKE_FLAGS test-baseline
133     - tar czf ../test-baseline.tar.gz input/regression/out-test-baseline input/regression/*/out-test-baseline out-baseline
134   artifacts:
135     when: always
136     expire_in: 1 week
137     paths:
138       - "test-baseline.tar.gz"
139       - "**/*.fail.log"
141 check:
142   stage: test
143   rules:
144     - <<: *if-mr-to-default
145   dependencies: [ "build" ]
146   script:
147     - cd build
148     - *touch-build
149     - ../scripts/auxiliar/download-test-baseline.sh
150     - make $MAKE_FLAGS check
151     - mv out/test-results/ ..
152     # $CI_PAGES_URL refers to the GitLab Pages of the repository, we want the
153     # "implicit" pages URL with a dash before the project name. Do not use
154     # $CI_PAGES_DOMAIN to construct it because that is only available if GitLab
155     # Pages are enabled for the repository (which may be a user's fork).
156     - echo "Results can be viewed at https://$CI_PROJECT_ROOT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/test-results/index.html"
157   artifacts:
158     name: "test-results"
159     when: always
160     expire_in: 1 week
161     paths:
162       - "test-results/**"
163       - "**/*.fail.log"
165 doc:
166   stage: documentation
167   rules:
168     - <<: *if-default-branch
169       when: never
170     - <<: *if-mr-to-default
171     - <<: *if-stable-branch
172     - <<: *if-schedule-or-web
173   dependencies: [ "build" ]
174   script:
175     - cd build
176     - *touch-build
177     - make $MAKE_FLAGS doc
178   artifacts:
179     name: "logs"
180     when: on_failure
181     expire_in: 1 week
182     paths:
183       - "**/*.fail.log"
185 website:
186   stage: website
187   rules:
188     - <<: *if-default-branch
189       when: manual
190       allow_failure: true
191   dependencies: [ "build" ]
192   script:
193     - cd build
194     - *touch-build
195     - make $MAKE_FLAGS website
196   artifacts:
197     name: "website"
198     when: always
199     expire_in: 1 week
200     paths:
201       - "build/out/website-root/**"