Commit 245c6293 authored by Jan Kiene's avatar Jan Kiene
Browse files

add first version of ci config for validation

parent c02b97d3
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+38 −0
Original line number Diff line number Diff line
stages:
  - test

workflow:
  rules:
    # see https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
      when: never
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

variables:
  REPO_URL_FLOAT: "https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec"

check-merged-ci-config-is-valid:
  stage: test
  tags:
    ivas-linux
  variables:
    MERGED_YAML: "merged.yaml"
    REPO_URL: $REPO_URL_FLOAT
  script:
    - git clone -b main --single-branch $REPO_URL code
    - cd code
    - sed -i".bak" "s/\&IVAS_CODEC_CI_REF main/\&IVAS_CODEC_CI_REF ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}/" .gitlab-ci.yml
    - |
      jq --null-input --arg yaml "$(<.gitlab-ci.yml)" '.content=$yaml' \
      curl --url "https://forge.3gpp.org/rep/api/v4/projects/49/ci/lint?include_merged_yaml=true" \
           --header 'Content-Type: application/json' \
           --data @-
           --output $MERGED_YAML
    - |
      grep "\"valid\": true"
  artifacts:
    when: always
    access: all
    expire_in: "5 days"
    paths:
      - $MERGED_YAML