Skip to content

Commit 6e84440

Browse files
bweigelclaudegithub-actionsCopilot
authored
feat: add Amazon Linux 2023 support and remove AL1 (#266)
* feat: add Amazon Linux 2023 support and remove AL1 - Add Dockerfile.al2023 with Python 3.12 and Node.js 20 support - Remove Dockerfile.al1 (Amazon Linux 1 deprecated by AWS) - Add AL2023 layer and test functions to CDK integration stack - Fix AL2 C++17 support for Tesseract 5.5.2 compatibility - Add COMPILER_FLAGS ARG for customizable compiler options - Link stdc++fs library for AL2 filesystem support - Add comprehensive migration guide from AL2 to AL2023 - Update all documentation to recommend AL2023 - Add deprecation notices for AL2 (6-month sunset period) - Update release workflow to produce both AL2 and AL2023 artifacts - Add integration tests for Python 3.12 and Node.js 20 on AL2023 Breaking Changes: - Amazon Linux 1 (AL1) support removed - Amazon Linux 2 (AL2) is now deprecated (6-month sunset) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: ensure CXXFLAGS passed to make command for both AL2 and AL2023 - Pass CXXFLAGS to make command in addition to configure - Ensures C++17 flags are applied during compilation, not just configuration * fix: disable AL2 build due to GCC 7.3.1 C++17 limitations - Comment out AL2 layer and test functions in CDK integration - AL2's GCC 7.3.1 lacks <filesystem> header required by Tesseract 5.5.2 - Keep AL2023 build which works with modern GCC - AL2 users can build locally with Tesseract 5.4.x or earlier - Update documentation with AL2 technical limitation note - CI now only builds and tests AL2023 (Python 3.12, Node.js 20) - AL2 Dockerfile remains available for local builds * fix: install xz package for AL2023 build - AL2023 base image doesn't include xz by default - Required to decompress autoconf-archive .tar.xz file * fix: libtiff path * fix: provide libwebpmux * chore: self mutation Signed-off-by: github-actions <github-actions@github.com> * Update README.md * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * docs: update examples to use Amazon Linux 2023 with Python 3.12 Update example projects (Serverless Framework and CDK) to use AL2023 with Python 3.12 runtime instead of deprecated AL2 with Python 3.8. This aligns the examples with the README's advertised support and recommended best practices. Changes: - Update serverless.yml to use amazonlinux-2023 layer and python3.12 runtime - Update CDK example to use amazonlinux-2023 layer and Python 3.12 runtime - Update Docker base images to use public.ecr.aws/sam/build-python3.12:latest - Update all READMEs to reflect AL2023 and Python 3.12 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Signed-off-by: github-actions <github-actions@github.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 67f69e9 commit 6e84440

34 files changed

+574
-110
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/update-tesseract.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ jobs:
3434
fetch-depth: 1
3535
- name: update-dockerfile
3636
run: |
37-
sed -i 's/\(TESSERACT_VERSION=\)[0-9\.]*$/\1${{ steps.tesseract.outputs.result }}/g' Dockerfile.al1
3837
sed -i 's/\(TESSERACT_VERSION=\)[0-9\.]*$/\1${{ steps.tesseract.outputs.result }}/g' Dockerfile.al2
39-
sed -i 's/\(LEPTONICA_VERSION=\)[0-9\.]*$/\1${{ steps.leptonica.outputs.result }}/g' Dockerfile.al1
38+
sed -i 's/\(TESSERACT_VERSION=\)[0-9\.]*$/\1${{ steps.tesseract.outputs.result }}/g' Dockerfile.al2023
4039
sed -i 's/\(LEPTONICA_VERSION=\)[0-9\.]*$/\1${{ steps.leptonica.outputs.result }}/g' Dockerfile.al2
40+
sed -i 's/\(LEPTONICA_VERSION=\)[0-9\.]*$/\1${{ steps.leptonica.outputs.result }}/g' Dockerfile.al2023
4141
- name: update-README
4242
run: |
4343
sed -i 's/\(https:\/\/img\.shields\.io\/badge\/Tesseract-\)\(v\?\([0-9]\+\.\?\)\{3\}\)\(-green\)/\1${{ steps.tesseract.outputs.result }}\4/g' README.md

.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

Lines changed: 23 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,16 @@ const project = new awscdk.AwsCdkTypeScriptApp({
2020
srcdir: 'continous-integration',
2121
// Use built-in dep upgrades
2222
dependabot: false,
23-
gitignore: ['layer', '.serverless', '.mypy_cache', '*.zip', '**/*test-output.txt', 'cdk.out/'],
23+
gitignore: [
24+
'layer',
25+
'.serverless',
26+
'.mypy_cache',
27+
'*.zip',
28+
'**/*test-output.txt',
29+
'py312-test-output.txt',
30+
'node20-test-output.txt',
31+
'cdk.out/',
32+
],
2433
autoApproveUpgrades: false,
2534
depsUpgrade: true,
2635
depsUpgradeOptions: {
@@ -115,33 +124,68 @@ class BinaryPatchComponent extends Component {
115124

116125
new BinaryPatchComponent(project);
117126

118-
project.addTask(`test:integration:python`, {
127+
// AL2 integration tests temporarily disabled (AL2 deprecated, GCC 7.3.1 incompatible with Tesseract 5.5.2)
128+
// project.addTask(`test:integration:python`, {
129+
// steps: [
130+
// {
131+
// spawn: `synth:silent`,
132+
// },
133+
// {
134+
// exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json python --no-event > py-test-output.txt && cat py-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
135+
// },
136+
// ],
137+
// });
138+
// project.addTask(`test:integration:node`, {
139+
// steps: [
140+
// {
141+
// spawn: `synth:silent`,
142+
// },
143+
// {
144+
// exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json node --no-event > node-test-output.txt && cat node-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
145+
// },
146+
// ],
147+
// });
148+
project.addTask(`test:integration:python312`, {
119149
steps: [
120150
{
121151
spawn: `synth:silent`,
122152
},
123153
{
124-
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json python --no-event > py-test-output.txt && cat py-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
154+
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json python312 --no-event > py312-test-output.txt && cat py312-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
125155
},
126156
],
127157
});
128-
project.addTask(`test:integration:node`, {
158+
project.addTask(`test:integration:node20`, {
129159
steps: [
130160
{
131161
spawn: `synth:silent`,
132162
},
133163
{
134-
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json node --no-event > node-test-output.txt && cat node-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
164+
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json node20 --no-event > node20-test-output.txt && cat node20-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
135165
},
136166
],
137167
});
138-
const testIntegration = project.addTask(`test:integration`, {
168+
project.addTask(`test:integration:al2023`, {
139169
steps: [
140170
{
141-
spawn: `test:integration:python`,
171+
spawn: `test:integration:python312`,
142172
},
143173
{
144-
spawn: `test:integration:node`,
174+
spawn: `test:integration:node20`,
175+
},
176+
],
177+
});
178+
const testIntegration = project.addTask(`test:integration`, {
179+
steps: [
180+
// AL2 tests disabled (see note about AL2 build issue in continous-integration/main.ts)
181+
// {
182+
// spawn: `test:integration:python`,
183+
// },
184+
// {
185+
// spawn: `test:integration:node`,
186+
// },
187+
{
188+
spawn: `test:integration:al2023`,
145189
},
146190
],
147191
});
@@ -150,18 +194,32 @@ const bundle = project.addTask(`bundle:binary`, {
150194
{
151195
spawn: `synth:silent`,
152196
},
197+
// AL2 bundling disabled (see note about AL2 build issue in continous-integration/main.ts)
198+
// AL2 users can build locally with older Tesseract if needed
199+
// {
200+
// exec: `rm -rf ./ready-to-use/amazonlinux-2/*`,
201+
// },
202+
// {
203+
// exec: `cp -r cdk.out/$(cat cdk.out/tesseract-lambda-ci.template.json | jq -r '.Resources.al2layer.Metadata.\"aws:asset:path\"')/. ./ready-to-use/amazonlinux-2`,
204+
// },
205+
// AL2023 bundling
206+
{
207+
exec: `mkdir -p ./ready-to-use/amazonlinux-2023`,
208+
},
153209
{
154-
exec: `rm -rf ./ready-to-use/amazonlinux-2/*`,
210+
exec: `rm -rf ./ready-to-use/amazonlinux-2023/*`,
155211
},
156212
{
157-
exec: `cp -r cdk.out/$(cat cdk.out/tesseract-lambda-ci.template.json | jq -r '.Resources.al2layer.Metadata.\"aws:asset:path\"')/. ./ready-to-use/amazonlinux-2`,
213+
exec: `cp -r cdk.out/$(cat cdk.out/tesseract-lambda-ci.template.json | jq -r '.Resources.al2023layer.Metadata.\"aws:asset:path\"')/. ./ready-to-use/amazonlinux-2023`,
158214
},
159215
],
160216
});
161217
project.packageTask.prependSpawn(testIntegration);
162218
project.packageTask.prependSpawn(bundle);
163219
project.packageTask.prependExec(`mkdir -p ./dist`);
164-
project.packageTask.exec(`zip -r ../../dist/tesseract-al2-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2' });
220+
// AL2 packaging disabled (see note about AL2 build issue in continous-integration/main.ts)
221+
// project.packageTask.exec(`zip -r ../../dist/tesseract-al2-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2' });
222+
project.packageTask.exec(`zip -r ../../dist/tesseract-al2023-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2023' });
165223
project.addTask('upgrade:ci:py', {
166224
steps: [
167225
{
@@ -209,7 +267,7 @@ project.release?.addJobs({
209267
GITHUB_REPOSITORY: '${{ github.repository }}',
210268
GITHUB_REF: '${{ github.ref }}',
211269
},
212-
run: 'errout=$(mktemp); gh release upload $(cat dist/releasetag.txt) --clobber -R $GITHUB_REPOSITORY dist/tesseract-al2-x86.zip 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi',
270+
run: 'errout=$(mktemp); gh release upload $(cat dist/releasetag.txt) --clobber -R $GITHUB_REPOSITORY dist/tesseract-al2023-x86.zip 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi',
213271
},
214272
],
215273
},

0 commit comments

Comments
 (0)