add slides and videos to summit program #1562
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023, Proofcraft Pty Ltd | |
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) | |
# | |
# SPDX-License-Identifier: BSD-2-Clause | |
--- | |
name: PR | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
snapshot: | |
name: "Build site" | |
runs-on: 'ubuntu-latest' | |
outputs: | |
linkchecker_failed: ${{ steps.linkchecker_status.outputs.linkchecker_failed }} | |
validator_failed: ${{ steps.validator_status.outputs.validator_failed }} | |
validator_msg: ${{ steps.msg.outputs.validator_msg }} | |
linkcheck_msg: ${{ steps.linkmsg.outputs.linkcheck_msg }} | |
steps: | |
- uses: actions/checkout@v4 | |
# sets up ruby accourding to .ruby-version and caches bundler deps | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: 'Site' | |
id: 'site' | |
run: | | |
make build | |
# Link checking etc is done on the main build, PR preview builds the site | |
# again, but since all dependencies are installed now, this should be fast. | |
- name: 'Prepare Preview' | |
run: | | |
echo 'baseurl: "/website_pr_hosting/PR_${{ github.event.number }}"' >> _preview.yml | |
make preview | |
- name: 'Link Check' | |
id: 'linkchecker_status' | |
run: | | |
make checklinks > linkchecker.log 2>&1 || touch .linkchecker_failed | |
if [ -e ".linkchecker_failed" ]; then | |
echo "linkchecker_failed=true" >> $GITHUB_OUTPUT | |
else | |
echo "linkchecker_failed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: 'Prepare Link Check Message' | |
id: linkmsg | |
run: | | |
output="linkchecker-msg.txt" | |
sed 's|/github/workspace/||g' linkchecker.log | \ | |
sed 's|\\|\\\\|g' | \ | |
sed 's|\"|\\\"|g' >> "$output" | |
MSG="$(cat "$output")" | |
# Replaces newlines with the string '\n' | |
MSG="${MSG//$'\n'/'\n'}" | |
echo "linkcheck_msg=$MSG" >> $GITHUB_OUTPUT | |
- name: HTML5 Validator | |
id: validate | |
uses: Cyb3r-Jak3/[email protected] | |
with: | |
root: _site | |
format: text | |
blacklist: pr_checks | |
continue-on-error: true | |
- name: Check status of HTML5 validator | |
id: validator_status | |
run: | | |
if [ "${{ steps.validate.outputs.result }}" -eq "0" ]; then | |
echo "validator_failed=false" >> $GITHUB_OUTPUT | |
else | |
echo "validator_failed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Fix up HTML5 validator log paths + escape quotes | |
id: msg | |
run: | | |
output="_site/localhost/pr_checks/validator.log" | |
mkdir -p "$(dirname "$output")" | |
sed 's|/github/workspace/||g' log.log | \ | |
sed 's|\\|\\\\|g' | \ | |
sed 's|\"|\\\"|g' >> "$output" | |
MSG="$(cat "$output")" | |
# Replaces newlines with the string '\n' | |
MSG="${MSG//$'\n'/'\n'}" | |
echo "validator_msg=$MSG" >> $GITHUB_OUTPUT | |
- name: Deploy Preview | |
if: github.repository_owner == 'seL4' && github.event.pull_request.head.repo.full_name == 'seL4/website' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
external_repository: seL4/website_pr_hosting | |
publish_dir: ./_preview | |
destination_dir: PR_${{ github.event.number }} | |
linkchecker: | |
name: "Link checker" | |
runs-on: 'ubuntu-latest' | |
needs: snapshot | |
env: | |
LINKCHECK_MSG: ${{ needs.snapshot.outputs.linkcheck_msg }} | |
continue-on-error: true | |
steps: | |
- name: show linkchecker status | |
run: | | |
if ${{ needs.snapshot.outputs.linkchecker_failed }}; then | |
echo -e "$LINKCHECK_MSG" | |
exit 1 | |
fi | |
exit 0 | |
htmlvalidator: | |
name: "HTML5 Validator" | |
runs-on: 'ubuntu-latest' | |
needs: snapshot | |
env: | |
VALIDATOR_MSG: ${{ needs.snapshot.outputs.validator_msg }} | |
continue-on-error: true | |
steps: | |
- name: show validator status | |
run: | | |
if ${{ needs.snapshot.outputs.validator_failed }}; then | |
echo -e "$VALIDATOR_MSG" | |
exit 1 | |
fi | |
exit 0 | |
comment: | |
name: "PR Comment" | |
runs-on: 'ubuntu-latest' | |
needs: [snapshot] | |
env: | |
LINKCHECK_MSG: ${{ needs.snapshot.outputs.linkcheck_msg }} | |
VALIDATOR_MSG: ${{ needs.snapshot.outputs.validator_msg }} | |
steps: | |
# TODO: in the future, when this issue is resolved: https://github.com/peaceiris/actions-gh-pages/issues/348, the link | |
# generated should be for the commit itself, not just the tip. | |
- name: Build message | |
id: msg | |
run: | | |
rm -f msg.txt | |
touch msg.txt | |
echo "Preview your changes [here](https://sel4.github.io/website_pr_hosting/PR_${{ github.event.number }})" >> msg.txt | |
if ${{ needs.snapshot.outputs.linkchecker_failed }}; then | |
echo "" >> msg.txt | |
echo "The link checker found some issues!" >> msg.txt | |
echo \`\`\` >> msg.txt | |
echo "$LINKCHECK_MSG" >> msg.txt | |
echo \`\`\` >> msg.txt | |
fi | |
if ${{ needs.snapshot.outputs.validator_failed }}; then | |
echo "" >> msg.txt | |
echo "The HTML5 validator found some issues!" >> msg.txt | |
echo \`\`\` >> msg.txt | |
echo "$VALIDATOR_MSG" >> msg.txt | |
echo \`\`\` >> msg.txt | |
fi | |
export MSG="$(cat msg.txt)" | |
# The following replaces newlines with the string '\n' for the JS call further below | |
MSG="${MSG//$'\n'/'\n'}" | |
echo "MSG=$MSG" >> $GITHUB_ENV | |
- name: Print message | |
run: | | |
echo "$MSG" | |
- name: Leave comment with link to site, and results of checks | |
uses: actions/github-script@v7 | |
if: github.repository_owner == 'seL4' && github.event.pull_request.head.repo.full_name == 'seL4/website' | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "${{ env.MSG }}" | |
}) |