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 0000000..98765e0 Binary files /dev/null and b/docs/SL.png differ