テストケースを受け取る
yaml
name: Runner 02
on:
workflow_dispatch:
inputs:
submission:
description: 提出コード
required: true
type: string
default: 'fn main() { proconio::input!(a: i32, b: i32); println!("{}", a + b); }'
testcases:
description: テストケース
required: true
type: string
default: '["1 2", "3 4", "12345678 87654321"]'
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
testcase: ${{ fromJson(inputs.testcases) }}
steps:
- name: Run Job
env:
SUBMISSION: ${{ inputs.submission }}
TESTCASE: ${{ matrix.testcase }}
run: |
cargo new worker
cd worker
cargo add proconio
printenv SUBMISSION > src/main.rs
printenv TESTCASE | cargo run --release > $GITHUB_STEP_SUMMARY