Skip to content

Commit

Permalink
ci: gumbo parser tests
Browse files Browse the repository at this point in the history
and add gumbo tests to the default rake task
  • Loading branch information
flavorjones committed Jun 19, 2021
1 parent 652ec65 commit b2714b7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
require "bundler"
NOKOGIRI_SPEC = Bundler.load_gemspec("nokogiri.gemspec")

task default: [:rubocop, :compile, :test]
task default: [:rubocop, :gumbo, :compile, :test]
1 change: 1 addition & 0 deletions gumbo-parser/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
googletest
src/*.o
29 changes: 29 additions & 0 deletions rakelib/gumbo.rake
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit b2714b7

Please sign in to comment.