Skip to content

Commit

Permalink
Refactor GitHub Actions workflow file
Browse files Browse the repository at this point in the history
- Let's make the workflow a bit more readable.

- Let's make sure we run the new AddQRCode sample in CI.
  • Loading branch information
datalogics-saharay committed Mar 14, 2024
1 parent 36e2cf1 commit 5885937
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/test-dotnet-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
'ContentCreation/WriteNChannelTiff/',
'ContentModification/Action/',
'ContentModification/AddCollection/',
'ContentModification/AddQRCode/',
'ContentModification/ChangeLayerConfiguration/',
'ContentModification/ChangeLinkColors/',
'ContentModification/CreateLayer/',
Expand Down Expand Up @@ -101,38 +102,38 @@ jobs:
'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
working-directory: ${{ matrix.dir }}
run: |
sample_name=$(basename "$PWD")
if [ "${{ matrix.os }}" == 'ubuntu-latest' ]; then
case "$sample_name" in "AddHeaderFooter" | "AddElements" | "MakeDocWithCalGrayColorSpace" | "MakeDocWithCalRGBColorSpace" | "MakeDocWithDeviceNColorSpace" | "MakeDocWithICCBasedColorSpace" | "MakeDocWithIndexedColorSpace" | "MakeDocWithLabColorSpace" | "MakeDocWithSeparationColorSpace" | "ExtendedGraphicStates" | "AddGlyphs" | "AddUnicodeText")
echo 'ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true' | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
;;
echo 'ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true' | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
;;
esac
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: |
Expand All @@ -159,13 +160,12 @@ jobs:
echo "Not available on this os"
fi
fi
- name: Set sample_name variable
id: set-sample-name
working-directory: ${{matrix.dir}}
run: |
sample_name=$(basename "$PWD")
echo "SAMPLE_NAME=$sample_name" >> "$GITHUB_ENV"
echo "Set $sample_name as SAMPLE_NAME environment variable"
run: echo "SAMPLE_NAME=$(basename "$PWD")" >> "$GITHUB_ENV"

- name: Save artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -185,3 +185,7 @@ jobs:
${{matrix.dir}}*.json
${{matrix.dir}}*.txt
${{matrix.dir}}*.csv
- name: List files
run: |
ls ${{matrix.dir}}

0 comments on commit 5885937

Please sign in to comment.