Skip to content

Commit

Permalink
Use correct versions of Ruby and Node.js in CI
Browse files Browse the repository at this point in the history
Take example from [Flame CLI](AlexWayfer/flame-cli#57).
  • Loading branch information
AlexWayfer committed Dec 2, 2020
1 parent 569bbcf commit c48c5b8
Showing 1 changed file with 72 additions and 14 deletions.
86 changes: 72 additions & 14 deletions .cirrus.yaml
@@ -1,7 +1,44 @@
os_setup: &os_setup
container:
image: debian
os_setup_script:
- apt update && apt upgrade -y && apt install git make gcc -y

- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
- echo 'eval "$(rbenv init -)"' >> ~/.bashrc

- echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
- echo 'eval "$(nodenv init -)"' >> ~/.bashrc

rbenv_cache: &rbenv_cache
rbenv_cache:
folder: $HOME/.rbenv
populate_script:
- git clone https://github.com/rbenv/rbenv.git ~/.rbenv

- source ~/.bashrc

## https://github.com/rbenv/ruby-build#installation
- mkdir -p "$(rbenv root)"/plugins
- git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

nodenv_cache: &nodenv_cache
nodenv_cache:
folder: $HOME/.nodenv
populate_script:
- git clone https://github.com/nodenv/nodenv.git ~/.nodenv

- source ~/.bashrc

## https://github.com/nodenv/node-build#installation
- mkdir -p "$(nodenv root)"/plugins
- git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build

bundle_cache: &bundle_cache
bundle_cache:
folder: /usr/local/bundle
fingerprint_script:
- source ~/.bashrc
- echo $CIRRUS_OS
- ruby -v
- cat Gemfile.lock
Expand All @@ -13,29 +50,41 @@ node_modules_cache: &node_modules_cache
node_modules_cache:
folder: node_modules
fingerprint_script:
- source ~/.bashrc
- echo $CIRRUS_OS
- node -v
- cat package.json
install_script: npm install


remark_task:
container:
image: node
<<: *os_setup

always:
<<: *nodenv_cache

<<: *node_modules_cache

lint_script: npm run lint:markdown
lint_script:
- source ~/.bashrc
- npm run lint:markdown

only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'package.json', 'package-lock.json', '.remarkrc.yaml', '**.md'
)

stylelint_task:
container:
image: node
<<: *os_setup

always:
<<: *nodenv_cache

<<: *node_modules_cache

lint_script: npm run lint:styles
lint_script:
- source ~/.bashrc
- npm run lint:styles

only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
Expand All @@ -44,11 +93,16 @@ stylelint_task:
)

eslint_task:
container:
image: node
<<: *os_setup

always:
<<: *nodenv_cache

<<: *node_modules_cache

lint_script: npm run lint:scripts
lint_script:
- source ~/.bashrc
- npm run lint:scripts

only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
Expand All @@ -57,18 +111,22 @@ eslint_task:
)

rubocop_task:
container:
image: ruby:latest
<<: *bundle_cache

lint_script: bundle exec rubocop --format=json --out=rubocop.json
<<: *os_setup

always:
<<: *rbenv_cache

rubocop_artifacts:
path: rubocop.json
type: text/json
format: rubocop

<<: *bundle_cache

lint_script:
- source ~/.bashrc
- bundle exec rubocop --format=json --out=rubocop.json

only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
'.cirrus.yaml', '.gitignore', 'Gemfile', 'Gemfile.lock', '.rubocop.yml', '**.rb'
Expand Down

0 comments on commit c48c5b8

Please sign in to comment.