Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: introduce CI #6

Merged
merged 17 commits into from
Feb 9, 2024
107 changes: 107 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI
on:
pull_request:
push:
branches: main

jobs:
repos:
runs-on: ubuntu-latest
name: Repos

strategy:
fail-fast: false
matrix:
repo:
- elixir-lang/elixir
- elixir-ecto/ecto
- elixir-ecto/ecto_sql
- phoenixframework/phoenix
- phoenixframework/phoenix_live_view
- elixir-tools/next-ls
- elixir-tools/gen_lsp
- michalmuskala/jason
- beam-telemetry/telemetry
- elixir-plug/plug
- ericmj/decimal
- elixir-gettext/gettext
- rrrene/credo
- wojtekmac/req
- bitwalker/timex
- mtrudel/bandit
- witchcrafters/witchcraft
- witchcrafters/type_class
- witchcrafters/quark
- oestrich/aino
- sorentwo/oban

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-

- name: Install Dependencies
run: nix develop --command bash -c "mix deps.get"
- name: Clone
env:
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ matrix.repo }} proj

- name: Test
run: |
nix develop --command bash -c "bin/ci ./proj"

test:
runs-on: ubuntu-latest
name: Tests

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-

- name: Install Dependencies
run: nix develop --command bash -c "mix deps.get"

- name: Run Formatter
run: nix develop --command bash -c "mix test"

formatter:
runs-on: ubuntu-latest
name: Formatter

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ hashFiles('**/.mise.toml') }}-

- name: Install Dependencies
run: nix develop --command bash -c "mix deps.get"

- name: Run Formatter
run: nix develop --command bash -c "mix format --check-formatted"

36 changes: 25 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 33 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
description = "spitfire";

inputs = {
beam-flakes = {
url = "github:shanesveller/nix-beam-flakes";
inputs.flake-parts.follows = "flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
};
beam-flakes.url = "github:shanesveller/nix-beam-flakes";
beam-flakes.inputs.flake-parts.follows = "flake-parts";
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
Expand All @@ -21,18 +18,43 @@

systems = ["aarch64-darwin" "x86_64-darwin" "x86_64-linux"];

perSystem = _: {
perSystem = {
config,
pkgs,
...
}: {
beamWorkspace = {
enable = true;
devShell = {
languageServers.elixir = false;
languageServers.erlang = false;
devShell.languageServers.elixir = false;
devShell.languageServers.erlang = false;
flakePackages = true;
pkgSet = let
# Provide your desired OTP version here
# erlang = pkgs.beam.interpreters.erlang_26;
erlang = beam-flakes.lib.mkErlang pkgs "26.2.1" beam-flakes.lib.versions.erlang."26.2.1";
in
(pkgs.beam.packagesWith erlang).extend (final: prev: {
elixir_1_17 = prev.elixir_1_16.override {
rev = "52eaf1456182d5d6cce22a4f5c3f6ec9f4dcbfd9";
# You can discover this using Trust On First Use by filling in `lib.fakeHash`
sha256 = "sha256-fOsV+jVIzsa38hQDvAjhUqee36nt8kG6AOpOQJnSZ74=";
version = "1.17.0-dev";
};

elixir = final.elixir_1_17;
# This will get upstreamed into nix-beam-flakes at some point
rebar = prev.rebar.overrideAttrs (_old: {doCheck = false;});
rebar3 = prev.rebar3.overrideAttrs (_old: {doCheck = false;});
});
packages = {
inherit (config.beamWorkspace.pkgSet) elixir erlang elixir-ls erlang-ls;
};
versions = {
elixir = "1.16.1";
erlang = "26.2.1";
elixir = null;
erlang = null;
};
};
};
};
}

Loading