-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from andrei-mihaila/master
Small performance improvements, docs updates
- Loading branch information
Showing
9 changed files
with
150 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test on a few operating systems | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test-on-ubuntu: | ||
name: Test on Ubuntu | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: test/run.sh | ||
|
||
test-on-mac: | ||
name: Test on MacOS | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: brew install erlang make | ||
- run: PATH="$(brew --prefix)/opt/make/libexec/gnubin:$PATH" test/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ ebin | |
rel/example_project | ||
.concrete/DEV_MODE | ||
.rebar | ||
test/test.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env sh | ||
|
||
if [ ! -x $ELVIS_REBAR3 ] && [ -z "$(command -v $ELVIS_REBAR3)" ]; then | ||
mkdir -p "$ELVIS_BUILD_DIR" | ||
echo "Downloading Rebar3 from: "$ELVIS_REBAR3_URL | ||
curl -sLfo "$ELVIS_BUILD_DIR/rebar3" "$ELVIS_REBAR3_URL" | ||
chmod +x "$ELVIS_BUILD_DIR/rebar3" | ||
"$ELVIS_BUILD_DIR/rebar3" $@ | ||
else | ||
echo "Using Rebar3: "$ELVIS_REBAR3 | ||
"$ELVIS_REBAR3" $@ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PROJECT = test | ||
PROJECT_DESCRIPTION = Test project | ||
PROJECT_VERSION = 0.1.0 | ||
|
||
include erlang.mk | ||
include ../plugins.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
fail() { | ||
echo -e "\033[31mError: $1\033[0m" | ||
exit 1 | ||
} | ||
|
||
prepare_test() { | ||
rm -rf _build elvis elvis.config out.log | ||
echo -e "--- \033[32mTest: $1 \033[0m ---" | ||
} | ||
|
||
cleanup() { | ||
rm -f rebar3 erlang.mk elvis elvis.config out.log | ||
rm -rf _build .erlang.mk | ||
} | ||
|
||
finished_test() { | ||
echo -e "--- \033[32mTest passed\033[0m ---" | ||
} | ||
|
||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null | ||
|
||
cleanup | ||
|
||
echo "Preparing ..." | ||
echo -n "Downloading Erlang.mk ..." | ||
curl -sLfo erlang.mk https://erlang.mk/erlang.mk | ||
echo " OK" | ||
|
||
echo -n "Downloading Rebar3 ..." | ||
curl -sLfo rebar3 https://s3.amazonaws.com/rebar3/rebar3 | ||
chmod a+x rebar3 | ||
echo " OK" | ||
|
||
echo "Doing the initial make ..." | ||
make > /dev/null | ||
|
||
prepare_test "Local rebar3, no build dir, no elvis.config" | ||
ELVIS_REBAR3=$(pwd)/rebar3 make elvis || fail "make failed, exit code $?" | ||
|
||
[ -x elvis ] || fail "Elvis executable not found" | ||
[ -f elvis.config ] || fail "elvis.config not found" | ||
[ -e _build ] && fail "build dir ('_build') not removed" | ||
|
||
cp test-elvis.config elvis.config | ||
make elvis > out.log 2>&1 || fail "Elvis rock failed, exit code $?" | ||
[ ! -s out.log ] || (echo "--- out.log ---" && \ | ||
cat out.log && \ | ||
echo "---" && \ | ||
fail "Elvis rock output (out.log) not empty") | ||
finished_test | ||
|
||
prepare_test "Remote rebar3, existing build dir, existing elvis.config" | ||
mkdir -p _build/existing | ||
export ELVIS_REBAR3=not-to-be-found | ||
rm rebar3 | ||
cp test-elvis.config elvis.config | ||
|
||
make elvis || fail "make failed, exit code $?" | ||
|
||
[ -x elvis ] || fail "Elvis executable not found" | ||
cmp --silent test-elvis.config elvis.config || fail "elvis.config was overwritten" | ||
[ -e _build ] || fail "build dir ('_build') removed" | ||
|
||
make elvis > out.log 2>&1 || fail "Elvis rock failed, exit code $?" | ||
[ ! -s out.log ] || (echo "--- out.log ---" && \ | ||
cat out.log && \ | ||
echo "---" && \ | ||
fail "Elvis rock output (out.log) not empty") | ||
finished_test | ||
|
||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
elvis, | ||
[ | ||
{config, [ | ||
#{ | ||
dirs => ["."], | ||
filter => "elvis.config", | ||
ruleset => elvis_config | ||
} | ||
]} | ||
] | ||
} | ||
]. |