Skip to content

avoid duplicate #withBlanksTrimmed #562

avoid duplicate #withBlanksTrimmed

avoid duplicate #withBlanksTrimmed #562

Workflow file for this run

name: 📕 Make Book
on:
push:
schedule:
- cron: "0 0 * * 1" # every monday
workflow_dispatch:
inputs:
draft-release:
description: 'Draft an actual release (instead of creating a pre-release)'
type: boolean
required: false
default: false
squeak-versions:
description: 'List of Squeak versions to test (JSON array)'
type: string
required: false
default: '["Trunk", "6.0"]'
scale-factor:
description: 'Scale factor for screenshots'
type: number
required: false
default: '2.5'
# not yet implemented: https://github.community/t/how-to-set-and-access-a-workflow-variable/17335/6?u=linqlover
# ---
#env:
# os: ubuntu-latest
# fail-fast: false
# smalltalks: "[Trunk, '6.0']"
#---
jobs:
args:
name: 📦 Prepare arguments
runs-on: ubuntu-latest
outputs:
draft-release: ${{ steps.prepare.outputs.draft-release }}
squeak-versions: ${{ steps.prepare.outputs.squeak-versions }}
scale-factor: ${{ steps.prepare.outputs.scale-factor }}
steps:
- name: Prepare
id: prepare
run: |
echo "draft-release=${{ inputs.draft-release && true || false }}" >> $GITHUB_OUTPUT
echo 'squeak-versions<<EOF
${{ toJson(fromJson(inputs.squeak-versions || '["Trunk", "6.0"]')) }}
EOF' >> $GITHUB_OUTPUT
echo "scale-factor=${{ inputs.scale-factor || '2.5' }}" >> $GITHUB_OUTPUT
tests:
name: 🐞 Internal tests [${{ matrix.smalltalk }}]
needs: [args]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: ${{ fromJson(needs.args.outputs.squeak-versions) }}
steps:
- uses: actions/checkout@v3
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: Squeak64-${{ matrix.smalltalk }}
- name: Run SmalltalkSources tests
run: smalltalkci -s Squeak64-${{ matrix.smalltalk }} SBE-Tests.smalltalk.ston
timeout-minutes: 15
env:
GITHUB_TOKEN: ${{ github.token }} # for coverage reports
tex-assertions:
name: 🧪 @TEST assertions [${{ matrix.smalltalk }}]
needs: [args]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: ${{ fromJson(needs.args.outputs.squeak-versions) }}
steps:
- uses: actions/checkout@v3
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: Squeak64-${{ matrix.smalltalk }}
- name: Run TEX assertions
run: smalltalkci -s Squeak64-${{ matrix.smalltalk }} SBE-Testing.smalltalk.ston
timeout-minutes: 15
listings:
name: 📄 Collect listings from SmalltalkSources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make listings
- name: 💾 Store listings
uses: actions/upload-artifact@master
with:
name: listings
path: ListingSources
build:
name: 📖 Build book [${{ matrix.smalltalk }}]
needs: [args, listings]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: ${{ fromJson(needs.args.outputs.squeak-versions) }}
steps:
- uses: actions/checkout@v3
- uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: Squeak64-${{ matrix.smalltalk }}
- id: figures
name: 🖼 Build Squeak figures
run: smalltalkci -s Squeak64-${{ matrix.smalltalk }} SBE-Extract.smalltalk.ston
timeout-minutes: 30
continue-on-error: true
env:
SBE_SCALE_FACTOR: ${{ needs.args.outputs.scale-factor }}
- if: (steps.figures.outcome == 'failure')
name: Configure DEBUG_FIGURES
run: |
echo ::warning::jobs.figures has failed, compiling PDF with missing figures
echo "DEBUG_FIGURES=true" >> $GITHUB_ENV
- name: Load listings
uses: actions/download-artifact@master
with:
name: listings
path: ListingSources
- name: ⚙ Compile PDF
uses: xu-cheng/texlive-action/full@v1
with:
run: |
apk add make
make
env:
SQUEAK_VERSION: ${{ matrix.smalltalk }}
BASH_V5: true
- name: Rename PDF
run: mv SBE.pdf SBE-${{ matrix.smalltalk }}.pdf
env:
SQUEAK_VERSION: ${{ matrix.smalltalk }}
- name: 💾 Upload PDF
uses: actions/upload-artifact@master
with:
name: book-${{ matrix.smalltalk }}
path: SBE-${{ matrix.smalltalk }}.pdf
- name: 💾 Upload figures (for debugging and local builds)
# run even if figures failed but only when it has run
if: steps.figures.outcome == 'success' || steps.figures.outcome == 'failure'
uses: actions/upload-artifact@master
with:
name: figures-${{ matrix.smalltalk }}
path: ./*/**/*.png
- if: (steps.figures.outcome == 'failure')
name: Check DEBUG_FIGURES
run: |
echo ::error::jobs.figures has failed, so the compiled PDF might miss some figures!
echo "DEBUG_FIGURES=true" >> $GITHUB_ENV
exit 1
release:
name: Create release
needs: [args, tests, tex-assertions, build]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Load artifacts
uses: actions/download-artifact@master
with:
path: .
- uses: thedoctor0/zip-release@master
with:
filename: ListingSources.zip
path: listings
- uses: benjlevesque/[email protected]
id: short-sha
- name: 📣 ${{ fromJson(needs.args.outputs.draft-release) && 'Draft release' || 'Create pre-release' }}
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: untagged-${{ steps.short-sha.outputs.sha }}
body: ${{ github.event.head_commit.message }}
files: |
book-*/SBE-*.pdf
ListingSources.zip
prerelease: ${{ !fromJson(needs.args.outputs.draft-release) }}
draft: ${{ fromJson(needs.args.outputs.draft-release) }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Delete older pre-releases
uses: dev-drprasad/[email protected]
if: ${{ !fromJson(needs.args.outputs.draft-release) }}
with:
delete_tag_pattern: untagged-
keep_latest: 1
delete_tags: true
env:
GITHUB_TOKEN: ${{ github.token }}
notify:
name: 📣 Notify community on failure
needs: [tests, tex-assertions, build]
if: always()
runs-on: ubuntu-latest
steps:
- if: |
github.event_name == 'schedule' && (
needs.tests.result == 'failure'
|| needs.build.result == 'failure'
|| needs.tex-assertions.result == 'failure')
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: "GitHub Actions"
SLACK_COLOR: danger
SLACK_ICON: https://avatars1.githubusercontent.com/u/65916846?v=4
SLACK_TITLE: "Build failed!"
SLACK_MESSAGE: "Oh no, the latest scheduled CI build for SqueakByExample failed! 😱"