From 9f7803bc078d7538d6c467ce19e44d91c4410d6d Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 13 Oct 2023 17:15:04 -0500 Subject: [PATCH 1/4] chore(ci): Update the Ruby versions for CI 2.7 is EOL and 3.1 and 3.2 are new. --- .github/workflows/continuous-integration.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f66ed13c1..a06c56a42 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -6,13 +6,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ["2.7", "3.0"] + ruby: ["3.0", "3.1", "3.2"] db: [sqlite, mysql, postgres] - exclude: - - ruby: "2.6" - db: sqlite - - ruby: "2.6" - db: postgres steps: - uses: actions/checkout@v1 From e837060474cbe59e18bc240bce187f401edbfd50 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 18 Oct 2023 10:22:04 -0500 Subject: [PATCH 2/4] chore(ci): Add test envs for Ruby 3.1 --- Dockerfile-3.1 | 30 +++++++++++++++++++++ test-envs/docker-compose-3.1-mysql.yml | 29 ++++++++++++++++++++ test-envs/docker-compose-3.1-postgres.yml | 32 +++++++++++++++++++++++ test-envs/docker-compose-3.1-sqlite.yml | 17 ++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 Dockerfile-3.1 create mode 100644 test-envs/docker-compose-3.1-mysql.yml create mode 100644 test-envs/docker-compose-3.1-postgres.yml create mode 100644 test-envs/docker-compose-3.1-sqlite.yml 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.1-postgres.yml b/test-envs/docker-compose-3.1-postgres.yml new file mode 100644 index 000000000..8c8267279 --- /dev/null +++ b/test-envs/docker-compose-3.1-postgres.yml @@ -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-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: 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: diff --git a/test-envs/docker-compose-3.1-sqlite.yml b/test-envs/docker-compose-3.1-sqlite.yml new file mode 100644 index 000000000..925c1bc36 --- /dev/null +++ b/test-envs/docker-compose-3.1-sqlite.yml @@ -0,0 +1,17 @@ +version: '3' +services: + 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: "/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 From 9dfa745f454797c9a1030a0e7152b52f6286d132 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 18 Oct 2023 10:22:54 -0500 Subject: [PATCH 3/4] chore(ci): Add test envs for Ruby 3.2 --- Dockerfile-3.2 | 30 +++++++++++++++++++++ test-envs/docker-compose-3.2-mysql.yml | 29 ++++++++++++++++++++ test-envs/docker-compose-3.2-postgres.yml | 32 +++++++++++++++++++++++ test-envs/docker-compose-3.2-sqlite.yml | 17 ++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 Dockerfile-3.2 create mode 100644 test-envs/docker-compose-3.2-mysql.yml create mode 100644 test-envs/docker-compose-3.2-postgres.yml create mode 100644 test-envs/docker-compose-3.2-sqlite.yml diff --git a/Dockerfile-3.2 b/Dockerfile-3.2 new file mode 100644 index 000000000..0e143fd71 --- /dev/null +++ b/Dockerfile-3.2 @@ -0,0 +1,30 @@ +FROM ruby:3.2 + +# 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.2-mysql.yml b/test-envs/docker-compose-3.2-mysql.yml new file mode 100644 index 000000000..48b2e6d9b --- /dev/null +++ b/test-envs/docker-compose-3.2-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.2 + 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.2-postgres.yml b/test-envs/docker-compose-3.2-postgres.yml new file mode 100644 index 000000000..16711e2d7 --- /dev/null +++ b/test-envs/docker-compose-3.2-postgres.yml @@ -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-3.2 + 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: diff --git a/test-envs/docker-compose-3.2-sqlite.yml b/test-envs/docker-compose-3.2-sqlite.yml new file mode 100644 index 000000000..47a2e7e08 --- /dev/null +++ b/test-envs/docker-compose-3.2-sqlite.yml @@ -0,0 +1,17 @@ +version: '3' +services: + web: + build: + context: .. + dockerfile: Dockerfile-3.2 + 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 From a71282404696b51a981db1b75939366d3da6a9a1 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 18 Oct 2023 10:24:36 -0500 Subject: [PATCH 4/4] chore(ci): Remove leftover Ruby 2.6 cruft --- Dockerfile-2.6 | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 Dockerfile-2.6 diff --git a/Dockerfile-2.6 b/Dockerfile-2.6 deleted file mode 100644 index ee5f7de3f..000000000 --- a/Dockerfile-2.6 +++ /dev/null @@ -1,30 +0,0 @@ -FROM ruby:2.6 - -# 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"]