From 9a1907102e9468a14036ac9e70ac9b9feae2dd50 Mon Sep 17 00:00:00 2001 From: Henry Popp Date: Sun, 22 Feb 2026 12:59:06 -0600 Subject: [PATCH] ci: add dialyzer job --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++----- CHANGELOG.md | 35 +++++++++++++++++------------------ lib/pane/viewer.ex | 10 +++++----- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5705aeb..9a6ac40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} + uses: actions/checkout@v4 - name: Use Node.js 18.x uses: actions/setup-node@v3 with: @@ -27,7 +25,7 @@ jobs: name: Format/Credo runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Elixir uses: erlef/setup-beam@v1 with: @@ -45,11 +43,37 @@ jobs: run: mix format --check-formatted - name: Run Credo run: mix credo + dialyzer: + name: Dialyzer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: "1.19" + otp-version: "28" + - name: Restore dependencies cache + uses: actions/cache@v3 + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Restore dialyzer cache + uses: actions/cache@v3 + with: + path: priv/plts + key: ${{ runner.os }}-mix-plts-${{ hashFiles('./priv/plts/') }} + restore-keys: ${{ runner.os }}-mix-plts- + - name: Install dependencies + run: mix deps.get + - name: Run dialyzer + run: mix dialyzer test: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Elixir uses: erlef/setup-beam@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 609ebd9..0fba0a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,56 +2,55 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v0.5.1 - 2026-02-22 +## [0.5.1] - 2026-02-22 -**Added** +### Added -- Better documented typespecs. ([#11](https://github.com/codedge-llc/pane/pull/11)) -- More tests for `Pane.Page` and `Pane.Viewer`. ([#11](https://github.com/codedge-llc/pane/pull/11)) +- Better documented typespecs. +- Unit tests for `Pane.Page` and `Pane.Viewer`. -**Fixed** +### Fixed - Terminal size detection on Windows (replaced `tput` with `:io.rows/0`). - ([#11](https://github.com/codedge-llc/pane/pull/11)) -## v0.5.0 - 2024-08-31 +## [0.5.0] - 2024-08-31 -**Changed** +### Changed - Various documentation updates ([#5](https://github.com/codedge-llc/pane/pull/5)). - Bumped minimum Elixir version to 1.13. -## v0.4.1 - 2021-02-27 +## [0.4.1] - 2021-02-27 -**Fixed** +### Fixed - Include `:iex` in `:extra_applications` to remove compile warning. -## v0.4.0 - 2020-09-28 +## [0.4.0] - 2020-09-28 -**Changed** +### Changed - Bump minimum Elixir version to 1.5. -**Fixed** +### Fixed - Remove deprecated compile warnings. -## v0.3.0 - 2018-01-18 +## [0.3.0] - 2018-01-18 - Support for (f)first and (l)last page -## v0.2.0 - 2018-01-03 +## [0.2.0] - 2018-01-03 - Prompt to enable ANSI codes if disabled -## v0.1.1 - 2017-03-16 +## [0.1.1] - 2017-03-16 - Fix: crash on invalid key command -## v0.1.0 - 2017-02-26 +## [0.1.0] - 2017-02-26 - Initial release diff --git a/lib/pane/viewer.ex b/lib/pane/viewer.ex index 973c40e..89f3ede 100644 --- a/lib/pane/viewer.ex +++ b/lib/pane/viewer.ex @@ -1,14 +1,14 @@ defmodule Pane.Viewer do @moduledoc false - defstruct pages: [], total_pages: 0, index: 0 + defstruct index: 0, pages: [], total_pages: 0 use GenServer @type t :: %__MODULE__{ + index: non_neg_integer(), pages: [Pane.Page.t()], - total_pages: non_neg_integer(), - index: non_neg_integer() + total_pages: non_neg_integer() } @default_max_lines 50 @@ -39,13 +39,13 @@ defmodule Pane.Viewer do iex> Pane.Viewer.init(data: "test") {:ok, %Pane.Viewer{ index: 0, - total_pages: 1, pages: [ %Pane.Page{ data: "test", index: 0 } - ] + ], + total_pages: 1 }} """ def init(opts) do