From 13f00ddc07756a8c0668a0aadc14f5618e6f7817 Mon Sep 17 00:00:00 2001 From: unabris Date: Fri, 20 Jul 2018 22:10:20 +0200 Subject: [PATCH 1/5] Exclude vendor directory --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index e1adb78d55..67b15243f8 100644 --- a/_config.yml +++ b/_config.yml @@ -51,6 +51,7 @@ exclude: - run_tests.sh - config/ - log/ + - vendor feed: path: /blog/feed.xml From 8785cd7008a034ad5abbb580e4f9c8317ee1da79 Mon Sep 17 00:00:00 2001 From: unabris Date: Fri, 20 Jul 2018 22:21:31 +0200 Subject: [PATCH 2/5] Create test_ci task to avoid double build --- Rakefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 00d09e6271..9f5ff2eb7d 100644 --- a/Rakefile +++ b/Rakefile @@ -286,12 +286,16 @@ task :test_html do check_html: true, allow_hash_href: true } - sh 'bundle exec jekyll build' - HTMLProofer.check_directory('./_site', options).run end task :test do + sh 'bundle exec jekyll build' + + sh 'rake test_ci' +end + +task :test_ci do sh 'rake test_html' sh 'rake test_files' sh 'rake test_posts' From f04cbb3ec5cd03856119c5d0f62698091c280b18 Mon Sep 17 00:00:00 2001 From: unabris Date: Fri, 20 Jul 2018 22:22:03 +0200 Subject: [PATCH 3/5] Add circleci configuration --- .circleci/config.yml | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..ceaa741e54 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,85 @@ +defaults: &defaults + working_directory: ~/repo + +version: 2 + +jobs: + build_test: + <<: *defaults + docker: + - image: circleci/ruby:2.4.2 + environment: + BUNDLE_PATH: ~/repo/vendor/bundle + steps: + - checkout + - restore_cache: + keys: + - rubygems-v1-{{ checksum "Gemfile.lock" }} + - rubygems-v1-fallback + - run: + name: Bundle Install + command: bundle install + - run: + name: Jekyll build + command: bundle exec jekyll build + - run: + name: Test + command: bundle exec rake test_ci + - save_cache: + key: rubygems-v1-{{ checksum "Gemfile.lock" }} + paths: + - vendor/bundle + - persist_to_workspace: + root: ./ + paths: + - ./_site + + deploy_production: + <<: *defaults + docker: + - image: circleci/python:3.6.3 + environment: + S3_BUCKET_NAME: developer.epages.com + steps: + - attach_workspace: + at: ./ + - run: + name: Install AWS CLI + command: pip install awscli --upgrade --user + - run: + name: Upload to S3 + command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --delete --acl public-read + + deploy_staging: + <<: *defaults + docker: + - image: circleci/python:3.6.3 + environment: + S3_BUCKET_NAME: staging.developer.epages.com + steps: + - attach_workspace: + at: ./ + - run: + name: Install AWS CLI + command: pip install awscli --upgrade --user + - run: + name: Upload to S3 + command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --size-only --acl public-read + +workflows: + version: 2 + build_test_deploy: + jobs: + - build_test + - deploy_production: + requires: + - build_test + filters: + branches: + only: master + - deploy_staging: + requires: + - build_test + filters: + branches: + only: develop From 16e6c1fe2a35f0c4760f3553fefb243e78c5819d Mon Sep 17 00:00:00 2001 From: unabris Date: Mon, 20 Aug 2018 08:46:37 +0200 Subject: [PATCH 4/5] Exclude license --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index 67b15243f8..ddcb6548c4 100644 --- a/_config.yml +++ b/_config.yml @@ -52,6 +52,7 @@ exclude: - config/ - log/ - vendor + - LICENSE-CC-BY-40.txt feed: path: /blog/feed.xml From b18b8a188a6e1b787ec9817d1d373f8278aa8b00 Mon Sep 17 00:00:00 2001 From: unabris Date: Mon, 20 Aug 2018 08:46:42 +0200 Subject: [PATCH 5/5] Update circleci configuration --- .circleci/config.yml | 53 ++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ceaa741e54..2b4ec0e783 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,35 @@ defaults: &defaults working_directory: ~/repo +deploy: &deploy + docker: + - image: circleci/python:3.6.3 + steps: + - attach_workspace: + at: ./ + - run: + name: Install AWS CLI + command: pip install awscli --upgrade --user + - run: + name: Download epages-docs + command: | + ~/.local/bin/aws s3 sync s3://$S3_BUCKET_NAME ./_site --exclude "about/*" \ + --exclude "api/*" \ + --exclude "beyond-essence/*" \ + --exclude "blog/*" \ + --exclude "devjobs/*" \ + --exclude "api/*" \ + --exclude "assets/css/*" \ + --exclude "assets/fonts/*" \ + --exclude "assets/img/*" \ + --exclude "assets/js/*" \ + --exclude "assets/slick/*" \ + --exclude "404.html" \ + --exclude "index.html" + - run: + name: Upload to S3 + command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --size-only --delete --acl public-read + version: 2 jobs: @@ -36,35 +65,15 @@ jobs: deploy_production: <<: *defaults - docker: - - image: circleci/python:3.6.3 environment: S3_BUCKET_NAME: developer.epages.com - steps: - - attach_workspace: - at: ./ - - run: - name: Install AWS CLI - command: pip install awscli --upgrade --user - - run: - name: Upload to S3 - command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --delete --acl public-read + <<: *deploy deploy_staging: <<: *defaults - docker: - - image: circleci/python:3.6.3 environment: S3_BUCKET_NAME: staging.developer.epages.com - steps: - - attach_workspace: - at: ./ - - run: - name: Install AWS CLI - command: pip install awscli --upgrade --user - - run: - name: Upload to S3 - command: ~/.local/bin/aws s3 sync ./_site s3://$S3_BUCKET_NAME/ --size-only --acl public-read + <<: *deploy workflows: version: 2