This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from trotzig/rename-to-diffux-ci
Rename project Diffux CI
- Loading branch information
Showing
19 changed files
with
195 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'diffux_ci_utils' | ||
require 'diffux_ci_action' | ||
require 'diffux_ci_uploader' | ||
require 'fileutils' | ||
|
||
action = ARGV[0] || 'run' | ||
case action | ||
when 'run' | ||
Thread.abort_on_exception = true | ||
Thread.new do | ||
require 'diffux_ci_runner' | ||
exit | ||
end | ||
require 'diffux_ci_server' | ||
|
||
when 'review' | ||
system 'open', DiffuxCIUtils.construct_url('/review') | ||
require 'diffux_ci_server' | ||
|
||
when 'clean' | ||
if File.directory? DiffuxCIUtils.config['snapshots_folder'] | ||
FileUtils.remove_entry_secure DiffuxCIUtils.config['snapshots_folder'] | ||
end | ||
|
||
when 'approve', 'reject' | ||
abort 'Missing example name' unless example_name = ARGV[1] | ||
abort 'Missing viewport name' unless viewport_name = ARGV[2] | ||
DiffuxCIAction.new(example_name, viewport_name).send(action) | ||
|
||
when 'upload_diffs' | ||
# `upload_diffs` returns a URL to a static html file | ||
puts DiffuxCIUploader.new.upload_diffs | ||
else | ||
abort "Unknown action \"#{action}\"" | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Gem::Specification.new do |s| | ||
s.name = 'likadan' | ||
s.version = '0.0.14' | ||
s.name = 'diffux_ci' | ||
s.version = '0.1.0' | ||
s.date = '2015-02-20' | ||
s.summary = 'Likadan' | ||
s.description = 'Likadan, a perceptual diff tool for JS components' | ||
s.summary = 'Diffux-CI' | ||
s.description = 'Diffux-CI, a perceptual diff tool for JS components' | ||
s.authors = ['Henric Trotzig'] | ||
s.email = '[email protected]' | ||
s.executables = ['likadan'] | ||
s.homepage = 'http://rubygems.org/gems/likadan' | ||
s.executables = ['diffux_ci'] | ||
s.homepage = 'http://rubygems.org/gems/diffux_ci' | ||
s.license = 'MIT' | ||
s.require_paths = ['lib'] | ||
s.files = Dir['lib/**/*'] | ||
|
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
#!/bin/bash -ex | ||
|
||
# This is an example script that generates and uploads Likadan diffs for the | ||
# This is an example script that generates and uploads Diffux-CI diffs for the | ||
# differences between the previous and current commit. | ||
|
||
run-likadan() { | ||
run-diffux-ci() { | ||
# Checkout the commit | ||
git checkout --quiet $1 | ||
|
||
# Install dependencies and precompile the JavaScript bundle | ||
npm install | ||
webpack ./entry.js bundle.js | ||
|
||
# Run likadan for the current commit. We use `xvfb-run` so that we can run | ||
# likadan (which uses Firefox) in a headless display environment. | ||
xvfb-run likadan | ||
# Run diffux_ci for the current commit. We use `xvfb-run` so that we can run | ||
# diffux_ci (which uses Firefox) in a headless display environment. | ||
xvfb-run diffux_ci | ||
} | ||
|
||
# Check out the previous version and generate baseline snapshots | ||
run-likadan HEAD^ | ||
run-diffux-ci HEAD^ | ||
|
||
# Check out the latest version and check for diffs | ||
run-likadan - | ||
run-diffux-ci - | ||
|
||
# Finally, upload any diffs to s3 | ||
url_to_diffs=`likadan upload_diffs` | ||
url_to_diffs=`diffux_ci upload_diffs` | ||
if [ -n "$url_to_diffs" ]; then | ||
# We have a URL to the diff(s) found for the commit. We can choose to do one | ||
# of a few things here. We either exit the script with a non-zero exit code. | ||
# This will likely make the CI run fail. We can also allow the script to pass, | ||
# but instead post a comment to the commit with the URL to the diff(s). Below | ||
# is an example of the latter, where we post back a comment to a Gerrit patch | ||
# set. | ||
message="Likadan diff(s) were found: $link_to_diffs" | ||
message="Diffux-CI diff(s) were found: $link_to_diffs" | ||
|
||
ssh -p 29418 [email protected] \ | ||
gerrit review \'--message="$message"\' $GERRIT_PATCHSET_REVISION | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'diffux_ci_utils' | ||
require 'fileutils' | ||
|
||
class DiffuxCIAction | ||
def initialize(example_name, viewport_name) | ||
@example_name = example_name | ||
@viewport_name = viewport_name | ||
end | ||
|
||
def approve | ||
diff_path = DiffuxCIUtils.path_to(@example_name, @viewport_name, 'diff.png') | ||
baseline_path = DiffuxCIUtils.path_to(@example_name, @viewport_name, 'baseline.png') | ||
candidate_path = DiffuxCIUtils.path_to(@example_name, @viewport_name, 'candidate.png') | ||
|
||
FileUtils.rm(diff_path, force: true) | ||
|
||
if File.exist? candidate_path | ||
FileUtils.mv(candidate_path, baseline_path) | ||
end | ||
end | ||
|
||
def reject | ||
diff_path = DiffuxCIUtils.path_to(@example_name, @viewport_name, 'diff.png') | ||
candidate_path = DiffuxCIUtils.path_to(@example_name, @viewport_name, 'candidate.png') | ||
|
||
FileUtils.rm(diff_path, force: true) | ||
FileUtils.rm(candidate_path, force: true) | ||
end | ||
end |
Oops, something went wrong.