Skip to content

Commit

Permalink
Add doc publishing to ci (#158)
Browse files Browse the repository at this point in the history
* Add doc publishing to ci

* Enable github doc publishing in ci

* Add vendor to gitignore directory

* Update publish doc

* Update doc publish job on ci

* Run doc publishing on main branch only

* Add convenience job for setting github branch protection rules
  • Loading branch information
rossta authored Aug 27, 2023
1 parent 1dad90f commit 703f0ed
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
70 changes: 66 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ version: 2.1
orbs:
ruby: circleci/[email protected]

executors:
app-ruby:
docker:
- image: cimg/ruby:2.7

commands:
run-tests:
Expand All @@ -14,33 +18,83 @@ commands:
steps:
- run: bundle exec rake standard

run-docs-build:
description: Generate docs
steps:
- run: bundle exec rake doc:build

run-docs-publish:
description: Update gh-pages
steps:
- run: |
git checkout gh-pages
cp -R doc/* .
git commit -vam 'Update documentation'
git push origin gh-pages
jobs:
test:
executor: app-ruby
parameters:
ruby_version:
type: string
gemfile:
type: string
docker:
- image: 'cimg/ruby:<< parameters.ruby_version >>'
steps:
- checkout
- ruby/install-deps:
gemfile: <<parameters.gemfile>>
- run-tests

# Convenience job for setting github branch protection rules
test-matrix:
executor: app-ruby
steps:
- checkout
- run: echo "Done"

lint:
docker:
- image: cimg/ruby:2.7
executor: app-ruby
steps:
- checkout
- ruby/install-deps
- run-lint

build-docs:
executor: app-ruby
steps:
- checkout
- ruby/install-deps
- run-docs-build
- persist_to_workspace:
root: .
paths: doc

publish-docs:
executor: app-ruby
steps:
- checkout
- ruby/install-deps
- attach_workspace:
at: .
- add_ssh_keys:
fingerprints: # ssh key generated solely for montrose docs
- "97:43:0c:36:36:1d:83:30:f0:76:d4:9f:d3:71:a8:a5"
- run:
name: Configure git
command: |
git config user.email "[email protected]"
git config user.name "ci-build"
- run-docs-publish

workflows:
all-tests:
jobs:
- lint
- build-docs
- test-matrix:
requires:
- test
- test:
matrix:
parameters:
Expand All @@ -55,3 +109,11 @@ workflows:
exclude:
- ruby_version: '2.6'
gemfile: gemfiles/activesupport_7.0.gemfile
- publish-docs:
requires:
- lint
- build-docs
- test-matrix
filters:
branches:
only: main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/profile.log
/trace.txt
/.ruby-gemset
/vendor/
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ task test: :spec
task default: %i[spec standard]

namespace :doc do
desc "Build docs"
task :build do
sh "bundle exec yard doc"
end

desc "Generate docs and publish to gh-pages"
task :publish do
puts "Generating docs"
Expand Down

0 comments on commit 703f0ed

Please sign in to comment.