From f0ec2bc1f0c5c9f8eedefe8c62dcf4270b1b1f3d Mon Sep 17 00:00:00 2001 From: Jyri-Petteri Paloposki Date: Tue, 4 Jan 2022 00:34:14 +0200 Subject: [PATCH] Test for Ruby 3.1 --- .github/workflows/continuous-integration.yml | 6 ++-- Dockerfile-3.1 | 30 +++++++++++++++++++ test-envs/docker-compose-3.1-mysql.yml | 29 ++++++++++++++++++ ...es.yml => docker-compose-3.1-postgres.yml} | 2 +- ...lite.yml => docker-compose-3.1-sqlite.yml} | 2 +- 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 Dockerfile-3.1 create mode 100644 test-envs/docker-compose-3.1-mysql.yml rename test-envs/{docker-compose-3.0-postgres.yml => docker-compose-3.1-postgres.yml} (96%) rename test-envs/{docker-compose-3.0-sqlite.yml => docker-compose-3.1-sqlite.yml} (93%) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f66ed13c1..61bfa2f07 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -6,12 +6,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ["2.7", "3.0"] + ruby: ["2.7", "3.0", "3.1"] db: [sqlite, mysql, postgres] exclude: - - ruby: "2.6" + - ruby: "3.0" db: sqlite - - ruby: "2.6" + - ruby: "3.0" db: postgres steps: diff --git a/Dockerfile-3.1 b/Dockerfile-3.1 new file mode 100644 index 000000000..13ee22a20 --- /dev/null +++ b/Dockerfile-3.1 @@ -0,0 +1,30 @@ +FROM ruby:3.1 + +# throw errors if Gemfile has been modified since Gemfile.lock +RUN bundle config --global frozen 1 + +WORKDIR /app + +RUN touch /etc/app-env + +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 + +COPY Gemfile* /app/ +RUN gem install bundler +RUN bundle install --jobs 4 + +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"] diff --git a/test-envs/docker-compose-3.1-mysql.yml b/test-envs/docker-compose-3.1-mysql.yml new file mode 100644 index 000000000..03f609e5d --- /dev/null +++ b/test-envs/docker-compose-3.1-mysql.yml @@ -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-3.1 + 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: diff --git a/test-envs/docker-compose-3.0-postgres.yml b/test-envs/docker-compose-3.1-postgres.yml similarity index 96% rename from test-envs/docker-compose-3.0-postgres.yml rename to test-envs/docker-compose-3.1-postgres.yml index 0c6d9b03e..8c8267279 100644 --- a/test-envs/docker-compose-3.0-postgres.yml +++ b/test-envs/docker-compose-3.1-postgres.yml @@ -10,7 +10,7 @@ services: web: build: context: .. - dockerfile: Dockerfile-3.0 + dockerfile: Dockerfile-3.1 environment: # These are set in script/ci-build, so we need to pass-thru them. RAILS_ENV: $RAILS_ENV diff --git a/test-envs/docker-compose-3.0-sqlite.yml b/test-envs/docker-compose-3.1-sqlite.yml similarity index 93% rename from test-envs/docker-compose-3.0-sqlite.yml rename to test-envs/docker-compose-3.1-sqlite.yml index ba4d37094..925c1bc36 100644 --- a/test-envs/docker-compose-3.0-sqlite.yml +++ b/test-envs/docker-compose-3.1-sqlite.yml @@ -3,7 +3,7 @@ services: web: build: context: .. - dockerfile: Dockerfile-3.0 + dockerfile: Dockerfile-3.1 environment: # These are set in script/ci-build, so we need to pass-thru them. RAILS_ENV: $RAILS_ENV