Simon Jakobi pushed to branch wip/sjakobi/T27521 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -134,6 +134,9 @@ workflow:
    134 134
       stage: tool-lint
    
    135 135
       tags:
    
    136 136
         - lint
    
    137
    +  before_script:
    
    138
    +    # The checkout may be owned by the runner rather than the container user.
    
    139
    +    - git config --global --add safe.directory "$CI_PROJECT_DIR"
    
    137 140
       rules:
    
    138 141
         - *drafts-can-fail-lint
    
    139 142
         - when: always
    
    ... ... @@ -251,18 +254,21 @@ ghc-linters:
    251 254
     lint-changelog:
    
    252 255
       stage: tool-lint
    
    253 256
       image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV"
    
    254
    -  extends: .lint-params
    
    257
    +  extends: .lint
    
    255 258
       variables:
    
    256
    -    BUILD_FLAVOUR: default
    
    257 259
         CHANGELOG_EXPECT_MR: "$CI_MERGE_REQUEST_IID"
    
    260
    +    GIT_DEPTH: 1
    
    261
    +    GIT_SUBMODULE_STRATEGY: none
    
    262
    +  before_script:
    
    263
    +    - export PATH="/opt/toolchain/bin:$PATH"
    
    264
    +    - git config --global --add safe.directory "$CI_PROJECT_DIR"
    
    258 265
       script:
    
    259 266
         # Cancel the job if there is a no-changelog label
    
    260 267
         - |
    
    261 268
           [[ ",${CI_MERGE_REQUEST_LABELS}," == *",no-changelog,"* ]] && exit 0
    
    262 269
         # Check that the MR adds at least one changelog entry
    
    263
    -    - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
    
    264
    -    - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
    
    265
    -    - added=$(git diff --name-only --diff-filter=A "$base..$CI_COMMIT_SHA" -- 'changelog.d/' | grep -v '^changelog.d/config$' || true)
    
    270
    +    - git fetch --depth=1 "$CI_MERGE_REQUEST_PROJECT_URL" "$CI_MERGE_REQUEST_DIFF_BASE_SHA"
    
    271
    +    - added=$(git diff --name-only --diff-filter=A "$CI_MERGE_REQUEST_DIFF_BASE_SHA..$CI_COMMIT_SHA" -- 'changelog.d/' | grep -v '^changelog.d/config$' || true)
    
    266 272
         - |
    
    267 273
           if [ -z "$added" ]; then
    
    268 274
             echo "ERROR: No changelog entry found in changelog.d/"
    
    ... ... @@ -271,9 +277,23 @@ lint-changelog:
    271 277
             exit 1
    
    272 278
           fi
    
    273 279
         - echo "Found changelog entries:" $added
    
    274
    -    # Build changelog-d and validate all entries (checks required fields, section names, MR number)
    
    275
    -    - .gitlab/ci.sh configure
    
    276
    -    - .gitlab/ci.sh run_hadrian test --test-root-dirs="testsuite/tests/linters" --only=changelog-d
    
    280
    +    # Build changelog-d with the bootstrap compiler and validate all entries
    
    281
    +    # (checks required fields, section names, and the MR number).
    
    282
    +    - |
    
    283
    +      changelog_build_dir="$(mktemp -d)"
    
    284
    +      ghc -Werror \
    
    285
    +        -package base \
    
    286
    +        -package bytestring \
    
    287
    +        -package Cabal-syntax \
    
    288
    +        -package containers \
    
    289
    +        -package directory \
    
    290
    +        -package filepath \
    
    291
    +        -package pretty \
    
    292
    +        -outputdir "$changelog_build_dir" \
    
    293
    +        -o "$changelog_build_dir/changelog-d" \
    
    294
    +        utils/changelog-d/ChangelogD.hs
    
    295
    +      "$changelog_build_dir/changelog-d" \
    
    296
    +        changelog.d/ --validate --expect-mr "$CHANGELOG_EXPECT_MR"
    
    277 297
       dependencies: []
    
    278 298
       rules:
    
    279 299
         - if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
    
    ... ... @@ -285,6 +305,9 @@ lint-changelog:
    285 305
     lint-linters:
    
    286 306
       image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
    
    287 307
       extends: .lint
    
    308
    +  variables:
    
    309
    +    GIT_DEPTH: 1
    
    310
    +    GIT_SUBMODULE_STRATEGY: none
    
    288 311
       script:
    
    289 312
         - mypy testsuite/tests/linters/regex-linters/*.py
    
    290 313
       dependencies: []
    
    ... ... @@ -293,6 +316,9 @@ lint-linters:
    293 316
     lint-testsuite:
    
    294 317
       image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV"
    
    295 318
       extends: .lint
    
    319
    +  variables:
    
    320
    +    GIT_DEPTH: 1
    
    321
    +    GIT_SUBMODULE_STRATEGY: none
    
    296 322
       script:
    
    297 323
         - make -Ctestsuite list_broken TEST_HC=$GHC
    
    298 324
       dependencies: []
    
    ... ... @@ -301,6 +327,9 @@ lint-testsuite:
    301 327
     typecheck-testsuite:
    
    302 328
       image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
    
    303 329
       extends: .lint
    
    330
    +  variables:
    
    331
    +    GIT_DEPTH: 1
    
    332
    +    GIT_SUBMODULE_STRATEGY: none
    
    304 333
       script:
    
    305 334
         - mypy testsuite/driver/runtests.py
    
    306 335
       dependencies: []
    
    ... ... @@ -323,14 +352,13 @@ typecheck-testsuite:
    323 352
         - _build/stageBoot/bin/lint-submodule-refs . $(git rev-list $base..$CI_COMMIT_SHA)
    
    324 353
       dependencies: []
    
    325 354
     
    
    326
    -# We allow the submodule checker to fail when run on merge requests (to
    
    327
    -# accommodate, e.g., haddock changes not yet upstream) but not on `master` or
    
    328
    -# Marge jobs.
    
    355
    +# Check that commits in an MR were not authored with the identity that CI uses
    
    356
    +# when it needs to create commits itself. This only needs Git history.
    
    329 357
     lint-author:
    
    330 358
       image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb13:$DOCKER_REV"
    
    331
    -  extends: .lint-params
    
    359
    +  extends: .lint
    
    332 360
       variables:
    
    333
    -    BUILD_FLAVOUR: default
    
    361
    +    GIT_SUBMODULE_STRATEGY: none
    
    334 362
       script:
    
    335 363
         - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    
    336 364
         - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"