Unverified Commit 0df50df7 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

centralize jobs

parent 09306957
Loading
Loading
Loading
Loading
Loading
+47 −3
Original line number Diff line number Diff line
stages:
  - build
  - release
  - website

variables:
  REGISTRY: $CI_REGISTRY
@@ -58,10 +59,53 @@ build:all:
publish:pypi:
  stage: release
  image: python:3.13-slim
  before_script:
    - pip install --no-cache-dir uv
  tags:
    - docker-network-mode-host
  variables:
    TWINE_USERNAME: gitlab-ci-token
    TWINE_PASSWORD: $CI_JOB_TOKEN
  script:
    - pip install --no-cache-dir uv
    - uv build
    - uv publish --token $TWINE_PASSWORD
    - uv publish --publish-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
  rules:
    - if: '$CI_COMMIT_TAG'   # only run when a tag is pushed


# --------------------
# Generate and publish new version of the SAREF website
# --------------------
website:build:
  stage: website
  image: labs.etsi.org:5050/saref/saref-pypeline:website
  tags:
    - docker-network-mode-host
  script:
    - mkdir -p saref4city
    - saref-dev website -VV saref4city
  artifacts:
    when: always
    paths:
      - saref4city/target/output.log
      - saref4city/target/site
  cache:
    key: target-cache
    paths:
      - saref4city/target/dataset/
      - saref4city/target/sources/
  environment:
    name: production
    url: https://saref.etsi.org/
  when: manual
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

website:publish:
  stage: website
  tags:
    - docker-build
  needs:
    - job: website:build
      artifacts: true
  script:
    - mv saref4city/target/site ~/site

.saref-ci.yml

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

test:check:
  stage: test
  image: labs.etsi.org:5050/saref/saref-pypeline:check
  tags:
    - docker-network-mode-host
  script:
    - saref-dev check -VV . 
    - |
      if grep -q "^* ERROR" target/output.log; then
        echo -e "❌ Build failed: found error(s) in output.log: \n $(grep '^* ERROR' target/output.log)"
        exit 1
      else
        echo "✅ Build succeeded: no errors found"
      fi
  artifacts:
    when: always
    paths:
      - target/output.log
  cache:
    key: target-cache
    paths:
      - target/dataset/
      - target/sources/
+2 −3
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ def build_parser():
    )

    sources_arguments = argparse.ArgumentParser(add_help=False)
    sources_default = os.path.join("target", "sources")
    sources_arguments.add_argument(
        "--strict", action="store_true", help="Only consider release branches."
    )
@@ -65,9 +64,9 @@ def build_parser():
        "-s",
        "--sources",
        type=str,
        default=sources_default,
        default=None,
        metavar="DIR",
        help=f"""Path to the folder where projects are stored/cloned (default: {sources_default} relative to the project directory).""",
        help=f"""Path to the folder where projects are stored/cloned (default: target/sources relative to the project directory).""",
    )
    sources_arguments.add_argument(
        "-p",