Test in container (#52)

* Dockerfile for tests

* Show test coverage

* Removal of old test pipeline

Co-authored-by: Alex Sherman <yul.golem@gmail.com>
This commit is contained in:
Keijo Raamat 2021-09-30 13:21:02 +03:00 committed by GitHub
parent 07b6eb3bdb
commit 24b6c68682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 38 deletions

View file

@ -1,38 +0,0 @@
name: Erlang CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}}
strategy:
matrix:
otp: [21.3.8.17]
ruby: [2.6.3]
steps:
- uses: actions/checkout@v2.0.0
- uses: gleam-lang/setup-erlang@v1.1.2
with:
otp-version: ${{matrix.otp}}
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install rebar dependencies
run: rebar3 as test get-deps
- name: Integrated Ruby app setup
run: |
rebar3 as test get-deps
/bin/bash -l -c "cd apps/epp_proxy/priv/test_backend_app && bundle install"
- name: Run tests
run: |
/bin/bash -l -c "cd apps/epp_proxy/priv/test_backend_app && bundle exec rackup --pid pidfile -D"
rebar3 as test compile
DEBUG=1 rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true
rebar3 cover --verbose
# - run: rebar3 eunit

View file

@ -0,0 +1,33 @@
name: Proxy automated tests
on: [push]
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.0.0
- name: Build image for tests
run: docker build -t proxy-tester -f Dockerfile.test .
- name: Start the container
run: docker run -d --name tester proxy-tester
- name: Install rebar dependencies
run: docker exec -i tester rebar3 as test get-deps
- name: Integrated Ruby app setup
run: docker exec -d tester bash -l -c "cd apps/epp_proxy/priv/test_backend_app && bundle install && bundle exec rackup"
- name: Compile for tests
run: |
sleep 15
docker exec -i tester rebar3 as test compile
- name: Run tests
run: |
docker exec -i -e DEBUG=1 tester rebar3 ct --sys_config config/test.config --readable=false --cover --verbose=true
- name: Show test coverage
run: docker exec -i tester rebar3 cover --verbose

4
Dockerfile.test Normal file
View file

@ -0,0 +1,4 @@
FROM internetee/erlang-ruby:21.3.8-2.6.3
COPY . .
CMD ["tail", "-f" , "/dev/null"]