Skip to content

Commit

Permalink
Added CI & dependabot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed May 9, 2024
1 parent 5a87c56 commit 4061f11
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: "mix"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "deps"
include: "scope"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10

- package-ecosystem: "npm"
directory: "/assets"
open-pull-requests-limit: 5
schedule:
interval: "daily"
23 changes: 23 additions & 0 deletions .github/workflows/dependabot_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
14 changes: 14 additions & 0 deletions .github/workflows/elixir_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Elixir CI

on: push

env:
MIX_ENV: test

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: earthly/actions-setup@v1
- uses: actions/checkout@v4
- run: earthly -P --ci +ci
42 changes: 42 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
VERSION 0.7
ARG elixir_version=1.16.1
ARG otp_version=26.2.1
ARG debian_version=bookworm-20231120-slim
FROM hexpm/elixir:$elixir_version-erlang-$otp_version-debian-$debian_version

ci:
BUILD +lint
BUILD +test

lint:
FROM +lint-setup
COPY --dir lib test ./
COPY .formatter.exs ./
RUN mix format --check-formatted
RUN mix xref graph --format cycles --fail-above 76

test:
FROM +test-setup
COPY --dir lib test ./
RUN MIX_ENV=test mix compile
RUN mix test

setup-base:
RUN apt-get update && apt install -y build-essential git && apt-get clean
ENV ELIXIR_ASSERT_TIMEOUT=10000
WORKDIR /code
RUN mix local.rebar --force
RUN mix local.hex --force
COPY mix.exs .
COPY mix.lock .
RUN mix deps.get

test-setup:
FROM +setup-base
ENV MIX_ENV=test
RUN mix deps.compile

lint-setup:
FROM +setup-base
RUN mix deps.compile
RUN mix dialyzer --plt

0 comments on commit 4061f11

Please sign in to comment.