diff --git a/.github/workflows/record.yml b/.github/workflows/record.yml new file mode 100644 index 0000000..dd89303 --- /dev/null +++ b/.github/workflows/record.yml @@ -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 + diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index a4dd9db..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.7.4 diff --git a/bin/compare_expected_output b/bin/compare_expected_output index c2e5328..6616142 100755 --- a/bin/compare_expected_output +++ b/bin/compare_expected_output @@ -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 diff --git a/bin/record_expected_output b/bin/record_expected_output index a0dc711..d90ab1f 100755 --- a/bin/record_expected_output +++ b/bin/record_expected_output @@ -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 diff --git a/test_projects/future-false/_expected/2020/02/13/the-future-is-looking-bright.html b/test_projects/future-false/_expected/2020/02/13/the-future-is-looking-bright.html index 0cae19a..a8123c9 100644 --- a/test_projects/future-false/_expected/2020/02/13/the-future-is-looking-bright.html +++ b/test_projects/future-false/_expected/2020/02/13/the-future-is-looking-bright.html @@ -20,7 +20,7 @@ +{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everything’s 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"} diff --git a/test_projects/future-true/_expected/2020/02/13/the-future-is-looking-bright.html b/test_projects/future-true/_expected/2020/02/13/the-future-is-looking-bright.html index 0cae19a..a8123c9 100644 --- a/test_projects/future-true/_expected/2020/02/13/the-future-is-looking-bright.html +++ b/test_projects/future-true/_expected/2020/02/13/the-future-is-looking-bright.html @@ -20,7 +20,7 @@ +{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2020/02/13/the-future-is-looking-bright.html"},"description":"Everything’s 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"} diff --git a/test_projects/future-true/_expected/2022/03/01/we-live-in-hell.html b/test_projects/future-true/_expected/2022/03/01/we-live-in-hell.html index 0a2ebfb..e4de077 100644 --- a/test_projects/future-true/_expected/2022/03/01/we-live-in-hell.html +++ b/test_projects/future-true/_expected/2022/03/01/we-live-in-hell.html @@ -20,7 +20,7 @@ +{"mainEntityOfPage":{"@type":"WebPage","@id":"https://github.com/pages/actions/jekyll-build-pages/2022/03/01/we-live-in-hell.html"},"description":"And it’s 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"} diff --git a/test_projects/jekyll-include-cache/_expected/index.html b/test_projects/jekyll-include-cache/_expected/index.html index 6c241dc..a422222 100644 --- a/test_projects/jekyll-include-cache/_expected/index.html +++ b/test_projects/jekyll-include-cache/_expected/index.html @@ -16,7 +16,7 @@ +{"headline":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","name":"jekyll-build-pages","@context":"https://schema.org"} diff --git a/test_projects/simple/_expected/index.html b/test_projects/simple/_expected/index.html index 4b5552e..47341be 100644 --- a/test_projects/simple/_expected/index.html +++ b/test_projects/simple/_expected/index.html @@ -16,7 +16,7 @@ +{"url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","headline":"Jekyll Actions Demo","name":"Jekyll Actions Demo","@context":"https://schema.org"} diff --git a/test_projects/themes/_expected/index.html b/test_projects/themes/_expected/index.html index 3523e1f..8b23f92 100644 --- a/test_projects/themes/_expected/index.html +++ b/test_projects/themes/_expected/index.html @@ -16,7 +16,7 @@ +{"url":"https://github.com/pages/actions/jekyll-build-pages/","@type":"WebSite","headline":"themes","name":"themes","@context":"https://schema.org"}