项目作者: timotheemoulin

项目描述 :
GitHub Continuous Integration
高级语言: CSS
项目地址: git://github.com/timotheemoulin/github-ci.git
创建时间: 2017-12-21T22:20:06Z
项目社区:https://github.com/timotheemoulin/github-ci

开源协议:Apache License 2.0

下载


Github-CI

Some methods to generate PDF from Markdown documentation.

Also a spell checker.

Aspell

Aspell is a spell checker that can be used to check your markdown files.

Use it to ensure that you don’t have misspelled words in your documentation.

You can also write in English in French files, but you can’t write in French in English files. Only one language per file in addition to English is authorized.

Configuration

First, add a .travis.yml file to your project and write the following content.

  1. # ruby is the language used to launch the instruction
  2. language: ruby
  3. # select the branches you want to check
  4. branches:
  5. only:
  6. - master
  7. # add cache to your bundler
  8. cache: bundler
  9. # add the aspell packages (one per language)
  10. addons:
  11. apt:
  12. packages:
  13. - aspell
  14. - aspell-en
  15. - aspell-fr
  16. # execute rake default task
  17. script:
  18. - bundle exec rake

Then, add the Rakefile.

  1. # Default task
  2. task :default => [:spell_check]
  3. # Spell check task
  4. task :spell_check do
  5. sh '.aspell/spell-check.sh'
  6. end

You also need a Gemfile to fetch the needed ruby gems.

  1. source "https://rubygems.org"
  2. group :test do
  3. gem 'rake'
  4. end

Add the .aspell/spell-check.sh script (you can get it here).

Finally, add the custom dictionaries in .aspell/aspell.{lang}.pws. You need at least one dictionary for English and one for all other language you specified in your .travis.yml file.

Dictionaries are structured like that :

  1. personal_ws-1.1 en 999 utf-8
  2. PHP
  3. Javascript
  4. Git

Where :

  • en stands for the language name (same as in the file name)
  • 999 stands for the number of words in the dictionary (use a big number here if you don’t want to change it every time)
  • utf-8 is the encoding used in your file (keep it to utf-8 if you need to use accents (like in French or German) or if your dictionary is used for multiple languages)

Global structure

  1. .
  2. |-- .aspell
  3. | |-- aspell.en.pws
  4. | |-- aspell.fr.pws
  5. | |-- spell-check.sh
  6. |-- Gemfile
  7. |-- Gemfile.lock
  8. |-- .gitignore
  9. |-- LICENSE
  10. |-- node_modules
  11. |-- Rakefile
  12. |-- README.fr.md
  13. |-- README.md
  14. --- .travis.yml

PhantomJS Markdown to PDF

What if I tell you that you can even provide an always up to date PDF version of your documentation? Sounds great right?

You can once again use Travis-CI to build and deploy your documentation right into your release files.

Configuration

Travis-CI can only attach files to a release, not every commit will trigger the PDF generation.

Add the following lines to your .travis file.

  1. sudo: required
  2. before_install:
  3. - sudo sh .phantom/install_phantomjs.sh
  4. script:
  5. - sudo sh .phantom/rasterize.sh README.md .phantom/build/README.pdf
  6. deploy:
  7. skip_cleanup: true
  8. provider: releases
  9. api_key:
  10. secure: xxx
  11. file: .phantom/build/README.pdf
  12. on:
  13. tags: true

This tells Travis-CI to execute your .phantom/install_phantomjs.sh script that installs PhantomJS before doing anything else.

Then on the script phase, execute the rasterize.sh script to generate the PDF version of your README.md file and store it somewhere (it doesn’t really matter where).

Once your build ends, the Travis-CI deploys your application to Github and adds the file to the downloadable files attached to your release.

Global structure

  1. .
  2. |-- Gemfile
  3. |-- Gemfile.lock
  4. |-- .gitignore
  5. |-- LICENSE
  6. |-- node_modules
  7. |-- .phantom
  8. | |-- build
  9. | | --- .gitkeep
  10. | |-- github.css
  11. | |-- install_phantomjs.sh
  12. | |-- rasterize.css
  13. | |-- rasterize.js
  14. | |-- rasterize.sh
  15. |-- Rakefile
  16. |-- README.fr.md
  17. |-- README.md
  18. |-- .travis.yml