diff --git a/.gitignore b/.gitignore index 83b02d3b1..e55e3d0ed 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,8 @@ public/* config/projects/simple.rb .markdownlintrc .DS_Store +.yardoc +yard # These are created during a package build. We do not want to commit them .yarn-cache diff --git a/.yardopts b/.yardopts new file mode 100644 index 000000000..ba3939cf9 --- /dev/null +++ b/.yardopts @@ -0,0 +1 @@ +yardoc -o yard --no-private --protected lib/**/*.rb files/gitlab-cookbooks/**/*.rb files/gitlab-ctl-commands/**/*.rb files/gitlab-ctl-commands-ee/**/*.rb - README.md CONTRIBUTING.md LICENSE CHANGELOG.md diff --git a/Gemfile b/Gemfile index fefb8a7e0..9aebe3467 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ gem 'http' gem 'aws-sdk-ec2' gem 'aws-sdk-marketplacecatalog' gem 'gitlab' +gem 'yard' group :packagecloud, optional: true do gem 'package_cloud' diff --git a/Gemfile.lock b/Gemfile.lock index 3b3fa6368..1b042d542 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -424,6 +424,7 @@ GEM winrm (~> 2.0) wisper (2.0.1) wmi-lite (1.0.5) + yard (0.9.26) zeitwerk (2.4.2) zhexdump (0.0.2) @@ -454,6 +455,7 @@ DEPENDENCIES rspec-parameterized rspec_junit_formatter thor (= 0.18.1) + yard BUNDLED WITH 2.2.15 diff --git a/gitlab-ci-config/gitlab-com.yml b/gitlab-ci-config/gitlab-com.yml index 8d9686e7d..3ebdaca8e 100644 --- a/gitlab-ci-config/gitlab-com.yml +++ b/gitlab-ci-config/gitlab-com.yml @@ -4,6 +4,16 @@ ############# # Templates # ############# +.com-docs-except-triggers: &com-docs-except-triggers + except: + refs: + - /./@gitlab/omnibus-gitlab + - triggers + - /^deps/ + - /./@gitlab-org/build/omnibus-gitlab-mirror + variables: + - $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING + - $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/ .com-except-triggers: &com-except-triggers except: @@ -250,15 +260,7 @@ docs-lint markdown: - vale --minAlertLevel error doc # Lint Markdown - markdownlint --config .markdownlint.yml 'doc/**/*.md' - except: - refs: - - /./@gitlab/omnibus-gitlab - - triggers - - /^deps/ - - /./@gitlab-org/build/omnibus-gitlab-mirror - variables: - - $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING - - $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/ + <<: *com-docs-except-triggers # Perform link checks on published HTML files docs-lint links: @@ -277,15 +279,26 @@ docs-lint links: - bundle exec nanoc check internal_links # Check the internal anchor links - bundle exec nanoc check internal_anchors - except: - refs: - - /./@gitlab/omnibus-gitlab - - triggers - - /^deps/ - - /./@gitlab-org/build/omnibus-gitlab-mirror - variables: - - $DEPS_PIPELINE || $CACHE_UPDATE || $DEPENDENCY_SCANNING - - $CI_COMMIT_REF_NAME =~ /^[0-9]+-[0-9]+-auto-deploy-[0-9]+$/ + <<: *com-docs-except-triggers + +yard: + extends: .gems-cache + image: "${RUBY_IMAGE}" + stage: check + needs: [] + before_script: + # These jobs will not be run on dev, so we set ALTERNATIVE_SOURCES to true + # so tests run fine on forks + - export ALTERNATIVE_SOURCES="true"; + - *install-gems + script: + - bundle exec yardoc + <<: *com-docs-except-triggers + artifacts: + expire_in: 1 week + paths: + - yard/* + # Trigger a docs build in gitlab-docs # Useful to preview the docs changes live @@ -604,12 +617,15 @@ validate_packer_changes: ############################## pages: - image: "${PUBLIC_BUILDER_IMAGE_REGISTRY}/ubuntu_16.04:${BUILDER_IMAGE_REVISION}" + image: "${PUBLIC_BUILDER_IMAGE_REGISTRY}/ubuntu_20.04:${BUILDER_IMAGE_REVISION}" stage: prepare + needs: + - yard script: - bundle exec rake license:generate_pages - mv ${LICENSE_S3_BUCKET} public - cp support/webpages/* public + - cp yard/* public artifacts: paths: - public