From 5df90a553c552cdf52b3362074d3fa2cc822a73e Mon Sep 17 00:00:00 2001 From: Sahara Yousuf Date: Thu, 18 Apr 2024 16:10:09 -0500 Subject: [PATCH] Run macOS CI first --- .github/workflows/test.yml | 104 +++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6f23f6e..d7ad696 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -107,16 +107,12 @@ jobs: - name: Print message run: echo "Set MATRIX_DIR environment variable as output" - run-samples-windows: - runs-on: windows-latest + run-samples-macos: + runs-on: macos-14 needs: [get-matrix-dir-from-env] - defaults: - run: - shell: bash strategy: - fail-fast: false matrix: - dir: ${{ fromJSON(needs.get-matrix-dir-from-env.outputs.MATRIX_DIR) }} + dir: ${{ fromJSON(needs.get-matrix-dir-from-env.outputs.MATRIX_DIR) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -129,18 +125,26 @@ jobs: - name: Build samples working-directory: ${{ matrix.dir }} run: | - dotnet build -c Release *.csproj + 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: Run samples working-directory: ${{ matrix.dir }} run: | sample_name=$(basename "$PWD") - if [[ "$sample_name" == "DocToImages" ]]; then - bin/Release/net6.0/$sample_name.exe -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf - else - bin/Release/net6.0/$sample_name.exe - fi - + if [[ ("$sample_name" != "ConvertToOffice" && "$sample_name" != "CreateDocFromXPS") || "${{ matrix.os }}" != 'macos-14' ]]; then + if [[ "$sample_name" == "DocToImages" ]]; then + dotnet bin/Release/net6.0/$sample_name.dll -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf + else + dotnet bin/Release/net6.0/$sample_name.dll + fi + else + echo "Not available on this os" + fi - name: Set sample_name variable working-directory: ${{ matrix.dir }} @@ -170,13 +174,17 @@ jobs: - name: List files run: ls ${{ matrix.dir }} - run-samples-ubuntu: - runs-on: ubuntu-latest + + run-samples-windows: + runs-on: windows-latest + needs: [get-matrix-dir-from-env, run-samples-macos] + defaults: + run: + shell: bash strategy: fail-fast: false matrix: - dir: ${{ fromJSON(vars.MATRIX_DIR) }} - needs: [run-samples-windows] + dir: ${{ fromJSON(needs.get-matrix-dir-from-env.outputs.MATRIX_DIR) }} steps: - name: Checkout uses: actions/checkout@v4 @@ -186,16 +194,6 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Setup Microsoft Core Fonts - run: | - sample_name=$(basename "$PWD") - 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 -y ttf-mscorefonts-installer - ;; - esac - - name: Build samples working-directory: ${{ matrix.dir }} run: | @@ -205,16 +203,15 @@ jobs: working-directory: ${{ matrix.dir }} run: | sample_name=$(basename "$PWD") - if [[ "$sample_name" == "Redactions" && "${{ matrix.os }}" == 'ubuntu-latest' ]]; then - echo "Not available on this os" + if [[ "$sample_name" == "DocToImages" ]]; then + bin/Release/net6.0/$sample_name.exe -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf else - if [[ "$sample_name" == "DocToImages" ]]; then - dotnet bin/Release/net6.0/$sample_name.dll -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf - else - dotnet bin/Release/net6.0/$sample_name.dll - fi + bin/Release/net6.0/$sample_name.exe + fi + - name: Set sample_name variable + working-directory: ${{ matrix.dir }} id: set-sample-name run: echo "SAMPLE_NAME=$(basename "$PWD")" >> "$GITHUB_ENV" @@ -241,12 +238,13 @@ jobs: - name: List files run: ls ${{ matrix.dir }} - run-samples-macos: - runs-on: macos-14 + run-samples-ubuntu: + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: dir: ${{ fromJSON(vars.MATRIX_DIR) }} - needs: [run-samples-ubuntu] + needs: [run-samples-windows] steps: - name: Checkout uses: actions/checkout@v4 @@ -256,28 +254,32 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Setup Microsoft Core Fonts + run: | + sample_name=$(basename "$PWD") + 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 -y ttf-mscorefonts-installer + ;; + esac + - 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 + dotnet build -c Release *.csproj - 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 [[ "$sample_name" == "DocToImages" ]]; then - dotnet bin/Release/net6.0/$sample_name.dll -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf - else - dotnet bin/Release/net6.0/$sample_name.dll - fi + if [[ "$sample_name" == "Redactions" && "${{ matrix.os }}" == 'ubuntu-latest' ]]; then + echo "Not available on this os" + else + if [[ "$sample_name" == "DocToImages" ]]; then + dotnet bin/Release/net6.0/$sample_name.dll -format=png $HOME/.nuget/packages/adobe.pdf.library.sampleinput/1.0.0/build/Resources/Sample_Input/ducky.pdf else - echo "Not available on this os" + dotnet bin/Release/net6.0/$sample_name.dll fi - name: Set sample_name variable