-
Notifications
You must be signed in to change notification settings - Fork 7
205 lines (202 loc) · 6.89 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
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 artifact
uses: actions/upload-artifact@master
with:
name: book-${{ matrix.smalltalk }}
path: SBE-${{ matrix.smalltalk }}.pdf
- 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! 😱"