Skip to content

Commit 0cda734

Browse files
author
Tallak Tveide
committed
Convert to Github CI
1 parent e3f76cf commit 0cda734

6 files changed

Lines changed: 83 additions & 19 deletions

File tree

‎.credo.exs‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@
5858
# If you don't want the `setup` and `test` macro calls in ExUnit tests
5959
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
6060
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
61-
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
61+
{Credo.Check.Design.DuplicatedCode, false},
6262

6363
# You can also customize the exit_status of each check.
6464
# If you don't want TODO comments to cause `mix credo` to fail, just
6565
# set this value to 0 (zero).
6666
{Credo.Check.Design.TagTODO, exit_status: 2},
6767
{Credo.Check.Design.TagFIXME},
68-
6968
{Credo.Check.Readability.FunctionNames},
7069
{Credo.Check.Readability.LargeNumbers},
7170
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
@@ -77,7 +76,6 @@
7776
{Credo.Check.Readability.TrailingBlankLine},
7877
{Credo.Check.Readability.TrailingWhiteSpace},
7978
{Credo.Check.Readability.VariableNames},
80-
8179
{Credo.Check.Refactor.ABCSize},
8280
# {Credo.Check.Refactor.CaseTrivialMatches}, # deprecated in 0.4.0
8381
{Credo.Check.Refactor.CondStatements},
@@ -89,7 +87,6 @@
8987
{Credo.Check.Refactor.NegatedConditionsWithElse},
9088
{Credo.Check.Refactor.Nesting},
9189
{Credo.Check.Refactor.UnlessWithElse},
92-
9390
{Credo.Check.Warning.IExPry},
9491
{Credo.Check.Warning.IoInspect},
9592
{Credo.Check.Warning.NameRedeclarationByAssignment},
@@ -103,7 +100,7 @@
103100
{Credo.Check.Warning.UnusedListOperation},
104101
{Credo.Check.Warning.UnusedStringOperation},
105102
{Credo.Check.Warning.UnusedTupleOperation},
106-
{Credo.Check.Warning.OperationWithConstantResult},
103+
{Credo.Check.Warning.OperationWithConstantResult}
107104

108105
# Custom checks can be created using `mix credo.gen.check`.
109106
#

‎.formatter.exs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
inputs: ["{mix,.formatter,.credo}.exs", "{config,lib,test,dev,bench}/**/*.{ex,exs}"]
3+
]

‎.github/workflows/ci.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}
15+
runs-on: ubuntu-24.04
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
# Elixir 1.16 is the minimum required by mix.exs. Each Elixir release
20+
# is paired with the oldest and newest OTP it supports.
21+
include:
22+
- { elixir: "1.16", otp: "24" }
23+
- { elixir: "1.16", otp: "26" }
24+
- { elixir: "1.17", otp: "25" }
25+
- { elixir: "1.17", otp: "27" }
26+
- { elixir: "1.18", otp: "25" }
27+
- { elixir: "1.18", otp: "27" }
28+
- { elixir: "1.19", otp: "26" }
29+
- { elixir: "1.19", otp: "28" }
30+
- { elixir: "1.20", otp: "27" }
31+
- { elixir: "1.20", otp: "29" }
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- uses: erlef/setup-beam@v1
36+
with:
37+
elixir-version: ${{ matrix.elixir }}
38+
otp-version: ${{ matrix.otp }}
39+
40+
- name: Cache build
41+
uses: actions/cache@v4
42+
with:
43+
path: _build
44+
key: build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.exs', 'config/**', 'lib/**', 'unicode/**') }}
45+
restore-keys: build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
46+
47+
- run: mix test
48+
49+
lint:
50+
name: Format and Credo
51+
runs-on: ubuntu-24.04
52+
env:
53+
MIX_ENV: dev
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- uses: erlef/setup-beam@v1
58+
with:
59+
elixir-version: "1.19"
60+
otp-version: "28"
61+
62+
- name: Cache deps and build
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
deps
67+
_build
68+
key: lint-${{ runner.os }}-${{ hashFiles('mix.lock') }}
69+
restore-keys: lint-${{ runner.os }}-
70+
71+
- run: mix deps.get
72+
- run: mix format --check-formatted
73+
# Refactoring suggestions are not enforced yet; see .credo.exs
74+
- run: mix credo --ignore-checks Refactor

‎.travis.yml‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Codepagex
22

3-
[![Build Status](https://travis-ci.org/tallakt/codepagex.svg)](https://travis-ci.org/tallakt/codepagex)
3+
[![CI](https://github.com/tallakt/codepagex/actions/workflows/ci.yml/badge.svg)](https://github.com/tallakt/codepagex/actions/workflows/ci.yml)
44
[![Documentation Status](https://inch-ci.org/github/tallakt/codepagex.svg?branch=master)](https://inch-ci.org/github/tallakt/codepagex#)
55

66
Codepagex is an elixir library to convert between string encodings to and from

‎bench/benchmark.exs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ iso_1M =
7474
|> Stream.take(m1)
7575
|> Enum.into(<<>>)
7676

77-
IO.puts "ISO8859-1 to UTF-8"
77+
IO.puts("ISO8859-1 to UTF-8")
7878

7979
Benchee.run(
8080
%{
@@ -100,7 +100,7 @@ utf8_10K = utf8_stream |> Stream.take(k10) |> Enum.into("")
100100
utf8_100K = utf8_stream |> Stream.take(k100) |> Enum.into("")
101101
utf8_1M = utf8_stream |> Stream.take(m1) |> Enum.into("")
102102

103-
IO.puts "UTF-8 to ISO8895-1"
103+
IO.puts("UTF-8 to ISO8895-1")
104104

105105
Benchee.run(
106106
%{
@@ -119,7 +119,7 @@ Benchee.run(
119119
memory_time: 5
120120
)
121121

122-
IO.puts "UTF-8 to ASCII"
122+
IO.puts("UTF-8 to ASCII")
123123

124124
Benchee.run(
125125
%{

0 commit comments

Comments
 (0)