Support recording expected output in an action!
the `record_expected_output` script now uses the `act` utility (https://github.com/nektos/act) to run this repo's action in a container as github actions would. You can now pass one argument to that, `local`, to go back to running `github-pages` on your local ruby install. (I removed the `.ruby-version` file since we don't *need* to record using the local env anymore, so make sure that you're on Ruby 2.7.4) This eliminates the inconsistency between recorded output and generated output on actions, so we don't need to ignore any lines in `diff` anymore.
This commit is contained in:
@@ -14,10 +14,7 @@ differences = []
|
||||
|
||||
expected_files.each do |expected_file|
|
||||
if actual_files.include?(expected_file)
|
||||
# FIXME: if we are able to move the expected output recording job onto actions,
|
||||
# then we will be able to remove the -I param below which ignores the SEO json
|
||||
# tag, because the recording will be consistent with the test output.
|
||||
diff = `diff -I '"@context":"https://schema.org"' #{Shellwords.escape(File.join("_expected", expected_file))} #{Shellwords.escape(File.join("_site", 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
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
export JEKYLL_ENV=production
|
||||
export PAGES_REPO_NWO=actions/jekyll-build-pages
|
||||
export JEKYLL_BUILD_REVISION=JEKYLL_BUILD_REVISION
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user