Skip to content

Commit

Permalink
Merge pull request #868 from oss-gate/survey_ci
Browse files Browse the repository at this point in the history
use CircleCI for checking answers of survey
  • Loading branch information
tdtds committed May 31, 2018
2 parents be4e1aa + 1276d86 commit 307caee
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.5.1-browsers
environment:
TZ: /usr/share/zoneinfo/Asia/Tokyo

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

steps:
- checkout

# run tests!
- run:
name: run tests
command: |
./tutorial/retrospectives/test.sh
5 changes: 4 additions & 1 deletion tutorial/retrospectives/aggregate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
directory = ARGV.shift
type = ARGV.shift
target_question = ARGV.shift
result = true

questionnaires = {}
Dir.glob("#{directory}/#{type}-*.yaml").sort.each do |yaml|
Expand All @@ -20,7 +21,8 @@
begin
questionnaires[account] = YAML.load(File.read(yaml, encoding: 'BOM|UTF-8'))
rescue Psych::SyntaxError
puts("#{account}: syntax error: #{$!}")
$stderr.puts("#{account}: syntax error: #{$!}")
result = false
end
end
end
Expand All @@ -46,3 +48,4 @@
end
puts
end
exit(result)
15 changes: 15 additions & 0 deletions tutorial/retrospectives/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
today=`date +%Y-%m-%d`
result=0
cd tutorial/retrospectives
for workshop in `find . -type d -name "${today}*"`; do
for type in beginner supporter developer; do
if [ -f ${workshop}/${type}.yaml ]; then
./aggregate.rb ${workshop} ${type} >/dev/null
if [ ! $? = '0' ]; then
result=1
fi
fi
done
done
exit ${result}

0 comments on commit 307caee

Please sign in to comment.