diff --git a/.cirrus.yaml b/.cirrus.yaml index 569c31f..b12e274 100644 --- a/.cirrus.yaml +++ b/.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 @@ -13,17 +50,24 @@ 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( @@ -31,11 +75,16 @@ remark_task: ) 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( @@ -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( @@ -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'