cc:2022 updates #9
This file contains hidden or 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
| 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" | |
| run: "sudo apt-get update && sudo apt-get install -y xsltproc hunspell python3-lxml" | |
| - name: Install Jing | |
| run: wget -O - https://github.com/relaxng/jing-trang/releases/download/V20181222/jing-20181222.zip | jar -x | |
| # Get current banch name to use it as dest directory | |
| - name: Extract branch name | |
| id: extract_branch | |
| shell: bash | |
| run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
| - name: Quick Build | |
| run: | | |
| pwd | |
| WARN_PATH="output/SanityChecksOutput.md" make | |
| - name: PDFify | |
| if: ${{ github.ref_name != 'master' }} | |
| run: | | |
| sudo apt-get install -y wkhtmltopdf xvfb | |
| xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x16' /usr/bin/wkhtmltopdf \ | |
| --javascript-delay 15000 --footer-right '[page]' \ | |
| file://${PWD}/output/${PWD##*/}.html?expand=on \ | |
| output/${PWD##*/}-paged.pdf | |
| - 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 ; } ) | |
| - id: tdate | |
| run: | | |
| echo "##[set-output name=TDATE;]$(cd transforms && git log -1 --format=%cs; cd -)" # | |
| - name: Setup Java JDK | |
| uses: actions/setup-java@v1.4.3 | |
| with: | |
| java-version: 1.8 | |
| - name: Get DaisyDiff | |
| run: | | |
| wget -O- https://github.com/AndroidKitKat/ExecuteDaisy/archive/master.zip | jar -x | |
| [ -d "output/images" ] || mkdir "output/images"; | |
| cp -u -r ExecuteDaisy-master/js ExecuteDaisy-master/css output; | |
| cp -u ExecuteDaisy-master/images/* output/images; | |
| - name: Make tmp dir | |
| run: mkdir tmp | |
| # - name: Diff against specified versions | |
| # run: DAISY_DIR=ExecuteDaisy-master make diff | |
| - name: diff | |
| run: TMP=tmp 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: Outstanding TDs | |
| id: tds | |
| run: | | |
| make effective | |
| PP_XML=output/effective.xml RNG_OUT=output/TDValidationReport.txt make validate || true | |
| if [ "${{steps.extract_branch.outputs.branch}}" == "master" ] && | |
| ls input/tds/*.xml ; then | |
| echo "Master branch should not have TDs" >> output/TDValidationReport.txt | |
| fi | |
| echo "##[set-output name=TDCOLOR;]$(if [ -s output/TDValidationReport.txt ]; then echo orange; else echo green; fi)" | |
| echo "##[set-output name=TDWARNS;]$( wc -l output/TDValidationReport.txt | { read first rest ; echo $first;} )" | |
| if ls input/tds/*.xml; then | |
| PP_XML=output/effective.xml PP_RELEASE_HTML=output/AppliedTDs.html make release | |
| java -jar ExecuteDaisy-master/*.jar output/*-release.html output/AppliedTDs.html --file=output/AppliedTDs-Diff.html | |
| fi | |
| - 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 | |
| cd - | |
| - 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: output/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: output/spell-badge.svg | |
| - name: Generate the built branch SVG | |
| uses: emibcn/badge-action@v1 | |
| with: | |
| label: 'Last Built' | |
| status: ${{ steps.extract_branch.outputs.branch }} | |
| color: black | |
| path: "output/build-branch-badge.svg" | |
| # - name: Upload badge as artifact | |
| # uses: actions/upload-artifact@v2 | |
| # with: | |
| # name: badge | |
| # path: build-branch-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: output/warnings.svg | |
| - name: Generate the transforms badge | |
| uses: emibcn/badge-action@v1 | |
| with: | |
| label: 'Transforms' | |
| status: ${{ steps.tdate.outputs.TDATE }} | |
| color: gray | |
| path: output/transforms.svg | |
| - name: TD Badge | |
| uses: emibcn/badge-action@v1 | |
| with: | |
| label: 'TDs' | |
| status: ${{steps.tds.outputs.TDWARNS}} | |
| color: ${{steps.tds.outputs.TDCOLOR}} | |
| path: output/tds.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: output/validation.svg | |
| - id: debug | |
| run: | | |
| ls | |
| ls output | |
| pwd | |
| - 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: 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 output #warnings.svg validation.svg build-branch-badge.svg spell-badge.svg transforms.svg tds.svg | |
| # git commit -m "Update files" | |
| # # - name: Upload badge as artifact | |
| # # - 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 }} |