summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Wininger <fw.centrale@gmail.com>2022-04-12 11:12:59 +0200
committerFlorian Wininger <fw.centrale@gmail.com>2022-04-12 11:30:51 +0200
commit26a40fe7505046298256c91c470cdb9c02979b85 (patch)
tree42758418dc662b07fdb158d47ae041267bab9973
parent8643e4e5bfa8051a6c89211c78c2c7df5901dacd (diff)
downloadnet-ssh-26a40fe7505046298256c91c470cdb9c02979b85.tar.gz
Run test with docker
-rw-r--r--.dockerignore6
-rw-r--r--.github/workflows/ci-with-docker.yml30
-rw-r--r--Dockerfile16
-rw-r--r--docker-compose.yml23
4 files changed, 75 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..080bf72
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+# Remove Git
+.git/
+.gitignore
+
+docker-compose.yml
+README.md
diff --git a/.github/workflows/ci-with-docker.yml b/.github/workflows/ci-with-docker.yml
new file mode 100644
index 0000000..ceab927
--- /dev/null
+++ b/.github/workflows/ci-with-docker.yml
@@ -0,0 +1,30 @@
+name: Test
+on:
+ pull_request:
+ push: { branches: master }
+
+jobs:
+ test:
+ name: Run test suite with docker
+ runs-on: ubuntu-latest
+ env:
+ COMPOSE_FILE: docker-compose.yml
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Build docker images
+ run: docker-compose build
+
+ - name: Run ruby 2.6
+ run: docker-compose run ruby-2.6
+
+ - name: Run ruby 2.7
+ run: docker-compose run ruby-2.7
+
+ - name: Run ruby 3.0
+ run: docker-compose run ruby-3.0
+
+ - name: Run ruby 3.1
+ run: docker-compose run ruby-3.1
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ead5bfa
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
+ARG RUBY_VERSION=3.1
+FROM ruby:${RUBY_VERSION}
+
+ENV INSTALL_PATH="/netssh"
+
+WORKDIR $INSTALL_PATH
+
+COPY Gemfile net-ssh.gemspec $INSTALL_PATH/
+
+COPY lib/net/ssh/version.rb $INSTALL_PATH/lib/net/ssh/version.rb
+
+RUN gem install bundler && bundle install
+
+COPY . $INSTALL_PATH/
+
+CMD rake test
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..54a5618
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3'
+
+services:
+ ruby-3.1:
+ build:
+ context: .
+ args:
+ RUBY_VERSION: 3.1
+ ruby-3.0:
+ build:
+ context: .
+ args:
+ RUBY_VERSION: 3.0
+ ruby-2.7:
+ build:
+ context: .
+ args:
+ RUBY_VERSION: 2.7
+ ruby-2.6:
+ build:
+ context: .
+ args:
+ RUBY_VERSION: 2.6