Skip to content

Commit 125a6e5

Browse files
committed
Test the dummy gem on push:
- This is the only way to really make sure everything works and the CLI/GitHub actions works in coordination.
1 parent 5250a82 commit 125a6e5

File tree

6 files changed

+82
-9
lines changed

6 files changed

+82
-9
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: "Run a end to end test on the dummy gem"
2+
on: push
3+
jobs:
4+
compile:
5+
timeout-minutes: 20
6+
name: "Cross compile the gem on different ruby versions"
7+
strategy:
8+
matrix:
9+
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
10+
runs-on: "${{ matrix.os }}"
11+
steps:
12+
- name: "Checkout code"
13+
uses: "actions/checkout@v5"
14+
- name: "Setup Ruby"
15+
uses: "ruby/setup-ruby@v1"
16+
with:
17+
ruby-version: "3.0.7"
18+
bundler-cache: true
19+
working-directory: "test/fixtures/dummy_gem"
20+
- name: "Run easy compile"
21+
uses: "shopify-playground/edouard-playground/.github/actions/easy_compile@main"
22+
with:
23+
step: "compile"
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
working-directory: "test/fixtures/dummy_gem"
26+
test:
27+
timeout-minutes: 20
28+
name: "Run the test suite"
29+
needs: compile
30+
strategy:
31+
matrix:
32+
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
33+
rubies: ["3.4.7", "3.0.7"]
34+
type: ["cross", "native"]
35+
runs-on: "${{ matrix.os }}"
36+
steps:
37+
- name: "Checkout code"
38+
uses: "actions/checkout@v5"
39+
- name: "Setup Ruby"
40+
uses: "ruby/setup-ruby@v1"
41+
with:
42+
ruby-version: "${{ matrix.rubies }}"
43+
bundler-cache: true
44+
working-directory: "test/fixtures/dummy_gem"
45+
- name: "Run easy compile"
46+
uses: "shopify-playground/edouard-playground/.github/actions/easy_compile@main"
47+
with:
48+
step: "test_${{ matrix.type }}"
49+
token: ${{ secrets.GITHUB_TOKEN }} # TODO Remove this before publishing the gem
50+
working-directory: "test/fixtures/dummy_gem"
51+
install:
52+
timeout-minutes: 5
53+
name: "Verify the gem can be installed"
54+
needs: test
55+
strategy:
56+
matrix:
57+
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
58+
runs-on: "${{ matrix.os }}"
59+
steps:
60+
- name: "Setup Ruby"
61+
uses: "ruby/setup-ruby@v1"
62+
with:
63+
ruby-version: "3.4.7"
64+
- name: "Run easy compile"
65+
uses: "shopify-playground/edouard-playground/.github/actions/easy_compile@main"
66+
with:
67+
token: ${{ secrets.GITHUB_TOKEN }} # TODO Remove this before publishing the gem
68+
step: "install"

Rakefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# frozen_string_literal: true
22

33
require "bundler/gem_tasks"
4-
require "minitest/test_task"
54

6-
Minitest::TestTask.create do |t|
7-
t.test_globs = ["test/**/*_test.rb"]
5+
begin
6+
require "minitest/test_task"
7+
8+
Minitest::TestTask.create do |t|
9+
t.test_globs = ["test/**/*_test.rb"]
10+
end
11+
rescue LoadError
12+
# This begin/rescue is temporary. The gem isn't pusblished to RubyGems so to install
13+
# it the GitHub action clones the repo and runs `rake install`, without running a `bundle install` first.
814
end
915

1016
task default: :test

test/cli_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_print_ruby_cc_version
115115
end
116116
end
117117

118-
assert_equal("3.4.6:3.3.8:3.2.8", out)
118+
assert_equal("3.4.6:3.3.8:3.2.8:3.1.6:3.0.6", out)
119119
end
120120
end
121121
end

test/fixtures/dummy_gem/dummy_gem.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Gem::Specification.new do |spec|
1212
spec.description = "Don't use it, really."
1313
spec.homepage = "https://example.com"
1414
spec.license = "MIT"
15-
spec.required_ruby_version = ">= 3.2.0"
1615

1716
spec.metadata["allowed_push_host"] = "https://rubygems.org"
1817
spec.metadata["homepage_uri"] = spec.homepage

test/fixtures/expected_github_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: "Setup Ruby"
2222
uses: "ruby/setup-ruby@v1"
2323
with:
24-
ruby-version: "3.2.9"
24+
ruby-version: "3.0.7"
2525
bundler-cache: true
2626
- name: "Run easy compile"
2727
uses: "shopify-playground/edouard-playground/.github/actions/easy_compile@main"
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: ["macos-latest", "ubuntu-latest"]
38-
rubies: ["3.4.7", "3.3.9", "3.2.9"]
38+
rubies: ["3.4.7", "3.3.9", "3.2.9", "3.1.7", "3.0.7"]
3939
type: ["cross", "native"]
4040
runs-on: "${{ matrix.os }}"
4141
steps:

test/fixtures/expected_github_workflow_working_dir.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: "Setup Ruby"
2222
uses: "ruby/setup-ruby@v1"
2323
with:
24-
ruby-version: "3.2.9"
24+
ruby-version: "3.0.7"
2525
bundler-cache: true
2626
working-directory: "test/fixtures/date"
2727
- name: "Run easy compile"
@@ -37,7 +37,7 @@ jobs:
3737
strategy:
3838
matrix:
3939
os: ["macos-latest", "ubuntu-latest"]
40-
rubies: ["3.4.7", "3.3.9", "3.2.9"]
40+
rubies: ["3.4.7", "3.3.9", "3.2.9", "3.1.7", "3.0.7"]
4141
type: ["cross", "native"]
4242
runs-on: "${{ matrix.os }}"
4343
steps:

0 commit comments

Comments
 (0)