Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.46 KiB
Newer Older
# [1] GitLab page: https://docs.gitlab.com/ee/ci/yaml/#pages
# [2] CI stages: https://docs.gitlab.com/ee/ci/yaml/#stages
# [3] Tags: https://docs.gitlab.com/ee/ci/yaml/#tags
.run_tests_rules: &run_tests_rules
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# ===== CHECK FORMATTING =====
test_topfarm_pep8: # name the job what we like
  image: ghcr.io/prefix-dev/pixi:latest
  stage: # build, test, deploy defined by default [2]
    test
  script:
    - pixi run -e default pycodestyle --ignore=E501,W504 --exclude="*Colonel*" topfarm
  tags: # only runners with this tag can do the job [3]
    - linux
  <<: *run_tests_rules
# ===== TEST TOPFARM =====
test_topfarm:
  image: ghcr.io/prefix-dev/pixi:latest
  stage: # build, test, deploy defined by default [2]
    - pixi run test-all
  tags: # only runners with this tag can do the job [3]
    - linux
  <<: *run_tests_rules
# ===== TEST TOPFARM ON WINDOWS =====
test_topfarm_windows: # name the job what we like
Mads M. Pedersen's avatar
Mads M. Pedersen committed
  variables:
    GIT_SUBMODULE_STRATEGY: normal
    GIT_CLEAN_FLAGS: -ffdx -e .pixi/
  stage: # build, test, deploy defined by default [2]
Mads M. Pedersen's avatar
Mads M. Pedersen committed
    test
  coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
  script: # runs on windows machine due to tag below
    - setx PIXI_CACHE_DIR D:\.pixi_cache
    - $env:PIXI_CACHE_DIR = [System.Environment]::GetEnvironmentVariable("PIXI_CACHE_DIR","User") # update PIXI_CACHE_DIR in current shell
    - C:\Users\ernim\.pixi\bin\pixi.exe run pip install -e .
    - C:\Users\ernim\.pixi\bin\pixi.exe run test-all
  tags: # tag for shared runner on windows machine
    - ANMH_old
  <<: *run_tests_rules
Mads M. Pedersen's avatar
Mads M. Pedersen committed
trigger_hub_test:
  stage: test
  variables:
    TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
  trigger:
    project: TOPFARMPrivate/triggerhub/topfarmtriggers
    strategy: depend
  only:
    - master
# ===== TEST TOPFARM DEPLOY =====
test_topfarm_deploy:
  image: ghcr.io/prefix-dev/pixi:latest
  stage: # build, test, deploy defined by default [2]
Jennifer Rinker's avatar
Jennifer Rinker committed
    deploy
  script:
    - pixi run -e default hatch build
    - pixi run -e default hatch publish -r test -u $HATCH_INDEX_USER -a $HATCH_INDEX_AUTH
  tags: # only runners with this tag can do the job [3]
    - linux
  only:
    - master
Mikkel Friis-Møller's avatar
Mikkel Friis-Møller committed
# ===== BUILD WHEELS AND UPLOAD TO PYPI =====
pypi_deploy:
  image: ghcr.io/prefix-dev/pixi:latest
  stage: deploy
Mikkel Friis-Møller's avatar
Mikkel Friis-Møller committed
  script:
    - pixi run -e default hatch build
    - pixi run -e default hatch publish -u $TWINE_USERNAME -a $TWINE_PASSWORD
  tags:
    - linux
Mikkel Friis-Møller's avatar
Mikkel Friis-Møller committed

# ===== TEST BUILD DOCS =====
test_docs_build: # "pages" is a job specifically for GitLab pages [1]
  image: ghcr.io/prefix-dev/pixi:latest
  stage: # build, test, deploy defined by default [2]
    deploy
  script: # use sphinx to build docs
    - pixi run -e default "cd docs; make html"
  <<: *run_tests_rules
  tags: # only runners with this tag can do the job [3]
    - linux

# ===== BUILD DOCS AND PUSH TO PUBLIC WEBSITE =====
pages: # "pages" is a job specifically for GitLab pages [1]
  image: ghcr.io/prefix-dev/pixi:latest
  stage: # build, test, deploy defined by default [2]
    deploy
  script: # use sphinx to build docs, move to public page
    - pixi run -e default "cd docs; make html"
    - mv docs/build/html public/
  artifacts: # required for GitLab pages [1]
    paths:
      - public
  only:
    - master
    - /^test_doc.*/
  tags: # only runners with this tag can do the job [3]
    - linux