Skip to content

Commit c14350d

Browse files
authored
improve ci (#254)
1 parent 4a6c129 commit c14350d

File tree

3 files changed

+41
-52
lines changed

3 files changed

+41
-52
lines changed

.github/workflows/mix.yml

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,47 @@ on:
1010

1111
jobs:
1212
test:
13+
name: "test (Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }} / ClickHouse ${{ matrix.clickhouse || 'latest' }} / TZ ${{ matrix.timezone || 'UTC' }}${{ matrix.dialyzer && ' / Dialyzer' || '' }}${{ matrix.lint && ' / Lint' || '' }})"
1314
runs-on: ubuntu-latest
1415

1516
strategy:
1617
matrix:
17-
elixir: [1.14, 1.15, 1.16, 1.17]
18-
otp: [25, 26]
19-
clickhouse: [latest]
20-
timezone: [UTC]
2118
include:
22-
- elixir: 1.17
23-
otp: 27
24-
clickhouse: latest
25-
timezone: UTC
19+
# some old elixir/erlang version
20+
- elixir: 1.14
21+
otp: 25
22+
23+
# some recent version and non-UTC timezone
2624
- elixir: 1.18
2725
otp: 27
28-
clickhouse: latest
29-
timezone: UTC
30-
- elixir: 1.18
31-
otp: 28
32-
clickhouse: latest
33-
timezone: UTC
34-
- elixir: 1.18
35-
otp: 28
36-
clickhouse: latest
3726
timezone: Europe/Berlin
38-
# TODO
39-
# - elixir: 1.19.0-rc.0
40-
# otp: 28
41-
# clickhouse: latest
42-
# timezone: UTC
43-
# Plausible
27+
28+
# the latest elixir/erlang version with all static checks
29+
- elixir: 1.19
30+
otp: 28
31+
dialyzer: true
32+
lint: true
33+
34+
# Plausible versions
4435
# - https://github.com/plausible/analytics/blob/master/.tool-versions
4536
# - https://github.com/plausible/analytics/blob/master/.github/workflows/elixir.yml
4637
- elixir: 1.19.4
4738
otp: 27.3.4.6
4839
clickhouse: 24.12.2.29
49-
timezone: UTC
40+
5041
# some older pre-JSON ClickHouse version
5142
# https://github.com/plausible/ch/issues/273
5243
- elixir: 1.18
5344
otp: 28
5445
clickhouse: 24.5.4.49
55-
timezone: UTC
5646

5747
services:
5848
clickhouse:
59-
image: clickhouse/clickhouse-server:${{ matrix.clickhouse }}
49+
image: clickhouse/clickhouse-server:${{ matrix.clickhouse || 'latest' }}
6050
ports:
6151
- 8123:8123
6252
env:
63-
TZ: ${{ matrix.timezone }}
53+
TZ: ${{ matrix.timezone || 'UTC' }}
6454
# https://github.com/ClickHouse/ClickHouse/issues/75494
6555
CLICKHOUSE_SKIP_USER_SETUP: 1
6656
options: >-
@@ -81,7 +71,8 @@ jobs:
8171
elixir-version: ${{ matrix.elixir }}
8272
otp-version: ${{ matrix.otp }}
8373

84-
- uses: actions/cache@v4
74+
- name: Restore deps cache
75+
uses: actions/cache@v4
8576
with:
8677
path: |
8778
deps
@@ -92,35 +83,29 @@ jobs:
9283
test-${{ steps.beam.outputs.elixir-version }}-refs/heads/master-
9384
9485
- run: mix deps.get --only $MIX_ENV
95-
- run: mix compile --warnings-as-errors
96-
- run: mix test
86+
if: ${{ !matrix.lint }}
9787

98-
format:
99-
runs-on: ubuntu-latest
88+
- run: mix deps.get --check-locked
89+
if: ${{ matrix.lint }}
10090

101-
env:
102-
MIX_ENV: prod
91+
- run: mix deps.unlock --check-unused
92+
if: ${{ matrix.lint }}
10393

104-
steps:
105-
- uses: actions/checkout@v6
94+
- run: mix compile --warnings-as-errors
10695

107-
- id: beam
108-
uses: erlef/setup-beam@v1
109-
with:
110-
elixir-version: 1
111-
otp-version: 28
96+
- run: mix format --check-formatted
97+
if: ${{ matrix.lint }}
11298

113-
- run: elixir -v
99+
- run: mix test
114100

115-
- uses: actions/cache@v4
101+
- name: Restore PLTs cache
102+
if: ${{ matrix.dialyzer }}
103+
uses: actions/cache@v4
116104
with:
117-
path: |
118-
deps
119-
_build
120-
key: format-${{ steps.beam.outputs.elixir-version }}-${{ github.head_ref || github.ref }}-${{ hashFiles('**/mix.lock') }}
105+
path: plts
106+
key: plts-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ github.head_ref || github.ref }}
121107
restore-keys: |
122-
format-${{ steps.beam.outputs.elixir-version }}-${{ github.head_ref || github.ref }}-
123-
format-${{ steps.beam.outputs.elixir-version }}-refs/heads/master-
108+
plts-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-refs/heads/master
124109
125-
- run: mix deps.get --only $MIX_ENV
126-
- run: mix format --check-formatted
110+
- run: mix dialyzer --format github
111+
if: ${{ matrix.dialyzer }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ ecto_ch-*.tar
2424

2525
# Temporary files, for example, from tests.
2626
/tmp/
27+
28+
# Dialyzer PLTs
29+
/plts/

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ defmodule EctoCh.MixProject do
1616
description: "ClickHouse adapter for Ecto",
1717
docs: docs(),
1818
package: package(),
19-
source_url: @source_url
19+
source_url: @source_url,
20+
dialyzer: [plt_local_path: "plts", plt_core_path: "plts", plt_add_apps: [:mix, :ex_unit]]
2021
]
2122
end
2223

0 commit comments

Comments
 (0)