Merge remote-tracking branch 'origin' into add-jekyll-build-pages-release-process

This commit is contained in:
yimysty
2022-02-07 10:31:42 -08:00
76 changed files with 7804 additions and 30 deletions
+35
View File
@@ -0,0 +1,35 @@
#! /usr/bin/env ruby
require "pathname"
require "shellwords"
project_path = ARGV[0]
Dir.chdir(project_path)
expected_files = Dir["_expected/**/*"].select { |path| File.file?(path) }.map { |path| Pathname.new(path).relative_path_from("_expected").to_s }
actual_files = Dir["_site/**/*"].select { |path| File.file?(path) }.map { |path| Pathname.new(path).relative_path_from("_site").to_s }
differences = []
expected_files.each do |expected_file|
if actual_files.include?(expected_file)
diff = `diff #{Shellwords.escape(File.join("_expected", expected_file))} #{Shellwords.escape(File.join("_site", expected_file))}`
if !$?.success?
differences << "Expected output of #{expected_file} differs:\n#{diff}"
end
else
differences << "Missing expected file: #{expected_file}"
end
end
unexpected_files = actual_files - expected_files
unexpected_files.each do |unexpected_file|
differences << "Unexpected file: #{unexpected_file}"
end
if !differences.empty?
STDERR.puts "Differences between expected and actual outputs:"
differences.each { |diff| STDERR.puts(diff) }
exit(1)
end
+14
View File
@@ -0,0 +1,14 @@
#! /usr/bin/env sh
if [ "local" = "$1" ]; then
export JEKYLL_ENV=production
export PAGES_REPO_NWO=actions/jekyll-build-pages
export JEKYLL_BUILD_REVISION=JEKYLL_BUILD_REVISION
for dir in $(ls test_projects)
do
bundle exec github-pages build --verbose -s test_projects/$dir -d test_projects/$dir/_expected
done
else
act -b -s GITHUB_TOKEN -j record-expected-output
fi