Skip to content

APDFL-5452: Add CI for samples #44

APDFL-5452: Add CI for samples

APDFL-5452: Add CI for samples #44

name: test-samples
on:
pull_request:
push:
branches: [ develop, main ]
env:
DOTNET_VERSION: '6.x'
jobs:
run-samples:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-14]
# TODO: AddHeaderFooter won't run due to Times-Roman font not present on runner.
# TODO: Some of the ContentCreation and Text samples require Microsoft Core Fonts to be installed on Linux.
# TODO: Factur-XConverter sample needs input PDF specified as command-line argument.
# TODO: ZUGFeRDConverter sample requires that input PDF and an input ZUGFeRD Invoice XML file be provided as command-line arguments.
# TODO: DocToImages sample requires input PDF as command line argument.
dir: [
'Annotations/Annotations/',
'Annotations/InkAnnotations/',
'Annotations/LinkAnnotation/',
'Annotations/PolygonAnnotations/',
'Annotations/PolyLineAnnotations/',
'ContentCreation/AddElements/',
'ContentCreation/AddHeaderFooter/',
'ContentCreation/Clips/',
'ContentCreation/CreateBookmarks/',
'ContentCreation/GradientShade/',
'ContentCreation/MakeDocWithCalGrayColorSpace/',
'ContentCreation/MakeDocWithCalRGBColorSpace/',
'ContentCreation/MakeDocWithDeviceNColorSpace/',
'ContentCreation/MakeDocWithICCBasedColorSpace/',
'ContentCreation/MakeDocWithIndexedColorSpace/',
'ContentCreation/MakeDocWithLabColorSpace/',
'ContentCreation/MakeDocWithSeparationColorSpace/',
'ContentCreation/NameTrees/',
'ContentCreation/NumberTrees/',
'ContentCreation/RemoteGoToActions/',
'ContentCreation/WriteNChannelTiff/',
'ContentModification/Action/',
'ContentModification/AddCollection/',
'ContentModification/ChangeLayerConfiguration/',
'ContentModification/ChangeLinkColors/',
'ContentModification/CreateLayer/',
'ContentModification/ExtendedGraphicStates/',
'ContentModification/FlattenTransparency/',
'ContentModification/LaunchActions/',
'ContentModification/MergePDF/',
'ContentModification/PageLabels/',
'ContentModification/PDFObject/',
'ContentModification/UnderlinesAndHighlights/',
'ContentModification/Watermark/',
'DocumentConversion/ColorConvertDocument/',
'DocumentConversion/ConvertToOffice/',
'DocumentConversion/CreateDocFromXPS/',
#'DocumentConversion/Factur-XConverter/',
'DocumentConversion/PDFAConverter/',
'DocumentConversion/PDFXConverter/',
#'DocumentConversion/ZUGFeRDConverter/',
'DocumentOptimization/PDFOptimize/',
#'Images/DocToImages/',
'Images/DrawSeparations/',
'Images/DrawToBitmap/',
'Images/EPSSeparations/',
'Images/GetSeparatedImages/',
'Images/ImageEmbedICCProfile/',
'Images/ImageExport/',
'Images/ImageExtraction/',
'Images/ImageFromStream/',
'Images/ImageImport/',
'Images/ImageResampling/',
'Images/ImageSoftMask/',
'Images/OutputPreview/',
'Images/RasterizePage/',
'InformationExtraction/ListBookmarks/',
'InformationExtraction/ListInfo/',
'InformationExtraction/ListLayers/',
'InformationExtraction/ListPaths/',
'InformationExtraction/Metadata/',
'OpticalCharacterRecognition/AddTextToDocument/',
'OpticalCharacterRecognition/AddTextToImage/',
'Other/MemoryFileSystem/',
'Other/StreamIO/',
'Security/AddRegexRedaction/',
'Security/Redactions/',
'Text/AddGlyphs/',
'Text/AddUnicodeText/',
'Text/AddVerticalText/',
'Text/ExtractAcroFormFieldData/',
'Text/ExtractCJKTextByPatternMatch/',
'Text/ExtractTextByPatternMatch/',
'Text/ExtractTextByRegion/',
'Text/ExtractTextFromAnnotations/',
'Text/ExtractTextFromMultiRegions/',
'Text/ExtractTextPreservingStyleAndPositionInfo/',
'Text/ListWords/',
'Text/RegexExtractText/',
'Text/RegexTextSearch/',
'Text/TextExtract/'
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Microsoft Core Fonts
run: |
if [ "${{ matrix.os }}" == 'ubuntu-latest' ]; then
sudo apt install ttf-mscorefonts-installer
fi
- name: Build samples
working-directory: ${{ matrix.dir }}
run: |
sample_name=$(basename "$PWD")
if { [ "$sample_name" != "ConvertToOffice" ] && [ "$sample_name" != "CreateDocFromXPS" ]; } || [ "${{ matrix.os }}" != 'macos-14' ]; then
dotnet build -c Release *.csproj
else
echo "Not available on this os"
fi
- name: List files
run: |
ls ${{matrix.dir}}
- name: Run samples
working-directory: ${{matrix.dir}}
run: |
sample_name=$(basename "$PWD")
if { [ "$sample_name" != "ConvertToOffice" ] && [ "$sample_name" != "CreateDocFromXPS" ]; } || [ "${{ matrix.os }}" != 'macos-14' ]; then
if [ "${{ matrix.os }}" == 'windows-latest' ]; then
bin/Release/net6.0/$sample_name.exe
else
dotnet bin/Release/net6.0/$sample_name.dll
fi
else
echo "Not available on this os"
fi