Skip to content

Commit 4c1b6ef

Browse files
committed
Fix basic image tests and add them to CI
1 parent 722260c commit 4c1b6ef

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ jobs:
7474
bundle exec rake clean clobber
7575
bundle exec rake gem:${PLATFORM}
7676
77+
- name: Basic tests on the generated image
78+
env:
79+
TEST_PLATFORM: ${{ matrix.platform }}
80+
run: |
81+
bundle exec rake test
82+
7783
- name: Upload binary gem
7884
uses: actions/upload-artifact@v3
7985
with:

test/test_environment_variables.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
class TestEnvironmentVariables
1010
module Common
11-
IMAGE_NAME = "larskanis/rake-compiler-dock-mri-x86-mingw32:#{RakeCompilerDock::IMAGE_VERSION}"
11+
TEST_PLATFORM = ENV["TEST_PLATFORM"] || "x64-mingw-ucrt"
12+
DOCKERHUB_USER = ENV['DOCKERHUB_USER'] || "larskanis"
13+
TEST_IMAGE_NAME = "#{DOCKERHUB_USER}/rake-compiler-dock-mri-#{TEST_PLATFORM}:#{RakeCompilerDock::IMAGE_VERSION}"
1214

1315
def rcd_env
1416
self.class.instance_variable_get("@rcd_env") || begin
@@ -49,7 +51,7 @@ class UsingWrapper < Test::Unit::TestCase
4951

5052
def invocation(command)
5153
idir = File.join(File.dirname(__FILE__), '../lib')
52-
"#{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock bash -c '#{command}'"
54+
"RCD_PLATFORM=#{TEST_PLATFORM} #{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock bash -c '#{command}'"
5355
end
5456

5557
def test_HOST_RUBY_PLATFORM
@@ -61,7 +63,7 @@ def test_HOST_RUBY_VERSION
6163
end
6264

6365
def test_IMAGE
64-
assert_equal IMAGE_NAME, rcd_env['RCD_IMAGE']
66+
assert_equal TEST_IMAGE_NAME, rcd_env['RCD_IMAGE']
6567
end
6668

6769
def test_PWD
@@ -73,7 +75,7 @@ class AsIfContinuousIntegration < Test::Unit::TestCase
7375
include Common
7476

7577
def invocation(command)
76-
"docker run -it #{IMAGE_NAME} bash -c '#{command}'"
78+
"docker run -it #{TEST_IMAGE_NAME} bash -c '#{command}'"
7779
end
7880
end
7981
end

test/test_parallel_docker_build.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ def test_common_files
6565
end
6666

6767
def read_df(fn)
68-
File.read("tmp/docker/#{fn}").each_line.map(&:lstrip).join
68+
File.read(File.join(@tmpdir, "/tmp/docker", fn)).each_line.map(&:lstrip).join
6969
end
7070
end

0 commit comments

Comments
 (0)