name: TestWin

on:
  push:
    branches:
    - master
  pull_request:

jobs:
  build:

    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        ruby: [ '3.3', '3.2', '3.1', '3.0' ]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
    - name: Build and test with Rake
      shell: bash
      run: |
        gem install bundler --no-document
        bundle install --retry 3
        bundle exec ruby test/run_test.rb --max-diff-target-string-size=10000 --verbose=v
    - name: install Re:VIEW and epubcheck-ruby
      shell: bash
      run: |
        gem install -N epubcheck-ruby
        rake install
    - name: Test with epubcheck-ruby
      shell: bash
      run: |
        review-init hello
        cd hello
        ruby -e 'Dir.glob("*.re"){|path| File.write(path, File.read(path).gsub("=", "= foo")) }'
        review-epubmaker config.yml
        epubcheck book.epub
        cd ..
        review-init hello2 --epub-version 2
        cd hello2
        ruby -e 'Dir.glob("*.re"){|path| File.write(path, File.read(path).gsub("=", "= foo")) }'
        review-epubmaker config.yml
        epubcheck book.epub
        cd ..
