Skip to content

Commit

Permalink
Bump apps version in GitHub CI
Browse files Browse the repository at this point in the history
List of changes:
- bump actions/checkout to v4
- remove unused deps
- support Erlang/OTP 26.x and Elixir 1.15.x
- update docker command to work with podman
- use default naming of jobs to show `lint` flag
  • Loading branch information
kianmeng committed Nov 13, 2023
1 parent 63645d7 commit adb6594
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:

jobs:
test:
name: Elixir ${{matrix.elixir}} / OTP ${{matrix.otp}}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

services:
postgres:
Expand All @@ -21,34 +20,37 @@ jobs:
POSTGRES_PASSWORD: postgres

strategy:
fail-fast: false
matrix:
elixir:
- '1.13'
- '1.14'
otp:
- '24'
- '25'
include:
- pair:
elixir: 1.11.4
otp: 22.3
- pair:
elixir: 1.15.7
otp: 26.1
lint: lint

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.pair.elixir }}
otp-version: ${{ matrix.pair.otp }}

- name: Restore deps cache
uses: actions/cache@v3
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
key: deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}
deps-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}
- name: Create dializer plts path
run: mkdir -p priv/plts
Expand All @@ -57,21 +59,32 @@ jobs:
uses: actions/cache@v3
with:
path: priv/plts
key: plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
key: plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }}
restore-keys: |
plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ hashFiles('**/mix.lock') }}
plts-${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}
- name: Install package dependencies
run: mix deps.get

- name: Check code format
run: mix format --check-formatted
if: ${{ matrix.lint }}

- name: Check unused deps
run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- name: Compile dependencies
run: mix compile
run: mix deps.compile
env:
MIX_ENV: test

- name: Compile app
run: mix compile --warnings-as-errors
env:
MIX_ENV: test
if: ${{ matrix.lint }}

- name: Run unit tests
run: |
Expand All @@ -82,3 +95,4 @@ jobs:

- name: Run dialyzer
run: mix dialyzer
if: ${{ matrix.lint }}
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.14.1-otp-24 1.12.0-otp-24
erlang 24.1.7 24.1.5 24.1.2 24.1.1 24.0
elixir 1.15.7-otp-26
erlang 26.1.2
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Make sure the tests pass.

Running tests for Dataloader requires a running instance of Postgres. The easiest way to do this is to run Postgres inside of Docker whilst running the Dataloader tests. In one terminal run:

docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dataloader_test postgres
docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dataloader_test docker.io/postgres

and in another terminal run:

Expand Down
4 changes: 2 additions & 2 deletions lib/dataloader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,13 @@ defmodule Dataloader do
# Optionally use `async/1` and `async_stream/3` functions from
# `opentelemetry_process_propagator` if available
if Code.ensure_loaded?(OpentelemetryProcessPropagator.Task) do
@spec async((() -> any)) :: Task.t()
@spec async((-> any)) :: Task.t()
defdelegate async(fun), to: OpentelemetryProcessPropagator.Task

@spec async_stream(Enumerable.t(), (term -> term), keyword) :: Enumerable.t()
defdelegate async_stream(items, fun, opts), to: OpentelemetryProcessPropagator.Task
else
@spec async((() -> any)) :: Task.t()
@spec async((-> any)) :: Task.t()
defdelegate async(fun), to: Task

@spec async_stream(Enumerable.t(), (term -> term), keyword) :: Enumerable.t()
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Dataloader.Mixfile do
[
app: :dataloader,
version: @version,
elixir: "~> 1.12",
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
package: package(),
Expand Down
1 change: 0 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
%{
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
"db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"},
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
"dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"},
Expand Down

0 comments on commit adb6594

Please sign in to comment.