Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Use io-grader + command-grader in integration test #2

Merged
merged 8 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 37 additions & 17 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
name: Test

on: [push]

name: Autograding Tests
'on':
- push
- workflow_dispatch
permissions:
checks: write
actions: read
contents: read
jobs:
integration:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: octosteve/python-test-runner@add-additional-info
id: runner1
- uses: octosteve/python-test-runner@add-additional-info
id: runner2
- name: Show Output
uses: ./
env:
RUNNER1_RESULTS: ${{steps.runner1.outputs.result}}
RUNNER2_RESULTS: ${{steps.runner2.outputs.result}}
with:
runners: "runner1,runner2"
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
- name: Shout Test
id: shout-test
uses: education/autograding-io-grader@main
with:
test-name: Shout Test
command: "./test/bin/shout.sh"
input: hello
expected-output: HELLO
comparison-method: exact
timeout: 10
max-score: 100
- name: A command test
id: a-command-test
uses: education/autograding-command-grader@main
with:
test-name: A command test
setup-command: bundle install
command: rspec hello_spec.rb
timeout: 10
max-score: 100
- name: Autograding Reporter
uses: ./
env:
SHOUT-TEST_RESULTS: "${{steps.shout-test.outputs.result}}"
A-COMMAND-TEST_RESULTS: "${{steps.a-command-test.outputs.result}}"
with:
runners: shout-test,a-command-test
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

ruby '3.2.2'

gem 'rspec', group: :test

29 changes: 29 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)

PLATFORMS
x86_64-darwin-22

DEPENDENCIES
rspec

RUBY VERSION
ruby 3.2.2p53

BUNDLED WITH
2.4.10
5 changes: 5 additions & 0 deletions hello.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class HelloWorld
def self.say_hello
'Hello, World!'
end
end
9 changes: 9 additions & 0 deletions hello_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require_relative 'hello'

describe 'HelloWorld' do
it 'says hello' do
result = HelloWorld.say_hello

expect(result).to eq('Hello, World!')
end
end
4 changes: 4 additions & 0 deletions test/bin/shout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

input=$(cat)
echo "$input" | tr '[:lower:]' '[:upper:]'