Skip to content

Commit 2f0eeae

Browse files
committed
Clean up github actions ci
1 parent 6f80c37 commit 2f0eeae

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
name: CI
22

3-
on:
3+
on:
44
push:
5+
branches: [ main ]
56
pull_request:
6-
release:
7-
types:
8-
- published
7+
workflow_call:
98

109
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
name: Linter
13+
env:
14+
MIX_ENV: test
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: erlef/setup-beam@v1
18+
with:
19+
otp-version: 26.0
20+
elixir-version: 1.15
21+
- run: mix deps.get
22+
- run: mix compile --warnings-as-errors
23+
- run: mix credo --ignore design.tagtodo
24+
1125
test:
12-
# This ensures we run the test for only the PR or the push
13-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
1426
services:
1527
postgres:
1628
image: postgres:latest
@@ -27,40 +39,25 @@ jobs:
2739
--health-retries 5
2840
strategy:
2941
matrix:
30-
include:
42+
version:
3143
- otp: 26.0
3244
elixir: 1.15.0
3345
os: ubuntu-latest
3446
- otp: 22.0
3547
elixir: 1.12.0
3648
# It's necessary to run on ubunto 20.04 for OTP 20 - 25
3749
# See https://github.com/erlef/setup-beam
38-
os: ubuntu-20.04
39-
runs-on: ${{ matrix.os }}
40-
name: OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }}
41-
steps:
42-
- uses: actions/checkout@v3
43-
- uses: erlef/setup-beam@v1
44-
with:
45-
otp-version: ${{ matrix.otp }}
46-
elixir-version: ${{ matrix.elixir }}
47-
- run: mix deps.get
48-
- run: mix test
49-
env:
50-
POSTGRES_URL: ecto://postgres:postgres@localhost/pow_test
51-
- run: MIX_ENV=test mix credo --ignore design.tagtodo
52-
deploy:
53-
needs: test
54-
runs-on: ubuntu-latest
55-
if: github.event_name == 'release' && github.event.action == 'published'
56-
name: Deploy published release
50+
os: ubuntu-20.04
51+
runs-on: ${{ matrix.version.os }}
52+
name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}}
5753
env:
58-
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
54+
MIX_ENV: test
55+
POSTGRES_URL: ecto://postgres:postgres@localhost/pow_test
5956
steps:
6057
- uses: actions/checkout@v3
6158
- uses: erlef/setup-beam@v1
6259
with:
63-
otp-version: 25.0
64-
elixir-version: 1.14.0
65-
- run: mix deps.get
66-
- run: mix hex.publish --yes
60+
otp-version: ${{matrix.version.otp}}
61+
elixir-version: ${{matrix.version.elixir}}
62+
- run: mix deps.get mix compile --warnings-as-errors
63+
- run: mix test

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/ci.yml
11+
12+
publish:
13+
needs: test
14+
runs-on: ubuntu-latest
15+
name: Publish release
16+
env:
17+
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: erlef/setup-beam@v1
21+
with:
22+
otp-version: 26.0
23+
elixir-version: 1.15
24+
- run: mix deps.get
25+
- run: mix hex.publish --yes

0 commit comments

Comments
 (0)