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 112408c
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 3 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
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 25.0.4
elixir 1.14.0-otp-25
erlang 26.2.1
elixir 1.16.1-otp-26
46 changes: 46 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
VERSION 0.8
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 git config --global init.defaultBranch "master"
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "CI"
RUN MIX_ENV=test mix compile
WITH DOCKER
RUN mix test
END

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
2 changes: 1 addition & 1 deletion lib/benchmarking.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ defmodule Benchmarking do
def process(%{repositories_file: repositories_file, results_headers: results_headers} = settings) do
repositories_file
|> Path.expand()
|> File.stream!([read_ahead: 100_000], 1000)
|> File.stream!(1000, read_ahead: 100_000)
|> CSV.decode!(headers: true)
|> Stream.flat_map(fn %{"url" => url, "ref" => ref, "submission-id" => id} ->
url
Expand Down

0 comments on commit 112408c

Please sign in to comment.