From b2714b76bcfa6dfbb0e4c9d64a808c48a79dd5d7 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 18 Jun 2021 16:58:29 -0400 Subject: [PATCH] ci: gumbo parser tests and add gumbo tests to the default rake task --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ Rakefile | 2 +- gumbo-parser/.gitignore | 1 + rakelib/gumbo.rake | 29 +++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 rakelib/gumbo.rake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68c2290386..3cdce86a6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,31 @@ jobs: - run: bundle install --local || bundle install - run: bundle exec rake rubocop + gumbo: + needs: ["rubocop"] + strategy: + fail-fast: false + matrix: + plat: ["ubuntu", "windows", "macos"] + runs-on: ${{matrix.plat}}-latest + steps: + - name: configure git crlf + if: matrix.plat == 'windows' + run: | + git config --system core.autocrlf false + git config --system core.eol lf + - uses: actions/checkout@v2 + with: + submodules: true + - uses: MSP-Greg/setup-ruby-pkgs@v1 + with: + ruby-version: "3.0" + apt-get: "ragel" + brew: "ragel" + mingw: "ragel" + bundler-cache: true + - run: bundle exec rake gumbo:test + basic: needs: ["rubocop"] strategy: diff --git a/Rakefile b/Rakefile index 4a295c88c7..32d65dff63 100644 --- a/Rakefile +++ b/Rakefile @@ -6,4 +6,4 @@ require "bundler" NOKOGIRI_SPEC = Bundler.load_gemspec("nokogiri.gemspec") -task default: [:rubocop, :compile, :test] +task default: [:rubocop, :gumbo, :compile, :test] diff --git a/gumbo-parser/.gitignore b/gumbo-parser/.gitignore index 13b0a3e962..3d04bd296b 100644 --- a/gumbo-parser/.gitignore +++ b/gumbo-parser/.gitignore @@ -1,2 +1,3 @@ build +googletest src/*.o diff --git a/rakelib/gumbo.rake b/rakelib/gumbo.rake new file mode 100644 index 0000000000..b48e5f574b --- /dev/null +++ b/rakelib/gumbo.rake @@ -0,0 +1,29 @@ + +namespace "gumbo" do + gtest_pkg = "gumbo-parser/googletest" + gtest_lib = File.join(gtest_pkg, "make/gtest_main.a") + + file gtest_lib => gtest_pkg do + sh("make -C gumbo-parser/googletest/make gtest_main.a") + end + + file gtest_pkg do + sh(<<~EOF) + curl -L https://github.com/google/googletest/archive/release-1.8.0.tar.gz | \ + tar zxf - --strip-components 1 -C gumbo-parser googletest-release-1.8.0/googletest + EOF + end + + task "test" => gtest_lib do + sh("make -j2 -C gumbo-parser") + end + + task "clean" do + sh("make -j2 -C gumbo-parser clean") + end + + CLOBBER.add(gtest_pkg) +end + +task "gumbo" => "gumbo:test" +task "clean" => "gumbo:clean"