Skip to content

Updated tranforms.

Updated tranforms. #5

Workflow file for this run

name: QuickBuild
on:
push:
branches:
- '*'
- '!gh-pages'
workflow_dispatch:
inputs:
environment:
type: string
default: DEV
required: true
jobs:
test:
runs-on: ubuntu-latest
name: Quick Build
steps:
- name: Checkout project and transforms
uses: actions/checkout@v2
with:
submodules: true
- name: Install Build Packages
run: "sudo apt-get update && sudo apt-get install -y xsltproc hunspell pandoc"
# Get current banch name to use it as dest directory
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Install Jing
run: wget -O - https://github.com/relaxng/jing-trang/releases/download/V20181222/jing-20181222.zip | jar -x
- name: Quick Build
run: WARN_PATH="output/SanityChecksOutput.md" make release
- id: validate
run: |
RNG_OUT="output/ValidationReport.txt" make validate || true
echo ::set-output name=VALERRORS::$(wc -l output/ValidationReport.txt | { read first rest ; echo $first ; } )
- id: spellcheck
run: |
SPELL_OUT="output/SpellCheckReport.txt" make spellcheck
echo ::set-output name=LINES::$(wc -l output/SpellCheckReport.txt | { read first rest ; echo $first ; } )
- name: diff
run: make diff || true;
# Little diff depends on having a git history.
# The current checkout has depth=1 and has no history
#- name: little diff
# run: make little-diff || true
- name: Make a directory listing
run: >
cd output;
(echo "<html><head><title>Listing</title></head><body>";
date;
echo "<br/><ol>";
for aa in $(find . -name '*.*'); do
echo "<li><a href='$aa'>$aa</a></li>";
done;
echo "</ol></body></html>") > index.html
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.0.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: output # The folder the action should deploy.
- name: Prepare environment
id: coverage
run: |
# Generates a GitHub Workflow output named `lines` with a coverage value
echo "##[set-output name=spellcolor;]$(if [ 0 = ${{ steps.spellcheck.outputs.LINES }} ]; then echo green; else echo red; fi)"
echo "##[set-output name=valcolor;]$(if [ 0 = ${{ steps.validate.outputs.VALERRORS }} ]; then echo green; else echo red; fi)"
# Output values to be used by other steps
echo "##[set-output name=path;]${BADGE_PATH}"
echo "##[set-output name=branch;]${BRANCH}"
env:
BADGE_PATH: ${{ steps.extract_branch.outputs.branch }}/warnings-badge.svg
BRANCH: gh-pages
- name: Get Status
run: |
echo ::set-output name=WORD::$(if [ -s output/SanityChecksOutput.md ]; then echo some; else echo none; fi )
echo ::set-output name=COLOR::$(if [ -s output/SanityChecksOutput.md ]; then echo red; else echo green; fi )
id: status
- uses: actions/checkout@v1
with:
ref: ${{ steps.coverage.outputs.branch }}
# Create the directory where badges will be saved, if needed
- name: Create destination directory
env:
BADGE_PATH: ${{ steps.coverage.outputs.path }}
run: mkdir -p "${BADGE_PATH%/*}"
# Use the output from the `coverage` step
- name: Generate the spelling badge SVG image
uses: emibcn/badge-action@v1
with:
label: 'Misspellings'
status: ${{ steps.spellcheck.outputs.LINES }}
color: ${{ steps.coverage.outputs.spellcolor }}
path: ${{ steps.extract_branch.outputs.branch }}/spell-badge.svg
# Use the output from the `coverage` step
- name: Generate the validation badge SVG image
uses: emibcn/badge-action@v1
with:
label: 'Validation'
status: ${{ steps.validate.outputs.VALERRORS }}
color: ${{ steps.coverage.outputs.valcolor }}
path: ${{ steps.extract_branch.outputs.branch }}/validation.svg
- name: Upload badge as artifact
uses: actions/upload-artifact@v2
with:
name: badge
path: ${{ steps.extract_branch.outputs.branch }}/spell-badge.svg
if-no-files-found: error
# Use the output from the `coverage` step
- name: Generate the badge SVG image
uses: emibcn/badge-action@v1
with:
label: 'Warnings'
status: ${{ steps.status.outputs.WORD }}
color: ${{ steps.status.outputs.COLOR }}
path: ${{ steps.coverage.outputs.path }}
- name: Upload badge as artifact
uses: actions/upload-artifact@v2
with:
name: badge
path: ${{ steps.coverage.outputs.path }}
if-no-files-found: error
- name: Commit badges
continue-on-error: true
env:
BADGE: ${{ steps.coverage.outputs.path }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add "${{ steps.extract_branch.outputs.branch }}"
git commit -m "Add/Update badges"
- name: Push badge commit
uses: ad-m/github-push-action@master
if: ${{ success() }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.coverage.outputs.branch }}