Skip to content

Commit

Permalink
test: integration test for mneme.install in an empty project
Browse files Browse the repository at this point in the history
  • Loading branch information
zachallaun committed Oct 28, 2024
1 parent 543a25b commit a593659
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '**'
jobs:
lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
MIX_ENV: dev
strategy:
Expand All @@ -15,7 +15,7 @@ jobs:
elixir: [1.17]
otp: [27]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Elixir
id: beam
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
run: MIX_ENV=dev mix dialyzer --format github

test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
Expand All @@ -82,7 +82,7 @@ jobs:
- elixir: 1.16
otp: 27
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
Expand All @@ -109,3 +109,21 @@ jobs:
- run: mix test

- run: mix test.mneme_not_started

integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: inotify-tools
version: 1.0

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: 1.17.3
otp-version: 27.1.2

- run: bin/integration-test-mneme-install.sh
29 changes: 29 additions & 0 deletions bin/integration-test-mneme-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# exit if a variable is undefined, a command files, or a command in a pipeline fails
set -ueo pipefail

# ensure mix igniter.new is available
mix help | grep "mix igniter.new" >/dev/null || mix archive.install hex igniter_new --force

mkdir -p tmp
cd tmp
rm -rf test_mneme_install

mix igniter.new test_mneme_install --install mneme@path:../.. --yes

cd test_mneme_install

cat <<EOF >test_mneme_install_test.exs
defmodule TestMnemeInstallTest do
use ExUnit.Case
use Mneme
test "succeeds if Mneme was installed properly" do
auto_assert 1 <- 1
end
end
EOF

mix mneme.watch --exit-on-success
exit $?

0 comments on commit a593659

Please sign in to comment.