mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-23 05:47:53 +00:00
feat: add docker for local tests
This commit is contained in:
parent
ce02022ac7
commit
ef0a908144
3 changed files with 69 additions and 0 deletions
32
.docker-test
Normal file
32
.docker-test
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ruby_version=${1:-2.4.2}
|
||||||
|
|
||||||
|
if ! rvm use ruby-${ruby_version} &>/dev/null ; then
|
||||||
|
echo "The ruby version '${ruby_version}' doesn't exist!"
|
||||||
|
echo "Available versions are:"
|
||||||
|
rvm list rubies strings | cut -d '-' -f2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '# ---------------------------------'
|
||||||
|
echo "# Use ruby version: ${ruby_version}"
|
||||||
|
echo '# ---------------------------------'
|
||||||
|
|
||||||
|
cp -r /mpw ~/mpw
|
||||||
|
cd ~/mpw
|
||||||
|
gem install bundler --no-ri --no-rdoc
|
||||||
|
bundle install
|
||||||
|
gem build mpw.gemspec
|
||||||
|
gem install mpw-$(cat VERSION).gem
|
||||||
|
cp -a /dev/urandom /dev/random
|
||||||
|
|
||||||
|
rubocop
|
||||||
|
ruby ./test/init.rb
|
||||||
|
ruby ./test/test_config.rb
|
||||||
|
ruby ./test/test_item.rb
|
||||||
|
ruby ./test/test_mpw.rb
|
||||||
|
ruby ./test/test_translate.rb
|
||||||
|
ruby ./test/init.rb
|
||||||
|
ruby ./test/test_cli.rb
|
||||||
|
ruby ./test/test_import.rb
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
FROM debian:stretch
|
||||||
|
MAINTAINER Adrien Waksberg "mpw@yae.im"
|
||||||
|
|
||||||
|
RUN apt update
|
||||||
|
RUN apt dist-upgrade -y
|
||||||
|
|
||||||
|
RUN apt install -y procps gnupg1 curl git
|
||||||
|
RUN ln -snvf /usr/bin/gpg1 /usr/bin/gpg
|
||||||
|
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
||||||
|
RUN curl -sSL https://get.rvm.io | bash -s stable
|
||||||
|
RUN echo 'source "/usr/local/rvm/scripts/rvm"' >> /etc/bash.bashrc
|
||||||
|
|
||||||
|
run apt install -y patch bzip2 gawk g++ gcc make libc6-dev patch zlib1g-dev libyaml-dev libsqlite3-dev \
|
||||||
|
sqlite3 autoconf libgmp-dev libgdbm-dev libncurses5-dev automake libtool bison \
|
||||||
|
pkg-config libffi-dev libgmp-dev libreadline-dev libssl-dev
|
||||||
|
|
||||||
|
RUN /bin/bash -l -c "rvm install 2.4.2"
|
||||||
|
RUN /bin/bash -l -c "rvm install 2.3.5"
|
||||||
|
RUN /bin/bash -l -c "rvm install 2.2.8"
|
||||||
|
RUN /bin/bash -l -c "rvm install 2.1.10"
|
17
README.md
17
README.md
|
@ -161,3 +161,20 @@ Configuration
|
||||||
password_length | 16
|
password_length | 16
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Don't run the tests on your local machine, you risk to lost your datas.
|
||||||
|
|
||||||
|
### Test on local machine with docker
|
||||||
|
|
||||||
|
* install [docker](https://docs.docker.com/engine/installation/)
|
||||||
|
* build the container
|
||||||
|
```
|
||||||
|
docker build -t mpw/debian:stretch -f Dockerfile .
|
||||||
|
```
|
||||||
|
* run the tests
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -v $(pwd):/mpw:ro -it mpw/debian:stretch /bin/bash -l /mpw/.docker-test
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue