Skip to content

Commit 782b44c

Browse files
committed
Add github ci workflow
1 parent 54d2ba7 commit 782b44c

File tree

3 files changed

+108
-2
lines changed

3 files changed

+108
-2
lines changed

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Elixir CI
2+
3+
# Define workflow that runs when changes are pushed to the
4+
# `main` branch or pushed to a PR branch that targets the `main`
5+
# branch. Change the branch name if your project uses a
6+
# different name for the main branch like "master" or "production".
7+
on:
8+
push:
9+
branches: [ "main" ] # adapt branch for project
10+
pull_request:
11+
branches: [ "main" ] # adapt branch for project
12+
13+
# Sets the ENV `MIX_ENV` to `test` for running tests
14+
env:
15+
MIX_ENV: test
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
test:
22+
# Set up a Postgres DB service. By default, Phoenix applications
23+
# use Postgres. This creates a database for running tests.
24+
# Additional services can be defined here if required.
25+
# services:
26+
# db:
27+
# image: postgres:12
28+
# ports: ['5432:5432']
29+
# env:
30+
# POSTGRES_PASSWORD: postgres
31+
# options: >-
32+
# --health-cmd pg_isready
33+
# --health-interval 10s
34+
# --health-timeout 5s
35+
# --health-retries 5
36+
37+
runs-on: ubuntu-latest
38+
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
39+
strategy:
40+
# Specify the OTP and Elixir versions to use when building
41+
# and running the workflow steps.
42+
matrix:
43+
otp: ['25.3.2'] # Define the OTP version [required]
44+
elixir: ['1.14.4'] # Define the elixir version [required]
45+
steps:
46+
# Step: Setup Elixir + Erlang image as the base.
47+
- name: Set up Elixir
48+
uses: erlef/setup-beam@v1
49+
with:
50+
otp-version: ${{matrix.otp}}
51+
elixir-version: ${{matrix.elixir}}
52+
53+
# Step: Check out the code.
54+
- name: Checkout code
55+
uses: actions/checkout@v3
56+
57+
# Step: Define how to cache deps. Restores existing cache if present.
58+
- name: Cache deps
59+
id: cache-deps
60+
uses: actions/cache@v3
61+
env:
62+
cache-name: cache-elixir-deps
63+
with:
64+
path: deps
65+
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
66+
restore-keys: |
67+
${{ runner.os }}-mix-${{ env.cache-name }}-
68+
69+
# Step: Define how to cache the `_build` directory. After the first run,
70+
# this speeds up tests runs a lot. This includes not re-compiling our
71+
# project's downloaded deps every run.
72+
- name: Cache compiled build
73+
id: cache-build
74+
uses: actions/cache@v3
75+
env:
76+
cache-name: cache-compiled-build
77+
with:
78+
path: _build
79+
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
80+
restore-keys: |
81+
${{ runner.os }}-mix-${{ env.cache-name }}-
82+
${{ runner.os }}-mix-
83+
84+
# Step: Download project dependencies. If unchanged, uses
85+
# the cached version.
86+
- name: Install dependencies
87+
run: mix deps.get
88+
89+
# Step: Compile the project treating any warnings as errors.
90+
# Customize this step if a different behavior is desired.
91+
- name: Compiles without warnings
92+
run: mix compile --warnings-as-errors
93+
94+
# Step: Check that the checked in code has already been formatted.
95+
# This step fails if something was found unformatted.
96+
# Customize this step as desired.
97+
# - name: Check Formatting
98+
# run: mix format --check-formatted
99+
100+
# Step: Execute the tests.
101+
- name: Run tests
102+
run: mix test
103+
104+
# Step: Execute dialyzer.
105+
- name: Run dialyzer
106+
run: mix dialyzer

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule Cldr.Messages.MixProject do
5151

5252
{:nimble_parsec, "~> 0.5 or ~> 1.0"},
5353
{:jason, "~> 1.1"},
54-
{:dialyxir, "~> 1.0", optional: true, only: [:dev], runtime: false},
54+
{:dialyxir, "~> 1.0", optional: true, only: [:dev, :test], runtime: false},
5555
{:ex_doc, "~> 0.20", optional: true, runtime: false},
5656
{:gettext, "~> 0.19", optional: true}
5757
]

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"},
66
"digital_token": {:hex, :digital_token, "0.6.0", "13e6de581f0b1f6c686f7c7d12ab11a84a7b22fa79adeb4b50eec1a2d278d258", [:mix], [{:cldr_utils, "~> 2.17", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "2455d626e7c61a128b02a4a8caddb092548c3eb613ac6f6a85e4cbb6caddc4d1"},
77
"earmark": {:hex, :earmark, "1.4.14", "d04572cef64dd92726a97d92d714e38d6e130b024ea1b3f8a56e7de66ec04e50", [:mix], [{:earmark_parser, ">= 1.4.12", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "df338b8b1852ee425180b276c56c6941cb12220e04fe8718fe4acbdd35fd699f"},
8-
"earmark_parser": {:hex, :earmark_parser, "1.4.36", "487ea8ef9bdc659f085e6e654f3c3feea1d36ac3943edf9d2ef6c98de9174c13", [:mix], [], "hexpm", "a524e395634bdcf60a616efe77fd79561bec2e930d8b82745df06ab4e844400a"},
8+
"earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"},
99
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
1010
"ex_cldr": {:hex, :ex_cldr, "2.37.2", "c45041534ec60af367c4c1af02a608576118044fe3c441c782fd424061d6b517", [:mix], [{:cldr_utils, "~> 2.21", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: true]}], "hexpm", "c8467b1d5080716ace6621703b6656cb2f9545572a54b341da900791a0cf92ba"},
1111
"ex_cldr_calendars": {:hex, :ex_cldr_calendars, "1.22.1", "3e5150f1fe7698e0fa118aeedcca1b5920d0a552bc40c81cf65ca9b0a4ea4cc3", [:mix], [{:calendar_interval, "~> 0.2", [hex: :calendar_interval, repo: "hexpm", optional: true]}, {:ex_cldr_lists, "~> 2.10", [hex: :ex_cldr_lists, repo: "hexpm", optional: true]}, {:ex_cldr_numbers, "~> 2.31", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_cldr_units, "~> 3.16", [hex: :ex_cldr_units, repo: "hexpm", optional: true]}, {:ex_doc, "~> 0.21", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e7408cd9e8318b2ef93b76728e84484ddc3ea6d7c894fbc811c54122a7140169"},

0 commit comments

Comments
 (0)