-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
80 lines (73 loc) · 2.36 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
image: ${ARTIFACTORY_URL}/docker-official-mirror/python:3.11
stages:
- build
- test
- deploy
- validate
variables:
R_PROFILE: "$R_HOME/etc/Rprofile.site"
Build Package:
stage: build
script:
- python -m pip install --upgrade pip
- pip install -r requirements.txt
- pip install .
Test and Lint:
stage: test
script:
# Install dependencies
- apt-get update -y
- apt-get upgrade -y
- apt-get install -y xdg-utils
- apt-get install -y lynx
- apt-get install -y graphviz
- apt-get install -y pandoc
- python -m pip install --upgrade pip
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- pip install .
# Test and report coverage
- coverage run -m pytest
- coverage report -m
- coverage html
# Lint
- flake8 .
- pydocstringformatter .
# Run pydeps
- pydeps hyswap -T png --max-bacon=3 --cluster
- mv hyswap.png docs/source/reference/hyswap.png # move pydeps graph to docs
# Test and build documentation
- cd docs
- make docs
artifacts:
paths:
- htmlcov/
- docs/build/
coverage: '/TOTAL.*\s+(\d+\%)/'
Deploy Documentation:
image: ${ARTIFACTORY_URL}/docker-official-mirror/rocker/shiny-verse:4.1.2
stage: deploy
script:
# set Rprofile repositories
- echo "options(Ncpus=$(nproc --all), repos=c(GSPM='$GSPM', CRAN='$CRAN'))" >> $R_PROFILE
# install packages
- Rscript -e "install.packages(c('rsconnect', 'connectapi'))"
# create manifest file for deployment
- Rscript -e "rsconnect::writeManifest(appDir='$CI_PROJECT_DIR/docs/build')"
# deploy docs to RStudio Connect
- Rscript -e "task <- connectapi::deploy(connectapi::connect(), connectapi::bundle_dir('$CI_PROJECT_DIR/docs/build'), name='hyswap-docs') |> connectapi::set_vanity_url(url = 'hyswap-docs') |> connectapi::content_update_access_type('all')"
rules:
- if: '$CI_COMMIT_BRANCH == "main" && $CONNECT_API_KEY != null && $CONNECT_SERVER != null'
Validate Inventory:
stage: validate
image: ${INTERNAL_REGISTRY}software/software-management:latest
script:
- software-management review
--project "${CI_PROJECT_PATH}"
--ref "${CI_COMMIT_BRANCH}"
--type "provisional"
--token "${GITLAB_PAT}"
tags:
- chs-shared
rules:
- if: '$CI_COMMIT_BRANCH == "main" && $GITLAB_PAT != null'