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 0afbcf2
Showing 1 changed file with 78 additions and 14 deletions.
92 changes: 78 additions & 14 deletions .cirrus.yaml
@@ -1,3 +1,43 @@
os_setup: &os_setup
container:
image: debian
os_setup_script:
- apt update && apt upgrade -y && apt install git make gcc -y

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

## https://cirrus-ci.com/task/6270527041961984?command=os_setup#L543
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
## https://cirrus-ci.com/task/5656294977699840?command=os_setup#L633
- echo 'eval "$(rbenv init -)"' >> ~/.bashrc

- 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

## https://cirrus-ci.com/task/6270527041961984?command=os_setup#L543
- echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc
## https://cirrus-ci.com/task/5656294977699840?command=os_setup#L633
- echo 'eval "$(nodenv init -)"' >> ~/.bashrc

- 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
Expand All @@ -18,24 +58,37 @@ node_modules_cache: &node_modules_cache
- 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:
- cat ~/.bashrc
- 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:
- cat ~/.bashrc
- source ~/.bashrc
- npm run lint:styles

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

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

always:
<<: *nodenv_cache

<<: *node_modules_cache

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

only_if: ($CIRRUS_BRANCH == 'master') ||
changesInclude(
Expand All @@ -57,18 +116,23 @@ 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:
- cat ~/.bashrc
- 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 0afbcf2

Please sign in to comment.