|
| 1 | +name: QuickBuild v4.6pdf 20250905 |
| 2 | +# Run only on demand to do quick build with both pdf and html output |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + environment: |
| 8 | + type: string |
| 9 | + default: DEV |
| 10 | + required: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + name: Quick Build |
| 16 | + steps: |
| 17 | + - name: Checkout project and transforms |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + submodules: true |
| 21 | + |
| 22 | + - name: Install Build Packages |
| 23 | +# run: "sudo apt-get update && sudo apt-get install -y xsltproc hunspell pandoc" |
| 24 | + run: "sudo apt-get update && sudo apt-get install -y xsltproc hunspell python3-lxml" |
| 25 | + |
| 26 | + - name: Install Jing |
| 27 | + run: wget -O - https://github.com/relaxng/jing-trang/releases/download/V20181222/jing-20181222.zip | jar -x |
| 28 | + |
| 29 | + - name: Set branch name |
| 30 | + run: echo "action_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV |
| 31 | + |
| 32 | + - name: Set base URL |
| 33 | + run: echo "action_projname=${PWD##*/}" >> $GITHUB_ENV |
| 34 | + |
| 35 | + - name: Quick Build |
| 36 | + run: WARN_PATH="output/SanityChecksOutput.md" make |
| 37 | + |
| 38 | + |
| 39 | + - name: Branch Test |
| 40 | + run: | |
| 41 | + branchname=$(echo ${GITHUB_REF#refs/heads/}) |
| 42 | + if [[ $branchname =~ [0-9] ]]; then |
| 43 | + echo "action_is_release=YES" >> $GITHUB_ENV |
| 44 | + else |
| 45 | + echo "action_is_release=NO" >> $GITHUB_ENV |
| 46 | + fi |
| 47 | + |
| 48 | + # PDFify |
| 49 | + - name: PDFify |
| 50 | + run: | |
| 51 | + wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb |
| 52 | + sudo apt install -y ./wkhtmltox_0.12.6.1-3.jammy_amd64.deb && rm wkhtmltox_0.12.6.1-3.jammy_amd64.deb |
| 53 | + sudo apt install -y xvfb |
| 54 | + cd output |
| 55 | + for aa in *.html; do |
| 56 | + xvfb-run --auto-servernum --server-args='-screen 0, 1024x768x16' $(which wkhtmltopdf) \ |
| 57 | + --enable-local-file-access --javascript-delay 15000 --footer-right '[page]' \ |
| 58 | + file://${PWD}/${aa}?expand=on ${aa}.pdf |
| 59 | + done |
| 60 | +
|
| 61 | + - id: validate |
| 62 | + run: | |
| 63 | + RNG_OUT="output/ValidationReport.txt" make validate || true |
| 64 | +
|
| 65 | + - name: Set valerrors |
| 66 | + run: echo "action_valerrors=$(wc -l output/ValidationReport.txt | { read first rest ; echo $first ; } )" >> $GITHUB_ENV |
| 67 | + |
| 68 | + - id: spellcheck |
| 69 | + run: | |
| 70 | + SPELL_OUT="output/SpellCheckReport.txt" make spellcheck |
| 71 | +
|
| 72 | + - name: Set spellerrors |
| 73 | + run: echo "action_spellerrors=$(wc -l output/SpellCheckReport.txt | { read first rest ; echo $first ; } )" >> $GITHUB_ENV |
| 74 | + |
| 75 | + - name: Get Transforms Date |
| 76 | +# run: echo "action_tdate=2002222" >> $GITHUB_ENV |
| 77 | + run: echo "action_tdate=$(cd transforms && git log -1 --format=%cs; cd ->/dev/null)" >> $GITHUB_ENV |
| 78 | + |
| 79 | +# - name: Get DaisyDiff |
| 80 | +# run: | |
| 81 | +# wget -O- https://github.com/AndroidKitKat/ExecuteDaisy/archive/master.zip | jar -x |
| 82 | +# [ -d "output/images" ] || mkdir "output/images"; |
| 83 | +# cp -u -r ExecuteDaisy-master/js ExecuteDaisy-master/css output; |
| 84 | +# cp -u ExecuteDaisy-master/images/* output/images; |
| 85 | + |
| 86 | + |
| 87 | + - name: Make tmp dir |
| 88 | + run: mkdir tmp |
| 89 | + |
| 90 | +# - name: diff |
| 91 | +# run: TMP=tmp make diff || true; |
| 92 | + # Little diff depends on having a git history. |
| 93 | + # The current checkout has depth=1 and has no history |
| 94 | + #- name: little diff |
| 95 | + # run: make little-diff || true |
| 96 | + |
| 97 | + - name: Outstanding TDs |
| 98 | + id: tds |
| 99 | + run: | |
| 100 | + if [ "${{steps.extract_branch.outputs.branch}}" == "master" ] && |
| 101 | + ls input/tds/*.xml ; then |
| 102 | + echo "Master branch should not have TDs" >> output/TDValidationReport.txt |
| 103 | + fi |
| 104 | + # make effective |
| 105 | + # PP_XML=output/effective.xml RNG_OUT=output/TDValidationReport.txt make validate || true |
| 106 | + # IF STATEMENT HERE |
| 107 | + # PP_XML=output/effective.xml PP_RELEASE_HTML=output/AppliedTDs.html make release |
| 108 | + # java -jar ExecuteDaisy-master/*.jar output/*-release.html output/AppliedTDs.html --file=output/AppliedTDs-Diff.html |
| 109 | + |
| 110 | + - name: Set TD badge attributes |
| 111 | + run: | |
| 112 | + NUM=$(ls input/tds/*.xml | wc -l) |
| 113 | + if [ $NUM == 0 ]; then |
| 114 | + echo "action_tdcolor=gray" >> $GITHUB_ENV |
| 115 | + echo "action_tdwarns=N/A" >> $GITHUB_ENV |
| 116 | + echo "GOING THROUGH HERE $NUM" |
| 117 | + else |
| 118 | + echo "action_tdcolor=$(if [ -s output/TDValidationReport.txt ]; then echo orange; else echo green; fi)" >> $GITHUB_ENV |
| 119 | + echo "action_tdwarns=$NUM:$(wc -l output/TDValidationReport.txt | { read first rest ; echo $first;})" >> $GITHUB_ENV |
| 120 | + echo "THERE ARE TDs $NUM" |
| 121 | + |
| 122 | + fi |
| 123 | + # Not sure what the point of this is |
| 124 | + - name: Validate Effective |
| 125 | + run: | |
| 126 | + echo "action_effvalcolor=$(if [ -s output/TDValidationReport.txt ]; then echo orange; else echo green; fi)" >> $GITHUB_ENV |
| 127 | + echo "action_effvalwarns=$(wc -l output/TDValidationReport.txt | { read first rest ; echo $first;} )" >> $GITHUB_ENV |
| 128 | +
|
| 129 | +
|
| 130 | + - name: Prepare environment |
| 131 | + run: | |
| 132 | + # Generates a GitHub Workflow output named `lines` with a coverage value |
| 133 | + echo "action_spellcolor=$(if [ 0 = ${{ env.action_spellerrors }} ]; then echo green; else echo red; fi)" >> $GITHUB_ENV |
| 134 | + echo "action_valcolor=$(if [ 0 = ${{ env.action_valerrors }} ]; then echo green; else echo red; fi)" >> $GITHUB_ENV |
| 135 | + echo "action_sanitystatus=$(if [ -s output/SanityChecksOutput.md ]; then echo some; else echo none; fi)" >> $GITHUB_ENV |
| 136 | + echo "action_sanitycolor=$(if [ -s output/SanityChecksOutput.md ]; then echo red; else echo green; fi )" >> $GITHUB_ENV |
| 137 | + |
| 138 | +
|
| 139 | +
|
| 140 | + - name: Generate the spelling badge SVG image |
| 141 | + uses: emibcn/badge-action@v2.0.2 |
| 142 | + with: |
| 143 | + label: 'Misspellings' |
| 144 | + status: ${{ env.action_spellerrors }} |
| 145 | + color: ${{ env.action_spellcolor }} |
| 146 | + path: output/spell-badge.svg |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + - name: Generate the validation badge SVG image |
| 151 | + uses: emibcn/badge-action@v2.0.2 |
| 152 | + with: |
| 153 | + label: 'Validation' |
| 154 | + status: ${{ env.action_valerrors }} |
| 155 | + color: ${{ env.action_valcolor }} |
| 156 | + path: output/validation.svg |
| 157 | + |
| 158 | + |
| 159 | + - name: Generate the warnings badge |
| 160 | + uses: emibcn/badge-action@v2.0.2 |
| 161 | + with: |
| 162 | + label: 'Warnings' |
| 163 | + status: ${{ env.action_sanitystatus }} |
| 164 | + color: ${{ env.action_sanitycolor }} |
| 165 | + path: output/warnings.svg |
| 166 | + |
| 167 | + |
| 168 | + - name: Generate the transforms badge |
| 169 | + uses: emibcn/badge-action@v2.0.2 |
| 170 | + with: |
| 171 | + label: 'Transforms' |
| 172 | + status: ${{ env.action_tdate }} |
| 173 | + color: gray |
| 174 | + path: output/transforms.svg |
| 175 | + |
| 176 | + - name: TD Badge |
| 177 | + uses: emibcn/badge-action@v2.0.2 |
| 178 | + with: |
| 179 | + label: 'TDs' |
| 180 | + status: ${{ env.action_tdwarns }} |
| 181 | + color: ${{ env.action_tdcolor }} |
| 182 | + path: output/tds.svg |
| 183 | + |
| 184 | + - name: Make Dashboard Snippet |
| 185 | + run: | |
| 186 | + rurl="https://raw.githubusercontent.com/commoncriteria/${{env.action_projname}}/gh-pages/${{env.action_branch}}" |
| 187 | + surl="https://commoncriteria.github.io/${{env.action_projname}}/${{env.action_branch}}" |
| 188 | + gurl="https://github.com/commoncriteria/${{env.action_projname}}/blob/gh-pages/${{env.action_branch}}" |
| 189 | + ( |
| 190 | + echo '[cols="1,1,1,1,1,1,1,1"]' |
| 191 | + echo '|===' |
| 192 | + echo "8+|${{ env.action_projname }} " |
| 193 | + echo "| https://github.com/commoncriteria/${{env.action_projname}}/tree/${{env.action_branch}}[${{ env.action_branch }}] " |
| 194 | + echo "a| $surl/${{env.action_projname}}-release.html[📄]" |
| 195 | + echo "a|[link=$gurl/ValidationReport.txt]" |
| 196 | + echo "image::$rurl/validation.svg[Validation]" |
| 197 | + echo "a|[link=$gurl/SanityChecksOutput.md]" |
| 198 | + echo "image::$rurl/warnings.svg[SanityChecks]" |
| 199 | + echo "a|[link=$gurl/SpellCheckReport.txt]" |
| 200 | + echo "image::$rurl/spell-badge.svg[SpellCheck]" |
| 201 | + echo "a|[link=$gurl/TDValidationReport.txt]" |
| 202 | + echo "image::$rurl/tds.svg[TDs]" |
| 203 | + echo "a|image::$rurl/transforms.svg[transforms,150]" |
| 204 | + echo "a| [link=$gurl/HTMLs.adoc]" |
| 205 | + echo "image::$rurl/html_count.svg[HTML Count]" |
| 206 | + echo "[link=$gurl/PDFs.adoc]" |
| 207 | + echo "image::$rurl/pdf_count.svg[PDF Count]" |
| 208 | + echo '|===' |
| 209 | + ) > output/Minidash.adoc |
| 210 | +
|
| 211 | +
|
| 212 | + - name: HTML List |
| 213 | + run: | |
| 214 | + surl="https://commoncriteria.github.io/${{env.action_projname}}/${{env.action_branch}}" |
| 215 | + ( for aa in output/*.html ; do |
| 216 | + echo "* $surl/${aa#*/}[${aa#*/}]" |
| 217 | + done ) > output/HTMLs.adoc |
| 218 | + HTML_COUNT=$(wc -l < output/HTMLs.adoc) |
| 219 | + echo "action_html_count=$HTML_COUNT" >> $GITHUB_ENV |
| 220 | +
|
| 221 | + - name: PDF List |
| 222 | + run: | |
| 223 | + surl="https://commoncriteria.github.io/${{env.action_projname}}/${{env.action_branch}}" |
| 224 | + cd output |
| 225 | + (for aa in $(find . -name '*.pdf') ; do |
| 226 | + echo "* $surl/${aa#*/}[${aa#*/}]" |
| 227 | + done ) > PDFs.adoc |
| 228 | + PDF_COUNT=$(wc -l < PDFs.adoc) |
| 229 | + echo "action_pdf_count=$PDF_COUNT" >> $GITHUB_ENV |
| 230 | +
|
| 231 | +
|
| 232 | + - name: HTML Badge |
| 233 | + uses: emibcn/badge-action@v2.0.2 |
| 234 | + with: |
| 235 | + label: 'HTMLs' |
| 236 | + status: ${{ env.action_html_count }} |
| 237 | + color: gray |
| 238 | + path: output/html_count.svg |
| 239 | + |
| 240 | + - name: PDF Badge |
| 241 | + uses: emibcn/badge-action@v2.0.2 |
| 242 | + with: |
| 243 | + label: 'PDFs' |
| 244 | + status: ${{ env.action_pdf_count }} |
| 245 | + color: gray |
| 246 | + path: output/pdf_count.svg |
| 247 | + |
| 248 | + |
| 249 | + - name: Prepare checkout |
| 250 | + run: | |
| 251 | + mkdir gh-pages |
| 252 | +
|
| 253 | + - uses: actions/checkout@v3 |
| 254 | + with: |
| 255 | + ref: gh-pages |
| 256 | + path: gh-pages |
| 257 | + |
| 258 | + |
| 259 | + - name: Move output to branch |
| 260 | + run: | |
| 261 | + rm -rf gh-pages/${{ env.action_branch }} |
| 262 | + mv output gh-pages/${{ env.action_branch }} |
| 263 | + |
| 264 | + - name: Make listing |
| 265 | + run: | |
| 266 | + cd gh-pages |
| 267 | + (echo "<html><head><title>Listing</title></head><body>"; |
| 268 | + date; |
| 269 | + echo "<br/><ol>"; |
| 270 | + for aa in $(find . -name '*.*'); do |
| 271 | + echo "<li><a href='$aa'>$aa</a></li>"; |
| 272 | + done; |
| 273 | + echo "</ol></body></html>") > index.html |
| 274 | + |
| 275 | + - name: Deploy 🚀 |
| 276 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 277 | + with: |
| 278 | + branch: gh-pages # The branch the action should deploy to. |
| 279 | + folder: gh-pages # The folder the action should deploy. |
0 commit comments