From cafdff47bdbf78057cf2affcf6622f7b8422e509 Mon Sep 17 00:00:00 2001 From: Jeremy Woertink Date: Sat, 1 Jul 2023 09:54:03 -0700 Subject: [PATCH] Fixing compilation error on Windows. (#33) * Fixing compilation error on Windows. Also updates the CI to include Windows. Fixes #31 * bump ameba. It was locking up while building on windows, but maybe it was the version * See if we can skip the ameba postinstall during specs * Install Chrome on Windows * Trying to see where chrome is being installed * useless commit because GithubActions seems to not be picking up my last commit... * that was throwing syntax errors, so removing it * Bump webdrivers version * Process with args and shell: true is not supported on Windows --- .github/workflows/specs.yml | 44 +++++++++++++++++++++---------------- shard.yml | 8 +++---- src/selenium/service.cr | 12 ++++++---- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index e94fb8c..b1c7ae3 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -7,14 +7,16 @@ on: branches: [ master ] jobs: - check-format: + check_format: + strategy: + fail-fast: false runs-on: ubuntu-latest + continue-on-error: false steps: - - uses: actions/checkout@v1 + - name: Download source + uses: actions/checkout@v3 - name: Install Crystal - uses: oprypin/install-crystal@v1 - with: - crystal: latest + uses: crystal-lang/install-crystal@v1 - name: Install shards run: shards install - name: Format @@ -28,20 +30,24 @@ jobs: include: - os: ubuntu-latest crystal: latest - - os: ubuntu-latest - crystal: nightly + - os: windows-latest + crystal: latest - os: macos-latest crystal: latest - runs-on: ${{matrix.os}} + runs-on: ${{ matrix.os }} + continue-on-error: false steps: - - uses: actions/checkout@v2 - - name: Install Crystal - uses: oprypin/install-crystal@v1 - with: - crystal: ${{matrix.crystal}} - - name: Install dependencies - run: shards install --ignore-crystal-version - - name: Run tests - run: crystal spec --tag "~chrome" - env: - SELENIUM_BROWSER: chrome + - uses: actions/checkout@v3 + - uses: crystal-lang/install-crystal@v1 + with: + crystal: ${{ matrix.crystal_version }} + - uses: browser-actions/setup-chrome@v1 + with: + chrome-version: stable + if: matrix.os == 'windows-latest' + - name: Install dependencies + run: shards install --ignore-crystal-version --skip-executables --skip-postinstall + - name: Run tests + run: crystal spec --tag "~chrome" + env: + SELENIUM_BROWSER: chrome diff --git a/shard.yml b/shard.yml index 65f631b..8ac914d 100644 --- a/shard.yml +++ b/shard.yml @@ -2,12 +2,12 @@ name: selenium version: 0.11.0 authors: - Matthew McGarvey -crystal: ">= 0.35.0, < 2.0.0" +crystal: ">= 1.4.0, < 2.0.0" license: MIT development_dependencies: webdrivers: - github: matthewmcgarvey/webdrivers.cr - version: ~> 0.4.1 + github: crystal-loot/webdrivers.cr + version: ~> 0.4.2 ameba: github: crystal-ameba/ameba - version: 1.4.2 + version: ~> 1.4.3 diff --git a/src/selenium/service.cr b/src/selenium/service.cr index f97ba1a..f6ff10e 100644 --- a/src/selenium/service.cr +++ b/src/selenium/service.cr @@ -96,18 +96,22 @@ abstract class Selenium::Service private def stop_process(process) return if process.nil? || process.terminated? - process.signal(Signal::KILL) + process.terminate(graceful: false) end private def spawn_in_shell? - os != "linux" + os == "macos" end private def os - {% if flag?(:linux) %} + {% if flag?(:darwin) %} + "macos" + {% elsif flag?(:win32) %} + "windows" + {% elsif flag?(:linux) %} "linux" {% else %} - "macos" + "other" {% end %} end end