Compare commits

..
Author SHA1 Message Date
Jess Bees ead53d0c8a Update debug messages
Docker / build (push) Has been cancelled
2022-03-23 14:05:59 -04:00
Jess Bees e2b13747b8 Temporary: repoint action to use published feature branch image 2022-03-22 13:48:08 -04:00
Jess Bees d0c3f534f8 Unrelated: fix a pair of shellcheck lints 2022-03-22 13:43:22 -04:00
Jess Bees 68107d3ea8 Emit telemetry after building
This commit duplicates the telemetry logic in the actions/deploy-pages action.
This Gemfile already pulls in Faraday as a dependency of octokit; the change to
Gemfile just makes its use explicit. There aren't any changes when you compare
the resulting Gemfile.lock.
2022-03-22 11:38:34 -04:00
36 changed files with 113 additions and 67 deletions
+52 -51
View File
@@ -3,65 +3,66 @@ name: Record Expected
on:
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
resolve-image-tag:
record-expected-output:
runs-on: ubuntu-latest
outputs:
tag: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.regex-match.outputs.group1 }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Grep action.yaml content
id: grep-image-content
run: |
image=$(grep -E "jekyll-build-pages.*\'" action.yml)
echo "::set-output name=image::$image"
- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ steps.grep-image-content.outputs.image }}
regex: "jekyll-build-pages:(.*)'"
test-builds:
needs: resolve-image-tag
runs-on: ubuntu-latest
strategy:
matrix:
test:
- simple
- readme
- octicons
- mojombo
- themes
- jekyll-include-cache
- future-false
- future-true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build local docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
tags: ${{ needs.resolve-image-tag.outputs.tag }}
- name: Build ${{ matrix.test }} Project
- name: Build test project 'simple'
uses: ./
with:
source: ./test_projects/${{ matrix.test }}
destination: ./test_projects/${{ matrix.test }}/_expected
source: test_projects/simple
destination: test_projects/simple/_expected
build_revision: JEKYLL_BUILD_REVISION
token: ${{ secrets.GITHUB_TOKEN }}
- name: Archive ${{ matrix.test }} Project
uses: actions/upload-artifact@v3
- name: Build test project 'readme'
uses: ./
with:
name: ${{ matrix.test }}
path: ./test_projects/${{ matrix.test }}/_expected
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
@@ -20,6 +20,7 @@ ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8
COPY entrypoint.sh /entrypoint.sh
COPY bin/emit_telemetry /emit_telemetry
ENTRYPOINT ["/entrypoint.sh"]
+2 -1
View File
@@ -5,10 +5,11 @@ source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# Manage our dependency on the version of the github-pages gem here.
gem "github-pages", "= 227"
gem "github-pages", "= 225"
# Explicitly include this gem here.
# It is not directly included in the github-pages gem list of dependencies,
# even though it is included in the original GitHub Pages build infrastructure.
gem "jekyll-include-cache", "= 0.2.1"
gem "jekyll-octicons", "~> 14.2"
gem "faraday", "~> 1.10"
+1 -1
View File
@@ -27,4 +27,4 @@ inputs:
default: ${{ github.token }}
runs:
using: 'docker'
image: 'docker://ghcr.io/actions/jekyll-build-pages:v1.0.4'
image: 'docker://ghcr.io/actions/jekyll-build-pages:feature-emit-telemetry'
+43
View File
@@ -0,0 +1,43 @@
#! /usr/bin/env ruby
require "faraday"
require "faraday/retry"
require "json"
ACTION_NWO = ENV["GITHUB_ACTION_REPOSITORY"]
REPOSITORY_NWO = ENV["GITHUB_REPOSITORY"]
GITHUB_RUN_ID = ENV["GITHUB_RUN_ID"]
GITHUB_TOKEN = ENV["INPUT_TOKEN"]
TELEMETRY_URL = "https://api.github.com/repos/#{REPOSITORY_NWO}/pages/telemetry"
RETRY_COUNT = 3
RETRY_OPTIONS = {
max: RETRY_COUNT,
methods: [:post],
retry_statuses: [500, 502, 503, 504],
interval: 1,
backoff_factor: 2,
}
begin
connection = Faraday.new { |f| f.request :retry, RETRY_OPTIONS }
response = connection.post(
TELEMETRY_URL,
{ github_run_id: GITHUB_RUN_ID }.to_json,
{
Accept: 'application/vnd.github.v3+json',
Authorization: "Bearer #{GITHUB_TOKEN}",
'Content-type': 'application/json',
'User-Agent': "#{ACTION_NWO} Faraday #{Faraday::VERSION}",
},
)
if response.success?
STDERR.puts "Sending telemetry for run id #{GITHUB_RUN_ID}"
else response.success?
STDERR.puts "Failed to emit pages build telemetry to #{TELEMETRY_URL} : returned status code: #{response.status} after #{RETRY_COUNT + 1} attempts"
STDERR.puts response.body if response.body
end
rescue e
STDERR.puts "Failed to emit pages build telemetry: #{e}"
end
+2 -2
View File
@@ -5,9 +5,9 @@ if [ "local" = "$1" ]; then
export PAGES_REPO_NWO=actions/jekyll-build-pages
export JEKYLL_BUILD_REVISION=JEKYLL_BUILD_REVISION
for dir in $(ls test_projects)
for dir in test_projects/*
do
bundle exec github-pages build --verbose -s test_projects/$dir -d test_projects/$dir/_expected
bundle exec github-pages build --verbose -s "$dir" -d "$dir/_expected"
done
else
act -b -s GITHUB_TOKEN -j record-expected-output
+2
View File
@@ -35,3 +35,5 @@ fi
cd "$PAGES_GEM_HOME"
$GITHUB_PAGES build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY"
/emit_telemetry
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>The Future is Looking Bright! | jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="The Future is Looking Bright!" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Everythings coming up Milhouse." />
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>The Future is Looking Bright! | jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="The Future is Looking Bright!" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Everythings coming up Milhouse." />
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>We Live In Hell | jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="We Live In Hell" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="And its not even the cool hell that [redacted] are afraid of. 😭" />
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="jekyll-build-pages" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
+2 -4
View File
@@ -13,7 +13,6 @@ GEM
execjs
coffee-script-source (1.10.0)
colorator (1.1.0)
concurrent-ruby (1.1.10)
ethon (0.9.1)
ffi (>= 1.3.0)
execjs (2.7.0)
@@ -54,8 +53,7 @@ GEM
html-pipeline (2.4.2)
activesupport (>= 2)
nokogiri (>= 1.4)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n (0.7.0)
jekyll (3.3.0)
addressable (~> 2.4)
colorator (~> 1.0)
@@ -108,7 +106,7 @@ GEM
minitest (5.9.1)
multipart-post (2.0.0)
net-dns (0.8.0)
nokogiri (1.13.6)
nokogiri (1.13.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
octokit (4.6.0)
+1 -1
View File
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Readme Test | jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="Readme Test" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
+1 -1
View File
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Readme Test | jekyll-build-pages</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="Readme Test" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />
+1 -1
View File
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Jekyll Actions Demo</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="Jekyll Actions Demo" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

+1 -1
View File
@@ -7,7 +7,7 @@
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>themes</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta name="generator" content="Jekyll v3.9.0" />
<meta property="og:title" content="themes" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://github.com/pages/actions/jekyll-build-pages/" />