mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2024-12-23 06:56:27 +00:00
test CI run
This commit is contained in:
parent
4160525415
commit
b98313b74f
1
.github/workflows/build-debug.yml
vendored
1
.github/workflows/build-debug.yml
vendored
@ -16,6 +16,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: cargo build --verbose
|
- run: cargo build --verbose
|
||||||
|
- run: cargo test update_package_version -- 1.0.0 --nocapture
|
||||||
build-dotnet:
|
build-dotnet:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
105
.github/workflows/build-release.yml
vendored
Normal file
105
.github/workflows/build-release.yml
vendored
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
name: Build-Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "tag: git tag you want create. (sample 1.0.0)"
|
||||||
|
required: true
|
||||||
|
dry-run:
|
||||||
|
description: "dry-run: false = create release/nuget. true = never create release/nuget."
|
||||||
|
required: true
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-packagejson:
|
||||||
|
uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main
|
||||||
|
with:
|
||||||
|
file-path: ./src/MemoryPack.Unity/Assets/Plugins/MemoryPack/package.json
|
||||||
|
tag: ${{ inputs.tag }}
|
||||||
|
dry-run: ${{ inputs.dry-run }}
|
||||||
|
push-tag: false
|
||||||
|
|
||||||
|
build-dotnet:
|
||||||
|
needs: [update-packagejson]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
steps:
|
||||||
|
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
- uses: Cysharp/Actions/.github/actions/setup-dotnet@main
|
||||||
|
with:
|
||||||
|
dotnet-version: |
|
||||||
|
6.0.x
|
||||||
|
7.0.x
|
||||||
|
# pack nuget
|
||||||
|
- run: dotnet build -c Release -p:Version=${{ inputs.tag }}
|
||||||
|
- run: dotnet test -c Release --no-build
|
||||||
|
- run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nuget
|
||||||
|
path: ./publish
|
||||||
|
|
||||||
|
build-unity:
|
||||||
|
needs: [update-packagejson]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
unity: ["2021.3.11f1"]
|
||||||
|
include:
|
||||||
|
- unity: 2021.3.11f1
|
||||||
|
license: UNITY_LICENSE_2021
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
# Execute scripts: Export Package
|
||||||
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
|
- name: Export unitypackage
|
||||||
|
uses: game-ci/unity-builder@v2
|
||||||
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
|
with:
|
||||||
|
projectPath: src/MemoryPack.Unity
|
||||||
|
unityVersion: ${{ matrix.unity }}
|
||||||
|
targetPlatform: StandaloneLinux64
|
||||||
|
buildMethod: PackageExporter.Export
|
||||||
|
versioning: None
|
||||||
|
# check meta files
|
||||||
|
- uses: Cysharp/Actions/.github/actions/check-metas@main
|
||||||
|
with:
|
||||||
|
directory: src/MemoryPack.Unity
|
||||||
|
# Store artifacts.
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: MemoryPack.${{ inputs.tag }}.unitypackage
|
||||||
|
path: ./src/MemoryPack.Unity/MemoryPack.${{ inputs.tag }}.unitypackage
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# release
|
||||||
|
create-release:
|
||||||
|
needs: [update-packagejson, build-dotnet, build-unity]
|
||||||
|
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
|
||||||
|
with:
|
||||||
|
dry-run: ${{ inputs.dry-run }}
|
||||||
|
commit-id: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
|
tag: ${{ inputs.tag }}
|
||||||
|
push-tag: true
|
||||||
|
nuget-push: true
|
||||||
|
unitypackage-upload: true
|
||||||
|
unitypackage-name: MemoryPack.${{ inputs.tag }}.unitypackage
|
||||||
|
unitypackage-path: ./MemoryPack.${{ inputs.tag }}.unitypackage/MemoryPack.${{ inputs.tag }}.unitypackage
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if: needs.update-packagejson.outputs.is-branch-created == 'true'
|
||||||
|
needs: [update-packagejson, create-release]
|
||||||
|
uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main
|
||||||
|
with:
|
||||||
|
branch: ${{ needs.update-packagejson.outputs.branch-name }}
|
@ -136,8 +136,17 @@ fn collect_field_types(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[cfg(test)]
|
||||||
fn test() {
|
mod tests {
|
||||||
|
use std::{
|
||||||
|
env,
|
||||||
|
fs::{self},
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test() {
|
||||||
let path = std::env::current_dir().unwrap();
|
let path = std::env::current_dir().unwrap();
|
||||||
println!("starting dir: {}", path.display()); // csbindgen/csbindgen
|
println!("starting dir: {}", path.display()); // csbindgen/csbindgen
|
||||||
|
|
||||||
@ -150,4 +159,29 @@ fn test() {
|
|||||||
"dotnet-sandbox/lz4_bindgen.cs",
|
"dotnet-sandbox/lz4_bindgen.cs",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cargo test update_package_version -- 1.0.0 --nocapture
|
||||||
|
#[test]
|
||||||
|
fn update_package_version() {
|
||||||
|
let args: Vec<String> = env::args().collect();
|
||||||
|
// 0: exe path
|
||||||
|
// 1: update_package_version
|
||||||
|
// 2: 1.0.0
|
||||||
|
// 3: --nocapture
|
||||||
|
|
||||||
|
if args[1] != "update_package_version" {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("version: {}", args[2]);
|
||||||
|
let mut path = std::env::current_dir().unwrap();
|
||||||
|
println!("current_dir: {}", path.display());
|
||||||
|
|
||||||
|
path.push("Cargo.toml");
|
||||||
|
|
||||||
|
let toml = fs::read_to_string(path).unwrap();
|
||||||
|
|
||||||
|
println!("current toml: {}", toml);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user