Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.01 KiB
Newer Older
Cédric Krier's avatar
Cédric Krier committed
stages:
  - build
  - test
  - publish

.series:
  parallel:
    matrix:
Cédric Krier's avatar
Cédric Krier committed
      - SERIES: ["5.0", "6.0", "6.6", "6.8"]
Cédric Krier's avatar
Cédric Krier committed

build:
  stage: build
  extends: .series
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - /kaniko/executor
      --context "${CI_PROJECT_DIR}/${SERIES}"
      --dockerfile "${CI_PROJECT_DIR}/${SERIES}/Dockerfile"
      --destination "${CI_REGISTRY_IMAGE}/tryton:${SERIES}-${CI_COMMIT_SHA}"
      --tar-path image-${SERIES}.tar
  artifacts:
    paths:
      - image-{$SERIES}.tar

build-office:
  stage: build
  extends: build
  needs:
    - build
  script:
    - /kaniko/executor
      --build-arg REGISTRY_IMAGE="${CI_REGISTRY_IMAGE}"
      --build-arg TAG_SUFFIX="-${CI_COMMIT_SHA}"
      --context "${CI_PROJECT_DIR}/${SERIES}"
      --dockerfile "${CI_PROJECT_DIR}/${SERIES}/office/Dockerfile"
      --destination "${CI_REGISTRY_IMAGE}/tryton:${SERIES}-office-${CI_COMMIT_SHA}"
      --tar-path image-${SERIES}-office.tar
  artifacts:
    paths:
      - image-{$SERIES}-office.tar

test:
  stage: test
  extends: .series
  needs:
    - build
  image: ${CI_REGISTRY_IMAGE}/tryton:${SERIES}-${CI_COMMIT_SHA}
  variables:
    DB_CACHE: /tmp
    TRYTOND_DATABASE_URI: sqlite://
  script:
    - python3 -m unittest discover -vv -f -s trytond.tests
    - python3 -m unittest discover -vv -f -s trytond.modules -p test_module.py
  parallel:
    matrix:
Cédric Krier's avatar
Cédric Krier committed
      - SERIES: ["6.6", "6.8"]
Cédric Krier's avatar
Cédric Krier committed

test-run:
  extends: test
  script:
    - python3 -m trytond.tests.run-tests -vv -f -m --no-doctest
  parallel:
    matrix:
      - SERIES: ["5.0", "6.0"]

test-office:
  extends: test
  needs:
    - build-office
  image: ${CI_REGISTRY_IMAGE}/tryton:${SERIES}-office-${CI_COMMIT_SHA}

test-office-run:
  extends: test-run
  needs:
    - build-office
  image: ${CI_REGISTRY_IMAGE}/tryton:${SERIES}-office-${CI_COMMIT_SHA}

publish:
  stage: publish
  extends: .series
  needs:
    - build
    - test
    - test-run
  image:
    name: gcr.io/go-containerregistry/crane:debug
    entrypoint: [""]
  script:
    - crane auth login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_SERVER}
    - crane push image-${SERIES}.tar tryton/tryton:${SERIES}
  rules:
    - if: $CI_COMMIT_BRANCH =~ /^branch\/.*/

publish-office:
  extends: publish
  needs:
    - build-office
    - test-office
    - test-office-run
  script:
    - crane auth login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_SERVER}
    - crane push image-${SERIES}-office.tar tryton/tryton:${SERIES}-office

publish-latest:
  extends: publish
  needs:
    - build
Cédric Krier's avatar
Cédric Krier committed
    - publish
  script:
    - crane auth login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_SERVER}
    - crane push image-${SERIES}.tar tryton/tryton:latest
  parallel:
    matrix:
Cédric Krier's avatar
Cédric Krier committed
      - SERIES: "6.8"
Cédric Krier's avatar
Cédric Krier committed

publish-office-latest:
  extends: publish-latest
  needs:
    - build-office
Cédric Krier's avatar
Cédric Krier committed
    - publish-office
  script:
    - crane auth login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_SERVER}
    - crane push image-${SERIES}-office.tar tryton/tryton:office
  parallel:
    matrix:
Cédric Krier's avatar
Cédric Krier committed
      - SERIES: "6.8"