Skip to content

Commit

Permalink
Merge branch 'new_workflow' into on-demand
Browse files Browse the repository at this point in the history
  • Loading branch information
clibequilibrium committed Oct 23, 2023
2 parents 7774883 + 4cd247a commit 8d08860
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 33 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows, os: windows-latest, rid: win }
- { name: macOS, os: macos-latest, rid: osx }
- { name: Windows, os: windows-2022, rid: win }
- { name: macOS, os: macos-11, rid: osx }
- { name: Linux, os: ubuntu-20.04, rid: linux }

steps:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
bindgen-cross-platform-ast-job:
name: "Bindgen AST cross-platform"
needs: [bindgen-ast-job]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: "Clone Git repository"
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
bindgen-cs-job:
name: "Bindgen C#"
needs: [bindgen-cross-platform-ast-job]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: "Clone Git repository"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), os: windows-latest, rid: win-x64 }
- { name: macOS (x64 + arm64), os: macos-latest, rid: osx }
- { name: Linux (x64), os: ubuntu-latest, rid: linux-x64 }
- { name: Windows (x64), os: windows-2022, rid: win-x64 }
- { name: macOS (x64 + arm64), os: macos-11, rid: osx }
- { name: Linux (x64), os: ubuntu-20.04, rid: linux-x64 }
steps:

- name: "Clone Git repository"
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
dotnet-job:
name: "Build .NET solution"
needs: [native-job]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:

- name: "Clone Git repository"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

commit-job:
name: "Commit generated C# code"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.actor == 'dependabot[bot]'

steps:
Expand Down
30 changes: 7 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "Release"
on:
workflow_dispatch:
inputs:
pre-release:
description: 'Is this a release candidate (pre-release)? (NOTE: candidates get uploaded to MyGet.org instead of NuGet.org)'
version:
description: Version of the package
required: true
default: 'true'
default: '0.0.0'
schedule:
- cron: "0 0 1 * *" # First day of every month

Expand All @@ -18,7 +18,7 @@ jobs:
release-job:
name: "Release"
needs: [build-job]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
Expand All @@ -28,19 +28,6 @@ jobs:
with:
submodules: "recursive"

- name: "Set version"
id: set-version
shell: bash
run: |
IS_PRERELEASE="${{ github.event.inputs.pre-release }}"
if [[ "$IS_PRERELEASE" = "true" ]]; then
VERSION="$(date +'%Y.%m.%d')-rc"
else
VERSION="$(date +'%Y.%m.%d')"
fi
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
with:
Expand All @@ -60,19 +47,16 @@ jobs:
path: "./lib"

- name: ".NET pack"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ steps.set-version.outputs.VERSION }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"
run: dotnet pack "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="${{ github.event.inputs.version }}" -p:RepositoryBranch="${{ github.head_ref || github.ref_name }}" -p:RepositoryCommit="${{ github.sha }}"

- name: "Upload packages to NuGet"
if: github.event_name == 'schedule' || github.event.inputs.pre-release == 'false'
env:
NUGET_ACCESS_TOKEN: ${{ secrets.NUGET_ACCESS_TOKEN }}
run: dotnet nuget push "./src/cs/production/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key $NUGET_ACCESS_TOKEN

- name: "Create tag and GitHub release"
uses: softprops/action-gh-release@v1
if: github.event_name == 'schedule' || github.event.inputs.pre-release == 'false'
with:
generate_release_notes: true
prerelease: "{{ github.event.inputs.pre-release == 'true' }}"
tag_name: "v${{ steps.set-version.outputs.VERSION }}"

prerelease: false
tag_name: "v${{ github.event.inputs.version }}"
27 changes: 27 additions & 0 deletions library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ fi

c2cs library --config "$DIRECTORY/bindgen/config-build-c-library.json"

# Directory to search for libraries
search_dir="./lib"

# Check if the directory exists
if [ ! -d "$search_dir" ]; then
echo "Directory not found: $search_dir"
exit 1
fi

# Find all libraries with prefix "lib"
lib_files=$(find "$search_dir" -type f -name "lib*")

# Iterate through the list of found libraries and strip the "lib" prefix
for lib_file in $lib_files; do
# Extract the filename without the path
file_name=$(basename "$lib_file")

# Strip the "lib" prefix
new_name="${file_name#lib}"

# Rename the file with the stripped prefix
mv "$lib_file" "$(dirname "$lib_file")/$new_name"

echo "Stripped and renamed: $file_name -> $new_name"
done


if [[ -z "$1" ]]; then
read
fi
32 changes: 31 additions & 1 deletion src/cs/production/Tracy/_README_PACKAGE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# Tracy-CSharp

Automatically updated C# bindings for https://github.com/wolfpld/tracy compiled with TRACY_ON_DEMAND
C# bindings for https://github.com/wolfpld/tracy with native dynamic link libraries based on [`imgui-cs`](https://github.com/bottlenoselabs/imgui-cs) compiled with ``TRACY_ON_DEMAND`` flag.

## How to use

Sample [`C# project`](https://github.com/clibequilibrium/Tracy-CSharp/tree/main/src/cs/samples/HelloWorld)

```CSharp
using (Profiler.BeginEvent())
{
// Code to profile
}
Profiler.ProfileFrame("Main"); // Put this after you have completed rendering the frame.
// Ideally that would be right after the swap buffers command.
// Note that this step is optional, as some applications
// (for example: a compression utility)
// do not have the concept of a frame
```


## Developers: Documentation

For more information on how C# bindings work, see [`C2CS`](https://github.com/lithiumtoast/c2cs), the tool that generates the bindings for `Tracy` and other C libraries.

To learn how to use `Tracy`, check out the [official readme](https://github.com/wolfpld/tracy).

## License

`Tracy-CSharp` is licensed under the MIT License (`MIT`) - see the [LICENSE file](LICENSE) for details.

`Tracy` itself is licensed under BSD license (`BSD`) - see https://github.com/wolfpld/tracy/blob/master/LICENSE for more details.

1 change: 1 addition & 0 deletions src/cs/samples/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ItemGroup>
<PackageReference Include="Tracy-CSharp-On-Demand" Version="2023.10.22" />
<PackageReference Include="Tracy-CSharp" Version="2023.10.21" />
</ItemGroup>

</Project>

0 comments on commit 8d08860

Please sign in to comment.