Skip to content

Commit

Permalink
Clean up github actions ci
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Jan 4, 2024
1 parent 7311193 commit b724f88
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 30 deletions.
59 changes: 29 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
name: CI

on:
on:
push:
branches: [ main ]
pull_request:
release:
types:
- published
workflow_call:

jobs:
lint:
runs-on: ubuntu-latest
name: Linter
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: 25.0
elixir-version: 1.14.0
- run: mix deps.get
- run: mix compile --warnings-as-errors
- run: mix credo --strict --ignore design.tagtodo,readability.maxlinelength

test:
services:
postgres:
Expand All @@ -25,40 +39,25 @@ jobs:
--health-retries 5
strategy:
matrix:
include:
version:
- otp: 25.0
elixir: 1.14.0
os: ubuntu-latest
- otp: 22.0
elixir: 1.12.0
# It's necessary to run on ubuntu 20.04 for OTP 20 - 25
# It's necessary to run on ubunto 20.04 for OTP 20 - 25
# See https://github.com/erlef/setup-beam
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- run: mix deps.get
- run: mix test
env:
POSTGRES_URL: ecto://postgres:postgres@localhost/pow_assent_test
- run: MIX_ENV=test mix credo --ignore design.tagtodo,readability.maxlinelength --strict
deploy:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
name: Deploy published release
os: ubuntu-20.04
runs-on: ${{ matrix.version.os }}
name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}}
env:
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
MIX_ENV: test
POSTGRES_URL: ecto://postgres:postgres@localhost/pow_assent_test
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: 24.0
elixir-version: 1.12
- run: mix deps.get
- run: mix hex.publish --yes
otp-version: ${{matrix.version.otp}}
elixir-version: ${{matrix.version.elixir}}
- run: mix deps.get mix compile --warnings-as-errors
- run: mix test
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish

on:
release:
types:
- published

jobs:
test:
uses: ./.github/workflows/ci.yml

publish:
needs: test
runs-on: ubuntu-latest
name: Publish release
env:
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: 24.0
elixir-version: 1.12
- run: mix deps.get
- run: mix hex.publish --yes

0 comments on commit b724f88

Please sign in to comment.