Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/release-csharp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release C#

on:
release:
types: [published]
workflow_dispatch:

jobs:
release:
name: Release cmd/protoc-gen-csharp-tableau-loader
runs-on: ubuntu-latest
if: startsWith(github.event.release.tag_name, 'cmd/protoc-gen-csharp-tableau-loader/')
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
exclude:
- goos: linux
goarch: arm64
- goos: windows
goarch: arm64

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"

- name: Download dependencies
run: |
cd cmd/protoc-gen-csharp-tableau-loader
go mod download
- name: Prepare build directory
run: |
mkdir -p build/
cp README.md build/
cp LICENSE build/
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
cd cmd/protoc-gen-csharp-tableau-loader
go build -trimpath -o $GITHUB_WORKSPACE/build
- name: Create package
id: package
run: |
PACKAGE_NAME=protoc-gen-csharp-tableau-loader.${GITHUB_REF#refs/tags/cmd/protoc-gen-csharp-tableau-loader/}.${{ matrix.goos }}.${{ matrix.goarch }}.tar.gz
tar -czvf $PACKAGE_NAME -C build .
echo ::set-output name=name::${PACKAGE_NAME}
- name: Upload asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.package.outputs.name }}
asset_name: ${{ steps.package.outputs.name }}
asset_content_type: application/gzip
69 changes: 69 additions & 0 deletions .github/workflows/testing-csharp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Testing C#

# Trigger on pushes, PRs (excluding documentation changes), and nightly.
on:
push:
branches: [master, main]
pull_request:
schedule:
- cron: 0 0 * * * # daily at 00:00
workflow_dispatch:

permissions:
contents: read

jobs:
test:
strategy:
matrix:
include:
- os: ubuntu-latest
gen_script: bash gen.sh
- os: windows-latest
gen_script: cmd /c gen.bat

runs-on: ${{ matrix.os }}
timeout-minutes: 10

steps:
- name: Checkout Code
uses: actions/checkout@v6

- name: Install Go
uses: actions/setup-go@v6
with:
go-version: 1.21.x
cache: true

- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build

- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: choco install cmake ninja -y

- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Init submodules and build protobuf
shell: bash
run: bash init.sh

- name: Generate protoconf
working-directory: test/csharp-tableau-loader
run: ${{ matrix.gen_script }}

- name: Build
working-directory: test/csharp-tableau-loader
run: dotnet build

- name: Run loader
working-directory: test/csharp-tableau-loader
run: dotnet run
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ node_modules

cmd/protoc-gen-cpp-tableau-loader/protoc-gen-cpp-tableau-loader
cmd/protoc-gen-go-tableau-loader/protoc-gen-go-tableau-loader
cmd/protoc-gen-csharp-tableau-loader/protoc-gen-csharp-tableau-loader

test/go-tableau-loader/go-tableau-loader
_lab/ts/src/protoconf
coverage.txt
!test/testdata/bin/
test/csharp-tableau-loader/protoconf

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ The official config loader for [Tableau](https://github.com/tableauio/tableau).

- [Protocol Buffers Go Reference](https://protobuf.dev/reference/go/)

## C#

### Requirements

- Unity 2022.3 LTS (C# 9)
- dotnet-sdk-8.0

@wenchy wenchy Aug 26, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### Test

- Install: **dotnet-sdk-8.0**
- Change dir: `cd test/csharp-tableau-loader`
- Generate protoconf: `sh gen.sh`
- Test: `dotnet run`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## TypeScript

### Requirements
Expand Down
34 changes: 34 additions & 0 deletions cmd/protoc-gen-csharp-tableau-loader/embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"embed"
"path"

"github.com/tableauio/loader/cmd/protoc-gen-csharp-tableau-loader/helper"
"google.golang.org/protobuf/compiler/protogen"
)

//go:embed embed/*
var efs embed.FS

// generateEmbed generates related registry files.
func generateEmbed(gen *protogen.Plugin) {
entries, err := efs.ReadDir("embed")
if err != nil {
panic(err)
}
for _, entry := range entries {
if entry.IsDir() {
continue
}

g := gen.NewGeneratedFile(entry.Name(), "")
helper.GenerateFileHeader(gen, nil, g, version)
// refer: [embed: embed path on different OS cannot open file](https://github.com/golang/go/issues/45230)
content, err := efs.ReadFile(path.Join("embed", entry.Name()))
if err != nil {
panic(err)
}
g.P(string(content))
}
}
Loading
Loading