From 178fc01160f941897eff552eda7610e7a6905f99 Mon Sep 17 00:00:00 2001 From: Robert J Spencer Date: Tue, 27 Sep 2022 23:35:45 +0800 Subject: [PATCH] CI: reduce work by reorganising workflows and reusing --- .github/workflows/build.yaml | 76 +++++++++++++++++++++++++++++++ .github/workflows/deploy.yaml | 52 ++++++++++++--------- .github/workflows/integrate.yaml | 67 +++++++-------------------- docs/SL.png | Bin 0 -> 6780 bytes 4 files changed, 122 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 docs/SL.png diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e171f52 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,76 @@ +name: Build + +on: + workflow_call: + inputs: + project: + description: Name of the project (relatively short) + type: string + required: true + +defaults: + run: + shell: bash + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-22.04 + result: libsa.so + - os: macos-12 + result: libsa.dylib + - os: windows-2022 + result: bin/Release/sa.dll + fail-fast: false + env: + workingDir: build + finalDir: artifacts + defaults: + run: + shell: bash + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Configure + id: cmake + run: | + mkdir $workingDir && cd $workingDir + cmd="cmake .." + case "${RUNNER_OS}" in + Linux) $cmd -DCMAKE_BUILD_TYPE=Release ;; + macOS) $cmd -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ;; + Windows) $cmd -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES=Release ;; + *) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;; + esac + - name: Build + working-directory: ${{ env.workingDir }} + run: | + cmd="cmake --build ." + case "${RUNNER_OS}" in + Linux) $cmd ;; + macOS) $cmd ;; + Windows) $cmd --config Release ;; + *) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;; + esac + - name: Test + working-directory: ${{ env.workingDir }} + run: ctest + - name: Collect Files + run: | + mkdir $finalDir && cd $finalDir + cp $GITHUB_WORKSPACE/README.md . + cp $GITHUB_WORKSPACE/docs/SL.png . + cp $GITHUB_WORKSPACE/${{ env.workingDir }}/$lib . + ls -la + env: + lib: ${{ matrix.result }} + - uses: actions/upload-artifact@v3 + name: Artifacts + with: + name: ${{ inputs.project }}-${{ runner.os }} + path: ${{ env.finalDir }}/* + if-no-files-found: error diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a5f06f7..14d5764 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,14 +11,17 @@ defaults: jobs: metadata: - name: Collect Metadata + name: Collect uses: StirlingLabs/.github/.github/workflows/metadata.yaml@main with: coreName: sa build: - name: Collect Metadata - uses: ./.github/workflows/integrate.yaml + name: Build + needs: [ metadata ] + uses: ./.github/workflows/build.yaml + with: + project: ${{ needs.metadata.outputs.project }} github: name: GitHub Release @@ -46,12 +49,19 @@ jobs: -H 'Accept: application/vnd.github.v3.raw' \ -o artifacts/sa.h \ -L ${{ github.api_url }}/repos/${{ github.repository }}/contents/sa.h?ref=${{ github.ref_name }} + - name: Tar up files + id: tar + run: | + echo "::set-output name=filename::$filename" + tar czf $filename --directory=artifacts . + env: + filename: ${{ needs.metadata.outputs.project }}-${{ needs.metadata.outputs.fullVersion }}.tar.gz - name: Create GitHub Release uses: softprops/action-gh-release@v0.1.14 with: - name: libsa-${{ needs.metadata.outputs.fullVersion }} + name: ${{ needs.metadata.outputs.project }}-${{ needs.metadata.outputs.fullVersion }} files: | - artifacts/** + ${{ steps.tar.outputs.filename }} nuget: name: NuPkg Release @@ -70,6 +80,11 @@ jobs: runtime: win-x64 result: sa.dll fail-fast: true + env: + platform: ${{ matrix.platform }} + runtime: ${{ matrix.runtime }} + result: ${{ matrix.result }} + project: ${{ needs.metadata.outputs.project }} steps: - name: Get Artifact uses: actions/download-artifact@v3 @@ -79,8 +94,6 @@ jobs: - name: Create NuSpec run: | - ls -la - ls -la $platform text="" text="$text\n" text="$text\n " @@ -93,34 +106,29 @@ jobs: text="$text\n " text="$text\n The Stirling Labs Team" text="$text\n $homepage" - text="$text\n docs/Readme.md" + text="$text\n docs/README.md" text="$text\n images/icon.png" - text="$text\n $project library SL sockets XP sockaddr StirlingLabs IP TCP UDP" - text="$text\n BSD-3-Clause" + text="$text\n $project library SL sockets XP sockaddr StirlingLabs IP TCP UDP $topics" + text="$text\n $license" text="$text\n true" text="$text\n " text="$text\n " text="$text\n " - text="$text\n " - text="$text\n " - text="$text\n " + text="$text\n " + text="$text\n " + text="$text\n " text="$text\n " text="$text\n" echo -e $text > $project.nuspec cat $project.nuspec env: - platform: ${{ matrix.platform }} - runtime: ${{ matrix.runtime }} - result: ${{ matrix.result }} - project: ${{ needs.metadata.outputs.project }} version: ${{ needs.metadata.outputs.fullVersion }} homepage: ${{ needs.metadata.outputs.homepage }} - license: ${{ github.repository.license.spdx_id }} - gitUrl: ${{ github.repository.git_url }} - url: https://github.com/StirlingLabs/assimp - repo: ${{ github.repositoryUrl }} + license: MIT + gitUrl: ${{ github.event.repository.git_url }} branch: ${{ needs.metadata.outputs.currentBranch }} commit: ${{ github.sha }} + topics: ${{ needs.metadata.outputs.topics }} - name: Create NuPkg run: | @@ -130,6 +138,6 @@ jobs: - name: Upload NuPkg run: | dotnet nuget push *.nupkg -k ${{github.token}} -s https://nuget.pkg.github.com/${{github.repository_owner}}/index.json --no-symbols --skip-duplicate || true - # dotnet nuget push *.nupkg -k ${{secrets.NUGET_STIRLINGLABS_API_KEY}} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate + dotnet nuget push *.nupkg -k ${{secrets.NUGET_STIRLINGLABS_API_KEY}} -s https://api.nuget.org/v3/index.json --no-symbols --skip-duplicate diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 61558fe..ccaf511 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -16,11 +16,13 @@ defaults: jobs: skip_check: - name: Skip Run Check + name: Skip Check uses: StirlingLabs/.github/.github/workflows/threshold.yaml@main metadata: - name: Collect Metadata + name: Collect + needs: [ skip_check ] + if: needs.skip_check.outputs.continue == 'true' uses: StirlingLabs/.github/.github/workflows/metadata.yaml@main with: coreName: sa @@ -29,53 +31,16 @@ jobs: name: Build needs: [ skip_check, metadata ] if: needs.skip_check.outputs.continue == 'true' - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-22.04 - result: libsa.so - - os: macos-12 - result: libsa.dylib - - os: windows-2022 - result: Release/sa.dll - fail-fast: false - env: - workingDir: build - finalDir: ${{ needs.metadata.outputs.project }}-${{ needs.metadata.outputs.significantVersion }} - defaults: - run: - shell: bash + uses: ./.github/workflows/build.yaml + with: + project: ${{ needs.metadata.outputs.project }} + + list: + name: List Files + needs: build + runs-on: ubuntu-latest + if: needs.skip_check.outputs.continue == 'true' steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Configure - id: cmake - run: | - mkdir $workingDir && cd $workingDir - cmd="cmake .." - case "${RUNNER_OS}" in - Linux) $cmd -DCMAKE_BUILD_TYPE=Release ;; - macOS) $cmd -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" ;; - Windows) $cmd -G "Visual Studio 17 2022" -A x64 -DCMAKE_CONFIGURATION_TYPES=Release ;; - *) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;; - esac - - name: Build - working-directory: build - run: | - cmd="cmake --build ." - case "${RUNNER_OS}" in - Linux) $cmd ;; - macOS) $cmd ;; - Windows) $cmd --config Release ;; - *) echo "Do not recognise ${RUNNER_OS}." && exit 1 ;; - esac - - name: Test - working-directory: build - run: ctest - - uses: actions/upload-artifact@v3 - name: Artifact - with: - name: ${{ needs.metadata.outputs.project }}-${{ runner.os }} - path: ${{ env.workingDir }}/${{ matrix.result }} - if-no-files-found: error + - name: list + run: | + ls -laR diff --git a/docs/SL.png b/docs/SL.png new file mode 100644 index 0000000000000000000000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