Skip to content

Commit 55b39cf

Browse files
committed
ci: add GitHub Actions for CI, release, and hex publishing
1 parent 1524c18 commit 55b39cf

3 files changed

Lines changed: 116 additions & 0 deletions

File tree

.github/workflows/elixir.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Elixir CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
env:
19+
FORCE_COLOR: 1
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- elixir: 1.18.0
25+
otp: 27.2
26+
- elixir: 1.17.3
27+
otp: 27.2
28+
lint: lint
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Install Elixir and Erlang
33+
uses: erlef/setup-beam@v1
34+
with:
35+
elixir-version: ${{ matrix.elixir }}
36+
otp-version: ${{ matrix.otp }}
37+
- name: Restore deps, _build and plts cache
38+
uses: actions/cache@v4
39+
with:
40+
path: |
41+
deps
42+
_build
43+
key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-
46+
47+
- name: Install dependencies
48+
run: mix deps.get
49+
- name: Compile deps
50+
run: mix deps.compile
51+
52+
- name: Check format
53+
run: mix format --check-formatted
54+
if: ${{ matrix.lint }}
55+
56+
- name: Check unused dependencies
57+
run: mix deps.unlock --check-unused
58+
if: ${{ matrix.lint }}
59+
60+
- name: Compile lint
61+
run: mix compile --warnings-as-errors
62+
if: ${{ matrix.lint }}
63+
64+
- name: Dialyzer
65+
run: mix dialyzer --format github
66+
if: ${{ matrix.lint }}
67+
68+
- name: Run tests
69+
run: mix test --cover
70+
if: ${{ matrix.lint }}
71+
72+
- name: Run tests
73+
run: mix test
74+
if: ${{ !matrix.lint }}

.github/workflows/publish.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: erlef/setup-beam@v1
15+
with:
16+
elixir-version: 1.17.3
17+
otp-version: 27.2
18+
19+
- run: mix deps.get
20+
- run: mix hex.build
21+
- run: mix hex.publish --yes --replace
22+
env:
23+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v4
17+
with:
18+
release-type: elixir
19+
skip-github-release: true

0 commit comments

Comments
 (0)