Skip to content

Commit

Permalink
use Nix in GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Jun 16, 2024
1 parent 38caf56 commit 14ba177
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/[email protected]
with:
elixir-version: '1.16.3' # [Required] Define the Elixir version
otp-version: '25.0' # [Required] Define the Erlang/OTP version
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: install mix
run: nix develop -c mix local.hex
- name: Run flakes check
run: |
nix flake check
nix develop -c echo OK
- name: Install dependencies
run: mix deps.get
run: nix develop -c mix deps.get
# - name: Run Credo
# run: mix credo --strict
# - name: Retrieve PLT Cache
Expand All @@ -54,8 +58,8 @@ jobs:
# - name: Run dialyzer
# run: mix dialyzer --no-check --halt-exit-status
- name: Check Formatting
run: mix format --check-formatted
run: nix develop -c mix format --check-formatted
- name: Run tests
run: mix test
run: nix develop -c mix test
# - name: Build docs
# run: mix docs
13 changes: 7 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
erl = with pkgs; beam.packages.erlang_26;

# define packages to install with special handling for OSX
inputs = [
elixir
elixir-ls
libyaml
libyaml.dev
erl.elixir_1_16
erl.elixir-ls
pkgs.libyaml
pkgs.libyaml.dev
];

# define shell startup command
Expand All @@ -24,7 +25,7 @@ let
#alias pip="PIP_PREFIX='$(pwd)/_build/pip_packages' \pip"
#export PYTHONPATH="$(pwd)/_build/pip_packages/lib/python3.7/site-packages:$PYTHONPATH"

in mkShell {
in pkgs.mkShell {
buildInputs = inputs;
shellHook = hooks;
}

0 comments on commit 14ba177

Please sign in to comment.