mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Run tests on all supported platforms
This commit is contained in:
parent
042075d1e8
commit
e89511aec8
11 changed files with 237 additions and 6 deletions
33
.github/workflows/continuous-integration.yml
vendored
33
.github/workflows/continuous-integration.yml
vendored
|
|
@ -1,11 +1,38 @@
|
||||||
---
|
---
|
||||||
name: Continuous Integration
|
name: Automated tests
|
||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test25mysql:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- run: bash -x script/cibuild
|
- run: bash -x script/cibuild 2.5 mysql
|
||||||
|
|
||||||
|
test26mysql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 mysql
|
||||||
|
|
||||||
|
test27mysql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.7 mysql
|
||||||
|
|
||||||
|
test26postgres:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 postgres
|
||||||
|
|
||||||
|
test26sqlite:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- run: bash -x script/cibuild 2.6 sqlite
|
||||||
|
|
||||||
|
# - run: bash -x script/cibuild 2.5 postgres
|
||||||
|
# - run: bash -x script/cibuild 2.7 postgres
|
||||||
|
|
|
||||||
30
Dockerfile-2.5
Normal file
30
Dockerfile-2.5
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
FROM ruby:2.5
|
||||||
|
|
||||||
|
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||||
|
RUN bundle config --global frozen 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN touch /etc/app-env
|
||||||
|
|
||||||
|
COPY Gemfile* /app/
|
||||||
|
RUN gem install bundler
|
||||||
|
RUN bundle install --jobs 4
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
RUN apt-get update && apt-get install -y yarn
|
||||||
|
|
||||||
|
RUN mkdir /app/log
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY config/database.docker.yml /app/config/database.yml
|
||||||
|
COPY config/site.docker.yml /app/config/site.yml
|
||||||
|
|
||||||
|
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
||||||
30
Dockerfile-2.7
Normal file
30
Dockerfile-2.7
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
FROM ruby:2.7
|
||||||
|
|
||||||
|
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||||
|
RUN bundle config --global frozen 1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN touch /etc/app-env
|
||||||
|
|
||||||
|
COPY Gemfile* /app/
|
||||||
|
RUN gem install bundler
|
||||||
|
RUN bundle install --jobs 4
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
RUN apt-get update && apt-get install -y yarn
|
||||||
|
|
||||||
|
RUN mkdir /app/log
|
||||||
|
|
||||||
|
COPY . /app/
|
||||||
|
COPY config/database.docker.yml /app/config/database.yml
|
||||||
|
COPY config/site.docker.yml /app/config/site.yml
|
||||||
|
|
||||||
|
RUN RAILS_ENV=production bundle exec rake assets:precompile
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/docker-entrypoint.sh"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["rails", "server", "-b", "0.0.0.0"]
|
||||||
2
Gemfile
2
Gemfile
|
|
@ -24,6 +24,7 @@ gem 'jquery-ui-rails' , '~>6.0.1'
|
||||||
# Alternatively use --without <group> arguments to bundler to not install that group
|
# Alternatively use --without <group> arguments to bundler to not install that group
|
||||||
gem "sqlite3", group: :sqlite
|
gem "sqlite3", group: :sqlite
|
||||||
gem "mysql2", "~> 0.5.3", group: :mysql
|
gem "mysql2", "~> 0.5.3", group: :mysql
|
||||||
|
gem "pg", "~> 1.2.3", group: :postgresql
|
||||||
|
|
||||||
gem "RedCloth"
|
gem "RedCloth"
|
||||||
gem "sanitize", "~> 5.2"
|
gem "sanitize", "~> 5.2"
|
||||||
|
|
@ -70,7 +71,6 @@ group :test do
|
||||||
gem 'rails-controller-testing'
|
gem 'rails-controller-testing'
|
||||||
gem 'rails-dom-testing', '~> 2.0.0'
|
gem 'rails-dom-testing', '~> 2.0.0'
|
||||||
|
|
||||||
|
|
||||||
gem "factory_bot_rails"
|
gem "factory_bot_rails"
|
||||||
gem "rspec-expectations"
|
gem "rspec-expectations"
|
||||||
gem "database_cleaner"
|
gem "database_cleaner"
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ GEM
|
||||||
parallel (1.19.2)
|
parallel (1.19.2)
|
||||||
parser (2.7.1.4)
|
parser (2.7.1.4)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
|
pg (1.2.3)
|
||||||
puma (4.3.5)
|
puma (4.3.5)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
|
|
@ -326,6 +327,7 @@ DEPENDENCIES
|
||||||
mocha
|
mocha
|
||||||
mysql2 (~> 0.5.3)
|
mysql2 (~> 0.5.3)
|
||||||
paperclip
|
paperclip
|
||||||
|
pg (~> 1.2.3)
|
||||||
puma (~> 4.3)
|
puma (~> 4.3)
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (~> 6.0.3)
|
rails (~> 6.0.3)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
docker_compose="docker-compose --file docker-compose.yml"
|
docker_compose="docker-compose --file test-envs/docker-compose-$1-$2.yml"
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
$docker_compose down
|
$docker_compose down
|
||||||
|
|
@ -25,6 +25,12 @@ script/poll-for-db
|
||||||
# Leaving this in since it will be needed for Rails 5
|
# Leaving this in since it will be needed for Rails 5
|
||||||
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
||||||
|
|
||||||
|
if [ "$2" == "mysql" ];
|
||||||
|
then
|
||||||
$docker_compose run web bin/rake db:reset
|
$docker_compose run web bin/rake db:reset
|
||||||
|
else
|
||||||
|
$docker_compose run web bin/rake db:migrate
|
||||||
|
$docker_compose run web bin/rake db:seed
|
||||||
|
fi
|
||||||
$docker_compose run web bin/rake test
|
$docker_compose run web bin/rake test
|
||||||
|
|
||||||
|
|
|
||||||
29
test-envs/docker-compose-2.5-mysql.yml
Normal file
29
test-envs/docker-compose-2.5-mysql.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile-2.5
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
29
test-envs/docker-compose-2.6-mysql.yml
Normal file
29
test-envs/docker-compose-2.6-mysql.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
32
test-envs/docker-compose-2.6-postgres.yml
Normal file
32
test-envs/docker-compose-2.6-postgres.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${DATABASE_NAME:-tracks}
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/postgresql/data
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: postgres
|
||||||
|
DATABASE_PASSWORD: password
|
||||||
|
DATABASE_TYPE: postgresql
|
||||||
|
DATABASE_ENCODING: unicode
|
||||||
|
DATABASE_PORT: 5432
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
17
test-envs/docker-compose-2.6-sqlite.yml
Normal file
17
test-envs/docker-compose-2.6-sqlite.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: "/app/db.sqlite"
|
||||||
|
DATABASE_TYPE: sqlite3
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
29
test-envs/docker-compose-2.7-mysql.yml
Normal file
29
test-envs/docker-compose-2.7-mysql.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_ALLOW_EMPTY_PASSWORD: 1
|
||||||
|
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/mysql
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: Dockerfile-2.7
|
||||||
|
environment:
|
||||||
|
# These are set in script/ci-build, so we need to pass-thru them.
|
||||||
|
RAILS_ENV: $RAILS_ENV
|
||||||
|
DATABASE_NAME: $DATABASE_NAME
|
||||||
|
DATABASE_USERNAME: root
|
||||||
|
DATABASE_PASSWORD_EMPTY: 1
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME:-..}:/app:Z
|
||||||
|
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
|
||||||
|
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
Loading…
Add table
Add a link
Reference in a new issue