From bc8752b2d54dc4df8d74a17c0d68906c91716191 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 29 Dec 2020 20:36:05 +0300 Subject: [PATCH 1/3] Switch from Arch Linux to Alpine for Cirrus CI Training before Docker images. --- .cirrus.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.cirrus.yaml b/.cirrus.yaml index decb032..4f3a143 100644 --- a/.cirrus.yaml +++ b/.cirrus.yaml @@ -1,9 +1,8 @@ os_setup: &os_setup container: - image: archlinux + image: alpine:3 os_setup_script: - - pacman -Sy - - pacman -S --noconfirm git gcc make postgresql-libs + # - apk add --no-cache git gcc make postgresql-libs - echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc - echo 'eval "$(rbenv init -)"' >> ~/.bashrc From 5cbbb571be8af7145223555995aeefa0bf7f1f14 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 29 Dec 2020 20:50:04 +0300 Subject: [PATCH 2/3] Add CI image as CI cache key Sadly, there is no such pre-defined environment variable. --- .cirrus.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.cirrus.yaml b/.cirrus.yaml index 4f3a143..1197f21 100644 --- a/.cirrus.yaml +++ b/.cirrus.yaml @@ -1,6 +1,8 @@ os_setup: &os_setup + env: + CI_IMAGE: alpine:3 container: - image: alpine:3 + image: $CI_IMAGE os_setup_script: # - apk add --no-cache git gcc make postgresql-libs @@ -15,6 +17,7 @@ rbenv_cache: &rbenv_cache folder: $HOME/.rbenv fingerprint_script: - echo $CIRRUS_OS + - echo $CI_IMAGE - cat .ruby-version populate_script: - git clone https://github.com/rbenv/rbenv.git ~/.rbenv @@ -32,6 +35,7 @@ nodenv_cache: &nodenv_cache folder: $HOME/.nodenv fingerprint_script: - echo $CIRRUS_OS + - echo $CI_IMAGE - cat .node-version populate_script: - git clone https://github.com/nodenv/nodenv.git ~/.nodenv @@ -49,6 +53,7 @@ bundle_cache: &bundle_cache folder: /usr/local/bundle fingerprint_script: - echo $CIRRUS_OS + - echo $CI_IMAGE - cat .ruby-version - cat Gemfile.lock install_script: @@ -60,6 +65,7 @@ node_modules_cache: &node_modules_cache folder: node_modules fingerprint_script: - echo $CIRRUS_OS + - echo $CI_IMAGE - cat .node-version - cat pnpm-lock.yaml install_script: From 3547a4f194a861c3b30a5d58d49adb000dc7e8cd Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 29 Dec 2020 22:37:26 +0300 Subject: [PATCH 3/3] Fix some issues with Alpine Linux, but still doesn't work --- .cirrus.yaml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.cirrus.yaml b/.cirrus.yaml index 1197f21..5f1342e 100644 --- a/.cirrus.yaml +++ b/.cirrus.yaml @@ -4,13 +4,14 @@ os_setup: &os_setup container: image: $CI_IMAGE os_setup_script: - # - apk add --no-cache git gcc make postgresql-libs + ## `bash` is required by `nodenv`, as I see + - apk add --no-cache bash git # gcc make postgresql-libs - - echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc - - echo 'eval "$(rbenv init -)"' >> ~/.bashrc + - echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.rbenv_init + - echo 'eval "$(rbenv init -)"' >> ~/.rbenv_init - - echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.bashrc - - echo 'eval "$(nodenv init -)"' >> ~/.bashrc + - echo 'export PATH="$HOME/.nodenv/bin:$PATH"' >> ~/.nodenv_init + - echo 'eval "$(nodenv init -)"' >> ~/.nodenv_init rbenv_cache: &rbenv_cache rbenv_cache: @@ -22,7 +23,7 @@ rbenv_cache: &rbenv_cache populate_script: - git clone https://github.com/rbenv/rbenv.git ~/.rbenv - - source ~/.bashrc + - . ~/.rbenv_init ## https://github.com/rbenv/ruby-build#installation - mkdir -p "$(rbenv root)"/plugins @@ -40,7 +41,7 @@ nodenv_cache: &nodenv_cache populate_script: - git clone https://github.com/nodenv/nodenv.git ~/.nodenv - - source ~/.bashrc + - . ~/.nodenv_init ## https://github.com/nodenv/node-build#installation - mkdir -p "$(nodenv root)"/plugins @@ -57,7 +58,7 @@ bundle_cache: &bundle_cache - cat .ruby-version - cat Gemfile.lock install_script: - - source ~/.bashrc + - . ~/.rbenv_init - exe/setup/ruby.sh node_modules_cache: &node_modules_cache @@ -69,7 +70,7 @@ node_modules_cache: &node_modules_cache - cat .node-version - cat pnpm-lock.yaml install_script: - - source ~/.bashrc + - . ~/.nodenv_init - exe/setup/node.sh @@ -82,7 +83,7 @@ remark_task: <<: *node_modules_cache lint_script: - - source ~/.bashrc + - . ~/.nodenv_init - pnpm run lint:docs only_if: ($CIRRUS_BRANCH == 'master') || @@ -100,7 +101,7 @@ stylelint_task: <<: *node_modules_cache lint_script: - - source ~/.bashrc + - . ~/.nodenv_init - pnpm run lint:styles only_if: ($CIRRUS_BRANCH == 'master') || @@ -118,7 +119,7 @@ eslint_task: <<: *node_modules_cache lint_script: - - source ~/.bashrc + - . ~/.nodenv_init - pnpm run lint:scripts only_if: ($CIRRUS_BRANCH == 'master') || @@ -141,7 +142,7 @@ rubocop_task: <<: *bundle_cache lint_script: - - source ~/.bashrc + - . ~/.rbenv_init - bundle exec rubocop --format=json --out=rubocop.json only_if: ($CIRRUS_BRANCH == 'master') ||