Skip to content

Commit

Permalink
Merge pull request #43 from actions/dependabot/bundler/test_projects/…
Browse files Browse the repository at this point in the history
…mojombo/tzinfo-1.2.10

Bump tzinfo from 1.2.2 to 1.2.10 in /test_projects/mojombo
  • Loading branch information
yoannchaudet authored Jul 29, 2022
2 parents 9b88238 + eaf5f4f commit d4accba
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 19 deletions.
16 changes: 8 additions & 8 deletions bin/record_expected_output
Original file line number Diff line number Diff line change
@@ -1,14 +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
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
act -b -s GITHUB_TOKEN -j record-expected-output
fi
96 changes: 96 additions & 0 deletions bin/sync_expected_output.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env pwsh
#Requires -Version 7.2

<#
.SYNOPSIS
Trigger the workflow that records the tests expected outputs, wait for its execution to finish,
then bring back those results locally.
.DESCRIPTION
This script is meant to run locally outside of Actions. It relies on `gh` and `git`.
#>

# Get the repository's path (ps1 extension on the script is required for PSScriptRoot to be available 🤦)
$repositoryPath = Resolve-Path (Join-Path $PSScriptRoot '..')

# Get the test_project's path
$testProjectsPath = Resolve-Path (Join-Path $PSScriptRoot '../test_projects')

#
# Utilities
#

# Run a command and validate it returned a 0 exit code
function Invoke-Command {
param (
[ScriptBlock] $Command
)

& $Command
if ($LASTEXITCODE -ne 0) {
Write-Error "Command failed: $Command"
throw
}
}

# Get the current git ref name
function Get-GitRef {
$commitId = Invoke-Command { & git -C $repositoryPath rev-parse --abbrev-ref HEAD }
$commitId.Trim()
}

# Create a temp folder and return its path
function New-TemporaryFolder {
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.Guid]::NewGuid())
New-Item -ItemType 'Directory' -Path $path | Out-Null
$path
}

#
# Main
#

# Init
Set-StrictMode -version 'Latest'
$ErrorActionPreference = 'Stop'

# Get git ref name
$ref = Get-GitRef

# Run the workflow
Write-Host 'Queue workflow'
$workflow = 'record.yml'
Invoke-Command { & gh workflow run $workflow --ref $ref | Out-Null }

# Wait for a few seconds for the workflow to get created
Write-Host 'Wait a few seconds...'
Start-Sleep -Seconds 5

# Lookup the run id (it is not perfect because of the APIs...)
Write-Host 'Lookup run id'
$runId = Invoke-Command { & gh run list --workflow $workflow --branch $ref --limit 1 --json databaseId --jq '.[].databaseId' }

# Wait for the workflow to finish
Write-Host "Wait for workflow $runId to complete"
Invoke-Command { & gh run watch $runId --exit-status }

# Download the artifacts in a temp folder
Write-Host 'Download artifacts'
$tempFolder = New-TemporaryFolder
Invoke-Command { & gh run download $runId --dir $tempFolder }

# Iterate over the test projects
Get-ChildItem -Path $testProjectsPath -Directory | ForEach-Object {
# Construct the artifact path and make sure a matching artifact is found
$artifactPath = Join-Path $tempFolder $_.BaseName
if (Test-Path $artifactPath -PathType 'Container') {
# Copy artifact to the expected output folder
$destinationPath = Join-Path $testProjectsPath $_.BaseName '_expected'
Copy-Item -Path (Join-Path $artifactPath '*') -Destination $destinationPath -Recurse -Force | Out-Null
}

# Ignore test project
else {
Write-Warning "Unable to find artifact for test project $($_.BaseName)"
}
}
6 changes: 4 additions & 2 deletions test_projects/jekyll-include-cache/_expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>jekyll-build-pages</title>
<title>jekyll-build-pages | A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="jekyll-build-pages" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<meta property="og:description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:url" content="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:site_name" content="jekyll-build-pages" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="jekyll-build-pages" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","headline":"jekyll-build-pages","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
{"@context":"https://schema.org","@type":"WebSite","description":"A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.","headline":"jekyll-build-pages","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
Expand Down
4 changes: 2 additions & 2 deletions test_projects/mojombo/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ GEM
faraday (~> 0.8, < 0.10)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
thread_safe (0.3.5)
thread_safe (0.3.6)
typhoeus (0.8.0)
ethon (>= 0.8.0)
tzinfo (1.2.2)
tzinfo (1.2.10)
thread_safe (~> 0.1)
unicode-display_width (1.1.1)

Expand Down
4 changes: 3 additions & 1 deletion test_projects/octicons/_expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="Readme Test" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<meta property="og:description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:url" content="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:site_name" content="jekyll-build-pages" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Readme Test" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","headline":"Readme Test","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
{"@context":"https://schema.org","@type":"WebSite","description":"A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.","headline":"Readme Test","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
Expand Down
4 changes: 3 additions & 1 deletion test_projects/readme/_expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="Readme Test" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<meta property="og:description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:url" content="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:site_name" content="jekyll-build-pages" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Readme Test" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","headline":"Readme Test","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
{"@context":"https://schema.org","@type":"WebSite","description":"A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.","headline":"Readme Test","name":"jekyll-build-pages","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
Expand Down
6 changes: 4 additions & 2 deletions test_projects/simple/_expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Jekyll Actions Demo</title>
<title>Jekyll Actions Demo | A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="Jekyll Actions Demo" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<meta property="og:description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:url" content="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:site_name" content="Jekyll Actions Demo" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Jekyll Actions Demo" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","headline":"Jekyll Actions Demo","name":"Jekyll Actions Demo","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
{"@context":"https://schema.org","@type":"WebSite","description":"A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.","headline":"Jekyll Actions Demo","name":"Jekyll Actions Demo","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
Expand Down
8 changes: 5 additions & 3 deletions test_projects/themes/_expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>themes</title>
<title>themes | A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="themes" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<meta property="og:description" content="A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages." />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:url" content="https://github.com/pages/actions/jekyll-build-pages/" />
<meta property="og:site_name" content="themes" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="themes" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebSite","headline":"themes","name":"themes","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
{"@context":"https://schema.org","@type":"WebSite","description":"A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.","headline":"themes","name":"themes","url":"https://github.com/pages/actions/jekyll-build-pages/"}</script>
<!-- End Jekyll SEO tag -->

<link rel="stylesheet" href="/pages/actions/jekyll-build-pages/assets/css/style.css?v=JEKYLL_BUILD_REVISION">
Expand All @@ -43,7 +45,7 @@ <h1><a href="https://github.com/pages/actions/jekyll-build-pages/">themes</a></h



<p></p>
<p>A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.</p>


<p class="view"><a href="https://github.com/actions/jekyll-build-pages">View the Project on GitHub <small>actions/jekyll-build-pages</small></a></p>
Expand Down

0 comments on commit d4accba

Please sign in to comment.