Skip to content

Commit 0bcbe40

Browse files
authored
Merge pull request edgecase#48 from edgecase/ts/ci
Add initial GHA workflows
2 parents ec0ae9d + 9687825 commit 0bcbe40

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.github/workflows/ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
on: [push]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout code
8+
uses: actions/checkout@v3
9+
10+
- name: Install Ruby!
11+
uses: ruby/setup-ruby@v1
12+
with:
13+
ruby-version: "3.2.2"
14+
15+
- name: run tests
16+
run: rake test

rakelib/test.rake

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require 'rake/testtask'
2+
3+
Rake::TestTask.new do |t|
4+
t.libs << "tests"
5+
t.test_files = FileList["tests/**/*_test.rb"]
6+
t.verbose = true
7+
end
8+
desc 'Run tests'
9+

tests/check_test.rb

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require_relative "test_helper"
2+
3+
class CheckTest < Minitest::Test
4+
def with_captured_stdout
5+
original_stdout = $stdout
6+
$stdout = StringIO.new
7+
yield
8+
$stdout.string
9+
ensure
10+
$stdout = original_stdout
11+
end
12+
13+
def test_check_asserts
14+
output = with_captured_stdout do
15+
Rake::Task['check:asserts'].invoke
16+
end
17+
assert_match(/OK/, output)
18+
end
19+
20+
def test_check_abouts
21+
output = with_captured_stdout do
22+
Rake::Task['check:abouts'].invoke
23+
end
24+
assert_match(/OK/, output)
25+
end
26+
end

tests/test_helper.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require "minitest/autorun"
2+
require "rake"
3+
4+
Rake.application.load_rakefile

0 commit comments

Comments
 (0)