Skip to content

Commit

Permalink
Add crude image testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Jul 3, 2024
1 parent 2c69dfc commit a9bd8eb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ jobs:
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --load --platform linux/x86_64 -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
- name: Test single-arch image (x86_64)
run: |
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'true'
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} ruby -e 'puts RUBY_DESCRIPTION'
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} gem --version
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} bundle --version
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} -v "${PWD}":"${PWD}" -w "${PWD}" /bin/sh -c 'bundle install && ruby test/engines/test_encoding.rb'
# Then, build image for aarch64 which, being emulated under qemu, is slower
#
Expand All @@ -102,9 +104,11 @@ jobs:
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --load --platform linux/aarch64 -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
- name: Test single-arch image (aarch64)
run: |
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'true'
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} ruby -e 'puts RUBY_DESCRIPTION'
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} gem --version
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} bundle --version
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} -v "${PWD}":"${PWD}" -w "${PWD}" /bin/sh -c 'bundle install && ruby test/engines/test_encoding.rb'
# Finally, assemble multi-arch image for a combined push to the registry
#
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'minitest'
13 changes: 13 additions & 0 deletions test/engines/test_encoding.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'minitest/autorun'

class TestEncoding < Minitest::Test
def test_utf8
assert_equal("".encoding, Encoding::UTF_8)
end

def test_read_utf8
contents = File.read('test/fixtures/encoding/utf-8.txt')
assert_equal(contents.encoding, Encoding::UTF_8)
assert_equal(contents, "\u2705\n")
end
end
1 change: 1 addition & 0 deletions test/fixtures/encoding/utf-8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit a9bd8eb

Please sign in to comment.