From c066999fa0dd64ad332716a346e6864fbab03fe8 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 17 Sep 2020 19:23:35 +0530 Subject: [PATCH] Add workflow to build and profile third-party repo (#8398) Merge pull request 8398 --- .github/workflows/actions/memprof.rb | 14 ++++++++ .github/workflows/third-party.yml | 48 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/actions/memprof.rb create mode 100644 .github/workflows/third-party.yml diff --git a/.github/workflows/actions/memprof.rb b/.github/workflows/actions/memprof.rb new file mode 100644 index 00000000..a713c679 --- /dev/null +++ b/.github/workflows/actions/memprof.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'jekyll' +require 'memory_profiler' + +MemoryProfiler.report(allow_files: 'lib/jekyll/') do + Jekyll::PluginManager.require_from_bundler + Jekyll::Commands::Build.process({ + "source" => File.expand_path(ARGV[0]), + "destination" => File.expand_path("#{ARGV[0]}/_site"), + "disable_disk_cache" => true, + }) + puts '' +end.pretty_print(scale_bytes: true, normalize_paths: true) diff --git a/.github/workflows/third-party.yml b/.github/workflows/third-party.yml new file mode 100644 index 00000000..137bc432 --- /dev/null +++ b/.github/workflows/third-party.yml @@ -0,0 +1,48 @@ +name: Third-Party Repository Profiling + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build_n_profile: + runs-on: 'ubuntu-latest' + steps: + - name: Checkout Jekyll + uses: actions/checkout@v2 + with: + fetch-depth: 5 + path: jekyll + - name: Checkout Third-Party Repository + uses: actions/checkout@v2 + with: + repository: ashmaroli/tomjoht.github.io + path: sandbox + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Set up Dependencies Cache + uses: actions/cache@v1 + with: + path: sandbox/vendor/bundle + key: ubuntu-latest-gems- + restore-keys: | + ubuntu-latest-gems- + - name: Set up Dependencies + run: | + gem update --system --no-document + gem update bundler --no-document + bundle config gemfile sandbox/Gemfile + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Run Jekyll Build 3 times + run: | + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + bundle exec jekyll build -s sandbox -d sandbox/_site --trace + - name: Memory Analysis of Jekyll Build + run: bundle exec ruby jekyll/.github/workflows/actions/memprof.rb sandbox