Skip to content
Open
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
61 changes: 50 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,72 @@ on: ["push", "pull_request"]

jobs:
test_and_build:
name: "Compile & Lint"
runs-on: "ubuntu-latest"
name: >-
Test on
Elixir ${{ matrix.elixir }} and Erlang/OTP ${{ matrix.otp }}
${{ matrix.update-deps && 'with the latest dependencies' }}
runs-on: "ubuntu-22.04"
strategy:
fail-fast: false
matrix:
include:
# Test on all supported releases. Compatibility matrix from
# https://hexdocs.pm/elixir/compatibility-and-deprecations.html
#
# These pin to the lowest supported OTP for each elixir release.
- { elixir: '1.15', otp: '24' }
- { elixir: '1.16', otp: '24' }
- { elixir: '1.17', otp: '25' }
- { elixir: '1.18', otp: '25' }
- { elixir: '1.18', otp: '25', update-deps: true }
steps:
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
otp-version: 24.3.3
elixir-version: 1.16.3
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}

- uses: actions/checkout@v1
- run: mix deps.get
- uses: actions/checkout@v3

- uses: actions/cache@v2
- name: Setup dependency cache
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
key: mix-${{ hashFiles('mix.lock') }}

- name: Setup binary cache
uses: actions/cache@v3
with:
path: |
./_build
./priv/plts
key: deps-${{ hashFiles('**/mix.lock') }}
key: ${{ matrix.elixir }}-${{ matrix.otp }}

- name: Unlock dependencies to get latest
if: ${{ matrix.update-deps }}
run: mix deps.unlock --all

- if: steps.mix-cache.outputs.cache-hit != 'true'
- name: Fetch dependencies
run: mix deps.get

- name: Rebuild dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.compile
mix dialyzer --plt

- run: |
mix lint
- name: Run linters
run: mix lint

# - name: Install wx support packages
# run: sudo apt install -y libwxgtk3.0-gtk3-0v5

# FIXME: tests currently require an X display.
# - name: Run test
# run: |
# mix test
14 changes: 5 additions & 9 deletions lib/desktop/wx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ defmodule Desktop.Wx do
"""
)

for wx_constant <- @constants do
Code.eval_quoted(
Code.string_to_quoted("""
def wx#{wx_constant}, do: :desktop_wx.get(:wx#{wx_constant})
"""),
[],
module: __MODULE__
)
end
@constants
|> Enum.map(&String.to_atom("wx" <> &1))
|> Enum.each(fn prefixed_constant ->
def unquote(prefixed_constant)(), do: :desktop_wx.get(unquote(prefixed_constant))
end)
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule Desktop.MixProject do
version: @version,
source_url: @url,
description: @description,
elixir: "~> 1.11",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
aliases: aliases(),
Expand Down
Loading