From 85d87e4f7f7f147e5aa47c1bb6bd9b74b37539f1 Mon Sep 17 00:00:00 2001 From: Jason Pollentier Date: Wed, 15 May 2024 16:56:25 -0500 Subject: [PATCH] wip: upgrade languages and libraries, move to GitHub actions --- .coveralls.yml | 2 -- .github/workflows/test.yml | 45 ++++++++++++++++++++++++++++++++++++++ .tool-versions | 6 ++--- .travis.yml | 30 ------------------------- config/config.exs | 2 +- mix.exs | 4 ++-- mix.lock | 2 +- test/nodejs_test.exs | 2 +- 8 files changed, 53 insertions(+), 40 deletions(-) delete mode 100644 .coveralls.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 35bb46b..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,2 +0,0 @@ -multi: - excoveralls: cover/excoveralls.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..be49831 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test and Deploy +on: + push: + release: + types: [published] +jobs: + tests: + services: + db: + image: postgres:15 + ports: ["5432:5432"] + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + runs-on: ubuntu-22.04 + name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + env: + MIX_ENV: test + strategy: + matrix: + include: + - otp: "24" + elixir: "1.12" + nodejs: "18.x" + - otp: "26" + elixir: "1.16" + nodejs: "20.x" + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - uses: actions/setup-node@v4 + with: + node-version: ${{matrix.nodejs}} + - run: mix deps.get + - run: mix compile + - run: npm install --prefix=test/js + - run: mix test diff --git a/.tool-versions b/.tool-versions index 91239dd..a8992a5 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -erlang 21.1 -elixir 1.9.1-otp-21 -nodejs 12.9.0 +erlang 26.1.2 +elixir 1.16.0-otp-26 +nodejs 20.1.0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index df1af4c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -sudo: false -language: elixir -elixir: - - 1.7 -otp_release: - - 21.0 -cache: - directories: - - _build - - deps - - priv/node_modules -install: - - gem install coveralls-multi --no-document - - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 9 - - mix local.hex --force - - mix local.rebar --force - - mix deps.get - - npm install - - cd test/js - - npm install - - cd ../.. -script: - - MIX_ENV=test mix coveralls.json - - coveralls-multi -deploy: - skip_cleanup: true - provider: script - script: mix hex.publish --yes - on: - tags: true diff --git a/config/config.exs b/config/config.exs index 0044e49..93517dd 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ # This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this diff --git a/mix.exs b/mix.exs index 85d73c1..1961cf8 100644 --- a/mix.exs +++ b/mix.exs @@ -38,9 +38,9 @@ defmodule NodeJS.MixProject do defp deps do [ {:ex_doc, "~> 0.22.0", only: :dev}, - {:excoveralls, "~> 0.13.0", only: :test}, {:jason, "~> 1.0"}, - {:poolboy, "~> 1.5.1"} + {:poolboy, "~> 1.5.1"}, + {:ssl_verify_fun, "~> 1.1.7", manager: :rebar3, override: true} ] end diff --git a/mix.lock b/mix.lock index b032ac4..6384129 100644 --- a/mix.lock +++ b/mix.lock @@ -16,6 +16,6 @@ "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, "poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, } diff --git a/test/nodejs_test.exs b/test/nodejs_test.exs index 1709bf7..20a31b4 100644 --- a/test/nodejs_test.exs +++ b/test/nodejs_test.exs @@ -86,7 +86,7 @@ defmodule NodeJS.Test do test "object does not exist" do assert {:error, msg} = NodeJS.call({"keyed-functions", :idontexist, :foo}) - assert js_error_message(msg) === "TypeError: Cannot read property 'foo' of undefined" + assert js_error_message(msg) === "TypeError: Cannot read properties of undefined (reading 'foo')" end end