Merge pull request #20 from NoRedInk/makefile-uncontroversial

add a Makefile, speed up CI
This commit is contained in:
Michael Glass 2018-03-28 13:28:48 +02:00 committed by GitHub
commit 23fd05e227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2619 additions and 18 deletions

View File

@ -1,8 +1,15 @@
sudo: false
language: node_js
node_js:
- node # latest stable
cache:
directories:
- tests/elm-stuff/build-artifacts
- node_modules
- elm-stuff
- tests/elm-stuff
- styleguide-app/elm-stuff
- sysconfcpus
before_install:
@ -16,20 +23,9 @@ before_install:
make && make install;
cd ..;
fi
install:
- npm install -g elm@0.18.0 elm-test elm-format@exp
- mv $(npm config get prefix)/bin/elm-make $(npm config get prefix)/bin/elm-make-old
- printf '%s\n\n' '#!/bin/bash' 'echo "Running elm-make with sysconfcpus -n 2"' '$TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-make-old "$@"' > $(npm config get prefix)/bin/elm-make
- chmod +x $(npm config get prefix)/bin/elm-make
- travis_retry elm-package install --yes
- cd tests
- npm install
- travis_retry elm-package install --yes
- cd ..
- travis_retry $TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 make -B setup
script:
# Check if all exposed modules compile.
- elm-package diff
- elm-format --validate src tests styleguide-app
- elm test
- cd styleguide-app && elm-make Main.elm --yes --output=elm.js
- $TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 make ci

45
Makefile Normal file
View File

@ -0,0 +1,45 @@
NPM_PREFIX=$(realpath .)/node_modules
PATH:=${NPM_PREFIX}/.bin:${PATH}
.PHONY: test
test: elm-stuff tests/elm-stuff node_modules
elm-test
.PHONY: diff
diff: node_modules
elm-package diff
.PHONY: format
format: node_modules
elm-format --validate src tests styleguide-app
.PHONY: clean
clean:
rm -rf node_modules styleguide-app/elm.js $(shell find . -type d -name 'elm-stuff')
styleguide-app/elm.js: styleguide-app/elm-stuff styleguide-app/**/*.elm
cd styleguide-app; elm-make Main.elm --output=$(@F)
# plumbing
node_modules: package.json
npm install
touch -m $@
.NOTPARALLEL: elm-stuff
elm-stuff: elm-package.json node_modules
elm-package install --yes
touch -m $@
.NOTPARALLEL: %/elm-stuff
%/elm-stuff: %/elm-package.json node_modules
cd $(@D); elm-package install --yes
touch -m $@
# special targets for travis, but anyone can use them, really.
.PHONY: setup
setup: node_modules elm-stuff tests/elm-stuff styleguide-app/elm-stuff
.PHONY: ci
ci: test format diff styleguide-app/elm.js

View File

@ -9,11 +9,23 @@ This repo contains an app showcasing all of these UI widgets.
To see them locally:
```
> cd styleguide-app
> elm-make Main.elm --output=elm.js
make styleguide-app/elm.js
```
Open `index.html` in your browser.
Open `styleguide-app/index.html` in your browser.
Alternatively, you may use elm-reactor. Please be aware that you'll need to globally
install fonts (in particular, Muli) if you go this route.
## Tests
Run tests with
```
make test
```
### CI (Travis)
Travis will run `make ci` to verify everything looks good.
You can run this locally to catch errors before you push!

2521
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "noredink-ui",
"version": "1.0.0",
"description": "UI widgets we use.",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/NoRedInk/NoRedInk-ui.git"
},
"author": "",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/NoRedInk/NoRedInk-ui/issues"
},
"homepage": "https://github.com/NoRedInk/NoRedInk-ui#readme",
"dependencies": {
"elm": "^0.18.0",
"elm-format": "^0.7.0-exp",
"elm-test": "^0.18.12"
}
}