Skip to content

Commit

Permalink
Support Redmine 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hidakatsuya committed Aug 14, 2024
1 parent f8b9940 commit 225e56b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
31 changes: 27 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ on:
pull_request:

jobs:
build:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
Expand All @@ -22,8 +21,32 @@ jobs:
- name: Lint
run: bundle exec rake standard

integration_test:
runs-on: ubuntu-latest

needs: test

strategy:
matrix:
include:
- ruby_version: "3.3"
redmine_branch_name: "master"

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true

- name: Set up test
run: bundle exec rake rexer:test:build_integration_test_image
env:
RUBY_VERSION: ${{ matrix.ruby_version }}
REDMINE_BRANCH_NAME: ${{ matrix.redmine_branch_name }}

- name: Run tests
run: bundle exec rake test
- name: Run integration tests
run: bundle exec rake test:integration
env:
RUBY_VERSION: ${{ matrix.ruby_version }}
REDMINE_BRANCH_NAME: ${{ matrix.redmine_branch_name }}
16 changes: 13 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ require "bundler/gem_tasks"
require "rake/testtask"
require "standard/rake"

Rake::TestTask.new(:test) do |t|
Rake::TestTask.new("test:integration") do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
t.test_files = FileList["test/integration/**/*_test.rb"]
t.warning = false
end

Expand All @@ -15,7 +15,17 @@ namespace :rexer do
namespace :test do
desc "Build the integration test image"
task :build_integration_test_image do
system "docker build -f test/integration/Dockerfile -t rexer-test .", exception: true
ruby_version = ENV["RUBY_VERSION"] || "3.3"
redmine_branch_name = ENV["REDMINE_BRANCH_NAME"] || "master"

image_tag = "rexer-test:#{ruby_version}-#{redmine_branch_name}"

system(<<~CMD, exception: true)
docker build -f test/integration/Dockerfile \
--build-arg RUBY_VERSION=#{ruby_version} \
--build-arg REDMINE_BRANCH_NAME=#{redmine_branch_name} \
-t #{image_tag} .
CMD
end
end
end
4 changes: 3 additions & 1 deletion test/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ ARG RUBY_VERSION=3.3

FROM ruby:$RUBY_VERSION

ARG REDMINE_BRANCH_NAME=master

RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -52,7 +54,7 @@ RUN git init && \
# Redmine
#
WORKDIR /redmine
RUN git clone --depth 1 https://github.com/redmine/redmine.git .
RUN git clone -b $REDMINE_BRANCH_NAME --depth 1 https://github.com/redmine/redmine.git .
COPY test/integration/docker/database.yml config/database.yml

# Directory for the bundle cache
Expand Down

0 comments on commit 225e56b

Please sign in to comment.