Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 83 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,155 @@ name: Continuous Integration
on: [push, pull_request]

env:
CACHE_VERSION: 1
CACHE_VERSION: 2
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
test:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
env:
MIX_ENV: "test"
ELIXIR_VERSION: ${{ matrix.elixir }}
OTP_VERSION: ${{ matrix.otp }}
LOCKFILE: ${{ matrix.lockfile }}
strategy:
fail-fast: false
matrix:
elixir: ["1.12.3", "1.11.4", "1.10.4", "1.9.4", "1.8.2"]
include:
# Modern toolchain — default lockfile (hackney 4.x dependency set)
- elixir: "1.19.5"
otp: "28.5"
lockfile: ""
lockfile_path: "mix.lock"
check_formatting: true
# Legacy toolchains — test/lockfiles/legacy.lock (hackney 1.x set).
# erlef/setup-beam can no longer install OTP < 24.2 on current
# GitHub-hosted runners, so these run in hexpm/elixir containers.
- elixir: "1.12.3"
otp: "24.0.6"
otp: "24.3.4.9"
container: "hexpm/elixir:1.12.3-erlang-24.3.4.9-ubuntu-noble-20260509.1"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
check_formatting: true
- elixir: "1.11.4"
otp: "24.0.6"
otp: "24.3.4.9"
container: "hexpm/elixir:1.11.4-erlang-24.3.4.9-ubuntu-noble-20260509.1"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
check_formatting: true
- elixir: "1.10.4"
otp: "23.3.4.7"
otp: "23.3.4" # match discovered tag
container: "hexpm/elixir:1.10.4-erlang-23.3.4.16-debian-bullseye-20260518"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
check_formatting: false
- elixir: "1.9.4"
otp: "22.3.4.21"
otp: "22.3.4.9"
container: "hexpm/elixir:1.9.4-erlang-22.3.4.9-ubuntu-impish-20211102"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
check_formatting: false
- elixir: "1.8.2"
otp: "22.3.4.21"
otp: "22.3.4.9"
container: "hexpm/elixir:1.8.2-erlang-22.3.4.9-ubuntu-impish-20211102"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
check_formatting: false
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
if: ${{ !matrix.container }}
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Install hex and rebar
run: mix local.hex --force && mix local.rebar --force
- name: Cache deps
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: deps
key: ${{ env.CACHE_VERSION }}-deps-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
key: ${{ env.CACHE_VERSION }}-deps-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(matrix.lockfile_path) }}
- name: Cache _build
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: _build/${{ env.MIX_ENV }}
key: ${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-
key: ${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(matrix.lockfile_path) }}
- name: Install Dependencies
run: mix deps.get
- name: Compile app
run: mix compile --force --warnings-as-errors
- run: mix coveralls.json
- name: Upload results to CodeCov
shell: bash
run: bash <(curl -s https://codecov.io/bash) -F UnitTest -e ELIXIR_VERSION,OTP_VERSION || echo "Codecov did not collect coverage reports"
- run: mix format --check-formatted
if: matrix.check_formatting
- run: mix credo --strict
# Newer credo adds at least two checks that would require widespread changes to fix
if: matrix.lockfile == 'legacy'
- name: Check for unused dependencies
run: mix deps.unlock --unused && git diff --exit-code
if: matrix.lockfile != 'legacy'
run: mix deps.unlock --check-unused

dialyzer:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
env:
MIX_ENV: "dev"
LOCKFILE: ${{ matrix.lockfile }}
strategy:
fail-fast: false
matrix:
elixir: ["1.12.3", "1.11.4", "1.10.4", "1.9.4", "1.8.2"]
include:
- elixir: "1.19.5"
otp: "28.5"
lockfile: ""
lockfile_path: "mix.lock"
- elixir: "1.12.3"
otp: "24.0.6"
otp: "24.3.4.9"
container: "hexpm/elixir:1.12.3-erlang-24.3.4.9-ubuntu-noble-20260509.1"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
- elixir: "1.11.4"
otp: "24.0.6"
otp: "24.3.4.9"
container: "hexpm/elixir:1.11.4-erlang-24.3.4.9-ubuntu-noble-20260509.1"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
- elixir: "1.10.4"
otp: "23.3.4.7"
otp: "23.3.4" # match discovered tag
container: "hexpm/elixir:1.10.4-erlang-23.3.4.16-debian-bullseye-20260518"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
- elixir: "1.9.4"
otp: "22.3.4.21"
otp: "22.3.4.9"
container: "hexpm/elixir:1.9.4-erlang-22.3.4.9-ubuntu-impish-20211102"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
- elixir: "1.8.2"
otp: "22.3.4.21"
otp: "22.3.4.9"
container: "hexpm/elixir:1.8.2-erlang-22.3.4.9-ubuntu-impish-20211102"
lockfile: "legacy"
lockfile_path: "test/lockfiles/legacy.lock"
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
if: ${{ !matrix.container }}
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@v1
- name: Install hex and rebar
run: mix local.hex --force && mix local.rebar --force
- uses: actions/cache@v4
with:
path: deps
key: ${{ env.CACHE_VERSION }}-deps-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- uses: actions/cache@v1
key: ${{ env.CACHE_VERSION }}-deps-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(matrix.lockfile_path) }}
- uses: actions/cache@v4
with:
path: _build/${{ env.MIX_ENV }}
key: ${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-dialyzer
key: ${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-dialyzer-${{ hashFiles(matrix.lockfile_path) }}
restore-keys: |
${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-
${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-dialyzer-
- name: Install Dependencies
run: mix deps.get
- name: Compile app
Expand Down Expand Up @@ -177,11 +232,11 @@ jobs:
run: phantomjs --wd --webdriver-logfile=logs/phantomjs.log --webdriver-loglevel=DEBUG --debug=true &> logs/phantomjs-output.log &
- name: Run chromedriver
run: chromedriver --log-path=logs/chromedriver.log --log-level=DEBUG &
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: deps
key: ${{ env.CACHE_VERSION }}-deps-build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- uses: actions/cache@v1
- uses: actions/cache@v4
with:
path: _build/${{ env.MIX_ENV }}
key: ${{ env.CACHE_VERSION }}-_build-${{ env.MIX_ENV }}-${{ matrix.otp }}-${{ matrix.elixir }}-integration-tests
Expand Down Expand Up @@ -228,7 +283,7 @@ jobs:
- name: Upload results to CodeCov
run: bash <(curl -s https://codecov.io/bash) -F IntegrationTest -F Selenium2Firefox -e ELIXIR_VERSION,OTP_VERSION || echo "Codecov did not collect coverage reports"

- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v7
if: always()
with:
name: Integration test server logs (Elixir ${{matrix.elixir}})
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 22.3.4.21
elixir 1.8.2-otp-22
erlang 28.5
elixir 1.19.5-otp-28
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ The unit test suite can be run with the following command.
mix test
```

By default this runs against the newest supported dependency set (including hackney 4.x). To run against an older supported set (hackney 1.x), select the legacy lockfile:

```
LOCKFILE=legacy mix deps.get
LOCKFILE=legacy mix test
```

### Integration tests

Although each webdriver implementation should be the same in theory, it's good to double-check that this library actually works. The following webdriver implementations are supported via the test suite:
Expand Down
15 changes: 11 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule WebDriverClient.MixProject do
docs: :docs
],
start_permanent: Mix.env() == :prod,
lockfile: lockfile(System.get_env("LOCKFILE")),
docs: docs(),
deps: deps(),
dialyzer: dialyzer(),
Expand All @@ -41,19 +42,25 @@ defmodule WebDriverClient.MixProject do
[
{:tesla, "~> 1.3"},
{:jason, "~> 1.0"},
{:hackney, "~> 1.6"},
{:bypass, "~> 1.0", only: :test},
{:hackney, "~> 1.6 or ~> 4.0"},
{:bypass, "~> 1.0 or ~> 2.1", only: :test},
{:stream_data, "~> 0.1", only: [:dev, :test]},
{:excoveralls, "~> 0.10", only: :test},
{:credo, "~> 1.4.0", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.1.0", only: [:dev], runtime: false},
{:credo, "~> 1.4", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.1", only: [:dev], runtime: false},
{:ex_doc, "~> 0.20", only: [:docs, :docs_prerelease]}
]
end

defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]

# Allows testing against alternate dependency sets, e.g.
# `LOCKFILE=legacy mix deps.get` for hackney 1.x on older Elixir/OTP.
defp lockfile(nil), do: "mix.lock"
defp lockfile(""), do: "mix.lock"
defp lockfile(lockfile), do: "test/lockfiles/#{lockfile}.lock"

defp dialyzer do
[
ignore_warnings: ".dialyzer_ignore.exs",
Expand Down
Loading
Loading