Skip to content

Commit

Permalink
Merge pull request #2277 from sparklemotion/flavorjones-better-ci-cac…
Browse files Browse the repository at this point in the history
…hing

improve CI caching of compiled dependencies

---

**What problem is this PR intended to solve?**

Quite a bit of CI time is spent compiling our packaged dependencies (libxml2, libxslt, libiconv, zlib). For a given platform, we should be able to cache these libraries once compiled.

This PR does two things:

- move libgumbo out of `/ports`
- caches `/ports` for most jobs that were previously caching just `/ports/archives` (which only contains the tarballs)

Before/after timings for the `rake compile` job:

|              | before | after |
|--------------|--------|-------|
| linux 2.7    | 1m12s  | 18s   |
| linux head   | 1m29s  | 17s   |
| macos head   | 2m10s  | 34s   |
| windows head | 9m47s  | 1m42s |
  • Loading branch information
flavorjones authored Jun 19, 2021
2 parents 1508a66 + c53c07e commit 855f7c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-ubuntu-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-ubuntu-${{hashFiles('**/dependencies.yml')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test
Expand All @@ -77,8 +77,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-ubuntu-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-ubuntu-${{hashFiles('**/dependencies.yml')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind
Expand Down Expand Up @@ -132,8 +132,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-ubuntu-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-ubuntu-${{hashFiles('**/dependencies.yml')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test
Expand All @@ -155,8 +155,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-ubuntu-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-ubuntu-${{hashFiles('**/dependencies.yml')}}
- run: bundle install --local || bundle install
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind
Expand All @@ -178,8 +178,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-macos-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-macos-${{hashFiles('**/dependencies.yml')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand All @@ -205,8 +205,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-windows-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-windows-${{hashFiles('**/dependencies.yml')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-${{matrix.plat}}-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-${{matrix.plat}}-${{hashFiles('**/dependencies.yml')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test

Expand All @@ -109,8 +109,8 @@ jobs:
- uses: actions/cache@v2
if: matrix.sys == 'disable'
with:
path: ports/archives
key: tarballs-ubuntu-${{hashFiles('**/dependencies.yml')}}
path: ports
key: ports-ubuntu-${{hashFiles('**/dependencies.yml')}}
- run: bundle exec rake compile -- --${{matrix.sys}}-system-libraries
- run: bundle exec rake test:valgrind

Expand Down
6 changes: 3 additions & 3 deletions ext/nokogiri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def iconv_configure_flags
abort_could_not_find_library("libiconv")
end

def process_recipe(name, version, static_p, cross_p)
def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
require "rubygems"
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION)
require "mini_portile2"
Expand All @@ -413,7 +413,7 @@ def process_recipe(name, version, static_p, cross_p)
end

MiniPortile.new(name, version).tap do |recipe|
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports")
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
# Prefer host_alias over host in order to use i586-mingw32msvc as
# correct compiler prefix for cross build, but use host if not set.
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
Expand Down Expand Up @@ -893,7 +893,7 @@ def compile
ensure_func("exsltFuncRegister", "libexslt/exslt.h")
end

libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p) do |recipe|
libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_build_p, false) do |recipe|
recipe.configure_options = []

class << recipe
Expand Down

0 comments on commit 855f7c0

Please sign in to comment.