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:
Jess Bees
2022-02-02 12:39:12 -05:00
parent 12272ee8f1
commit 5a78e45c89
10 changed files with 86 additions and 18 deletions
+68
View File
@@ -0,0 +1,68 @@
name: Record Expected
on:
workflow_dispatch:
jobs:
record-expected-output:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build test project 'simple'
uses: ./
with:
source: test_projects/simple
destination: test_projects/simple/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'readme'
uses: ./
with:
source: test_projects/readme
destination: test_projects/readme/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'octicons'
uses: ./
with:
source: test_projects/octicons
destination: test_projects/octicons/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'mojombo'
uses: ./
with:
source: test_projects/mojombo
destination: test_projects/mojombo/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'themes'
uses: ./
with:
source: test_projects/themes
destination: test_projects/themes/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'jekyll-include-cache'
uses: ./
with:
source: test_projects/jekyll-include-cache
destination: test_projects/jekyll-include-cache/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'future-false'
uses: ./
with:
source: test_projects/future-false
destination: test_projects/future-false/_expected
build_revision: JEKYLL_BUILD_REVISION
- name: Build test project 'future-true'
uses: ./
with:
source: test_projects/future-true
destination: test_projects/future-true/_expected
build_revision: JEKYLL_BUILD_REVISION
-1
View File
@@ -1 +0,0 @@
2.7.4
+1 -4
View File
@@ -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
+11 -7
View File
@@ -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
@@ -20,7 +20,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="The Future is Looking Bright!" />
<script type="application/ld+json">
{"url":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html","headline":"The Future is Looking Bright!","dateModified":"2020-02-13T00:00:00-05:00","datePublished":"2020-02-13T00:00:00-05:00","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everythings coming up Milhouse.","@context":"https://schema.org"}</script>
{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everythings coming up Milhouse.","url":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html","@type":"BlogPosting","headline":"The Future is Looking Bright!","dateModified":"2020-02-13T00:00:00-05:00","datePublished":"2020-02-13T00:00:00-05:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
@@ -20,7 +20,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="The Future is Looking Bright!" />
<script type="application/ld+json">
{"url":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html","headline":"The Future is Looking Bright!","dateModified":"2020-02-13T00:00:00-05:00","datePublished":"2020-02-13T00:00:00-05:00","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everythings coming up Milhouse.","@context":"https://schema.org"}</script>
{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everythings coming up Milhouse.","url":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html","@type":"BlogPosting","headline":"The Future is Looking Bright!","dateModified":"2020-02-13T00:00:00-05:00","datePublished":"2020-02-13T00:00:00-05:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
@@ -20,7 +20,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="We Live In Hell" />
<script type="application/ld+json">
{"url":"https://github.com/pages/actions/jekyll-build-pages/2022/03/01/we-live-in-hell.html","headline":"We Live In Hell","dateModified":"2022-03-01T00:00:00-05:00","datePublished":"2022-03-01T00:00:00-05:00","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2022/03/01/we-live-in-hell.html"},"description":"And its not even the cool hell that [redacted] are afraid of. 😭","@context":"https://schema.org"}</script>
{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2022/03/01/we-live-in-hell.html"},"description":"And its not even the cool hell that [redacted] are afraid of. 😭","url":"https://github.com/pages/actions/jekyll-build-pages/2022/03/01/we-live-in-hell.html","@type":"BlogPosting","headline":"We Live In Hell","dateModified":"2022-03-01T00:00:00-05:00","datePublished":"2022-03-01T00:00:00-05:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
@@ -16,7 +16,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="jekyll-build-pages" />
<script type="application/ld+json">
{"@type":"WebSite","headline":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/","name":"jekyll-build-pages","@context":"https://schema.org"}</script>
{"headline":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","name":"jekyll-build-pages","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
+1 -1
View File
@@ -16,7 +16,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Jekyll Actions Demo" />
<script type="application/ld+json">
{"@type":"WebSite","headline":"Jekyll Actions Demo","name":"Jekyll Actions Demo","url":"https://github.com/pages/actions/jekyll-build-pages/","@context":"https://schema.org"}</script>
{"url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","headline":"Jekyll Actions Demo","name":"Jekyll Actions Demo","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
+1 -1
View File
@@ -16,7 +16,7 @@
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="themes" />
<script type="application/ld+json">
{"@type":"WebSite","headline":"themes","name":"themes","url":"https://github.com/pages/actions/jekyll-build-pages/","@context":"https://schema.org"}</script>
{"url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","headline":"themes","name":"themes","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">