Skip to content

Commit

Permalink
Setup circleci and gh workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptrboro committed May 14, 2024
1 parent 721bd0c commit fe5325d
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 2.1

orbs:
elixir-orb: fresha/[email protected]

workflows:
version: 2
ci:
jobs:
- elixir-orb/test:
context: Hex
- elixir-orb/static-check:
dialyzer: true
context: Hex
- hold-for-dev-publish:
type: approval
requires:
- elixir-orb/test
- elixir-orb/static-check
filters:
branches:
ignore:
- master
- elixir-orb/dev-publish:
context: Hex
requires:
- hold-for-dev-publish
- elixir-orb/deploy:
context: Hex
requires:
- elixir-orb/test
- elixir-orb/static-check
filters:
branches:
only:
- master
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build & Publish

on:
pull_request:
push:
branches:
- "*"

# by default, permissions are read-only, read + write is required for git pushes
permissions:
contents: write

env:
MIX_ENV: test

jobs:
test:
runs-on: "ubuntu-latest"

name: Test Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
elixir: ["1.15", "1.16"]
otp: ["26", "25"]
include:
- elixir: "1.16"
otp: "25"
lint: lint
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Restore Dependency Cache
uses: actions/cache@v3
id: cache-deps
with:
path: |
deps
_build
key: |
mix-${{ runner.os }}-${{matrix.elixir}}-${{matrix.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-${{ runner.os }}-${{matrix.elixir}}-${{matrix.otp}}-
- run: mix deps.get
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: mix deps.compile --warnings-as-errors
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Check for unused deps
run: mix deps.unlock --check-unused
if: ${{matrix.lint}}

- run: mix format --check-formatted
if: ${{matrix.lint}}

- run: mix test

- name: Build & Publish
run: |
mix hex.build
mix hex.publish --yes
if: ${{matrix.lint}}
env:
MIX_ENV: dev
HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
Empty file added test-results/.gitkeep
Empty file.

0 comments on commit fe5325d

Please sign in to comment.