From 617cbe389d5b324866a17102f79ed981fbdd72cf Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Mon, 25 Jul 2022 20:40:06 +0900 Subject: [PATCH 1/4] feat: add IsPackable to each csproj --- sandbox/InterprocessServer/InterprocessServer.csproj | 1 + .../MessagePipe.AnalyzerTestApp.csproj | 1 + .../MessagePipe.Sandbox.ConsoleApp.csproj | 1 + src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj | 3 ++- src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj | 1 + src/MessagePipe.Nats/MessagePipe.Nats.csproj | 1 + src/MessagePipe.Redis/MessagePipe.Redis.csproj | 1 + src/MessagePipe/MessagePipe.csproj | 3 ++- tests/MessagePipe.Benchmark/MessagePipe.Benchmark.csproj | 1 + .../MessagePipe.Interprocess.Benchmark.csproj | 1 + tools/PostBuildUtility/PostBuildUtility.csproj | 1 + 11 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sandbox/InterprocessServer/InterprocessServer.csproj b/sandbox/InterprocessServer/InterprocessServer.csproj index 174bc39..766cf01 100644 --- a/sandbox/InterprocessServer/InterprocessServer.csproj +++ b/sandbox/InterprocessServer/InterprocessServer.csproj @@ -3,6 +3,7 @@ Exe net6.0 + false diff --git a/sandbox/MessagePipe.AnalyzerTestApp/MessagePipe.AnalyzerTestApp.csproj b/sandbox/MessagePipe.AnalyzerTestApp/MessagePipe.AnalyzerTestApp.csproj index 215e115..1ea4394 100644 --- a/sandbox/MessagePipe.AnalyzerTestApp/MessagePipe.AnalyzerTestApp.csproj +++ b/sandbox/MessagePipe.AnalyzerTestApp/MessagePipe.AnalyzerTestApp.csproj @@ -3,6 +3,7 @@ Exe net6.0 + false diff --git a/sandbox/MessagePipe.Sandbox.ConsoleApp/MessagePipe.Sandbox.ConsoleApp.csproj b/sandbox/MessagePipe.Sandbox.ConsoleApp/MessagePipe.Sandbox.ConsoleApp.csproj index ed23bbe..4669a94 100644 --- a/sandbox/MessagePipe.Sandbox.ConsoleApp/MessagePipe.Sandbox.ConsoleApp.csproj +++ b/sandbox/MessagePipe.Sandbox.ConsoleApp/MessagePipe.Sandbox.ConsoleApp.csproj @@ -5,6 +5,7 @@ net6.0 Debug;Release;WinBenchmark true + false diff --git a/src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj b/src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj index a232626..8db8509 100644 --- a/src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj +++ b/src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj @@ -13,6 +13,7 @@ analyzer; Analyzers of MessagePipe to prevent subscription leak. true + true @@ -33,4 +34,4 @@ - \ No newline at end of file + diff --git a/src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj b/src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj index 916a657..60ace7e 100644 --- a/src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj +++ b/src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj @@ -9,6 +9,7 @@ pubsub;eventaggregator Interprocess extensions for MessagePipe. true + true diff --git a/src/MessagePipe.Nats/MessagePipe.Nats.csproj b/src/MessagePipe.Nats/MessagePipe.Nats.csproj index 625a90c..b4d9088 100644 --- a/src/MessagePipe.Nats/MessagePipe.Nats.csproj +++ b/src/MessagePipe.Nats/MessagePipe.Nats.csproj @@ -9,6 +9,7 @@ pubsub;eventaggregator Nats IDistributedPublisher/Subscriber provider for MessagePipe. true + true diff --git a/src/MessagePipe.Redis/MessagePipe.Redis.csproj b/src/MessagePipe.Redis/MessagePipe.Redis.csproj index c6ea414..370daec 100644 --- a/src/MessagePipe.Redis/MessagePipe.Redis.csproj +++ b/src/MessagePipe.Redis/MessagePipe.Redis.csproj @@ -8,6 +8,7 @@ pubsub;eventaggregator Redis IDistributedPublisher/Subscriber provider for MessagePipe. true + true diff --git a/src/MessagePipe/MessagePipe.csproj b/src/MessagePipe/MessagePipe.csproj index ac5ebfa..c1ef1b1 100644 --- a/src/MessagePipe/MessagePipe.csproj +++ b/src/MessagePipe/MessagePipe.csproj @@ -9,6 +9,7 @@ pubsub;eventaggregator High performance in-memory/distributed messaging pipeline for .NET and Unity. true + true @@ -49,4 +50,4 @@ - \ No newline at end of file + diff --git a/tests/MessagePipe.Benchmark/MessagePipe.Benchmark.csproj b/tests/MessagePipe.Benchmark/MessagePipe.Benchmark.csproj index 494f925..afb409c 100644 --- a/tests/MessagePipe.Benchmark/MessagePipe.Benchmark.csproj +++ b/tests/MessagePipe.Benchmark/MessagePipe.Benchmark.csproj @@ -5,6 +5,7 @@ net6.0 Debug;Release;WinBenchmark true + false RELEASE;WinBenchmark diff --git a/tests/MessagePipe.Interprocess.Benchmark/MessagePipe.Interprocess.Benchmark.csproj b/tests/MessagePipe.Interprocess.Benchmark/MessagePipe.Interprocess.Benchmark.csproj index a9c5a76..d529447 100644 --- a/tests/MessagePipe.Interprocess.Benchmark/MessagePipe.Interprocess.Benchmark.csproj +++ b/tests/MessagePipe.Interprocess.Benchmark/MessagePipe.Interprocess.Benchmark.csproj @@ -3,6 +3,7 @@ Exe net6.0 + false diff --git a/tools/PostBuildUtility/PostBuildUtility.csproj b/tools/PostBuildUtility/PostBuildUtility.csproj index 69a0acc..55dc1c2 100644 --- a/tools/PostBuildUtility/PostBuildUtility.csproj +++ b/tools/PostBuildUtility/PostBuildUtility.csproj @@ -4,6 +4,7 @@ Exe net6.0 Debug;Release;WinBenchmark + false From ec7f6d7945be7b4d580e9619fe51d2f633da95c1 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Mon, 25 Jul 2022 20:40:16 +0900 Subject: [PATCH 2/4] chore: use Cysharp/Actions reusable workflow stale --- .github/workflows/stale.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 70c3a28..b480c3e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,24 +1,10 @@ name: "Close stale issues" on: + workflow_dispatch: schedule: - cron: "0 0 * * *" jobs: stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - # enable issue - stale-issue-message: "This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days." - stale-issue-label: "stale" - # enable pr - stale-pr-message: "This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days." - stale-pr-label: "stale" - days-before-stale: 90 - days-before-close: 7 - exempt-issue-labels: "wip" - exempt-pr-labels: "wip" - remove-stale-when-updated: true + uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main From 87393dd0ed4cc21bef3ccb97e89470ac181d2745 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Mon, 25 Jul 2022 21:29:01 +0900 Subject: [PATCH 3/4] chore: use Cysharp/Actions reusable action --- .github/workflows/build-debug.yml | 25 +++--- .github/workflows/build-release.yml | 132 +++++++--------------------- 2 files changed, 41 insertions(+), 116 deletions(-) diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index 00c4ce9..c4105f3 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -4,8 +4,6 @@ on: push: branches: - "master" - tags: - - "!*" # not a tag push pull_request: branches: - master @@ -32,10 +30,15 @@ jobs: ports: - 4222:4222 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main + with: + dotnet-version: | + 5.0.x + 6.0.x - run: dotnet build ./tools/PostBuildUtility/ -c Debug - run: dotnet build -c Debug - - run: dotnet test -c Debug --no-build < /dev/null + - run: dotnet test -c Debug --no-build # Store artifacts. - uses: actions/upload-artifact@v2 with: @@ -82,18 +85,12 @@ jobs: buildMethod: PackageExporter.Export versioning: None - - name: check all .meta is commited - run: | - if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then - echo "Detected .meta file generated. Do you forgot commit a .meta file?" - exit 1 - else - echo "Great, all .meta files are commited." - fi - working-directory: src/MessagePipe.Unity + - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files + with: + directory: src/MessagePipe.Unity # Store artifacts. - uses: actions/upload-artifact@v2 with: name: MessagePipe.unitypackage-${{ matrix.unity }}.zip - path: ./src/MessagePipe.Unity/*.unitypackage \ No newline at end of file + path: ./src/MessagePipe.Unity/*.unitypackage diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 464261b..f3d520f 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -6,93 +6,33 @@ on: tag: description: "tag: git tag you want create. (sample 1.0.0)" required: true - dry_run: - description: "dry_run: true will never create relase/nuget." + dry-run: + description: "dry-run: true will never create relase/nuget." required: true - default: "false" + default: false + type: boolean env: GIT_TAG: ${{ github.event.inputs.tag }} - DRY_RUN: ${{ github.event.inputs.dry_run }} + DRY_RUN: ${{ github.event.inputs.dry-run }} DRY_RUN_BRANCH_PREFIX: "test_release" jobs: update-packagejson: - runs-on: ubuntu-latest - env: - TARGET_FILE: ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe/package.json - TARGET_FILE2: ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.VContainer/package.json - TARGET_FILE3: ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Zenject/package.json - TARGET_FILE4: ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/package.json - outputs: - sha: ${{ steps.commit.outputs.sha }} - steps: - - uses: actions/checkout@v2 - - name: Output package.json (Before) - run: | - cat ${{ env.TARGET_FILE}} - cat ${{ env.TARGET_FILE2}} - cat ${{ env.TARGET_FILE3}} - cat ${{ env.TARGET_FILE4}} - - - name: Update package.json to version ${{ env.GIT_TAG }} - run: | - sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE }} - sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE2 }} - sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE3 }} - sed -i -e "s/\(\"version\":\) \"\(.*\)\",/\1 \"${{ env.GIT_TAG }}\",/" ${{ env.TARGET_FILE4 }} - - - name: Check update - id: check_update - run: | - cat ${{ env.TARGET_FILE}} - cat ${{ env.TARGET_FILE2}} - cat ${{ env.TARGET_FILE3}} - cat ${{ env.TARGET_FILE4}} - git diff --exit-code || echo "::set-output name=changed::1" - - - name: Commit files - id: commit - if: steps.check_update.outputs.changed == '1' - run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -m "feat: Update package.json to ${{ env.GIT_TAG }}" -a - echo "::set-output name=sha::$(git rev-parse HEAD)" - - - name: Check sha - run: echo "SHA ${SHA}" - env: - SHA: ${{ steps.commit.outputs.sha }} - - - name: Create Tag - if: steps.check_update.outputs.changed == '1' - run: git tag ${{ env.GIT_TAG }} - - - name: Push changes - if: env.DRY_RUN == 'false' && steps.check_update.outputs.changed == '1' - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - tags: true - - - name: Push changes (dry_run) - if: env.DRY_RUN == 'true' && steps.check_update.outputs.changed == '1' - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }} - tags: false + uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main + with: + file-path: | + ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe/package.json + ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.VContainer/package.json + ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Zenject/package.json + ./src/MessagePipe.Unity/Assets/Plugins/MessagePipe.Interprocess/package.json + tag: ${{ github.event.inputs.tag }} + dry-run: ${{ fromJson(github.event.inputs.dry-run) }} build-dotnet: needs: [update-packagejson] runs-on: ubuntu-latest timeout-minutes: 10 - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - NUGET_XMLDOC_MODE: skip services: redis: image: redis @@ -112,15 +52,16 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ needs.update-packagejson.outputs.sha }} + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main + with: + dotnet-version: | + 5.0.x + 6.0.x # build and pack - run: dotnet build ./tools/PostBuildUtility/ -c Release - run: dotnet build -c Release -p:Version=${{ env.GIT_TAG }} - run: dotnet test -c Release --no-build - - run: dotnet pack ./src/MessagePipe/MessagePipe.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish - - run: dotnet pack ./src/MessagePipe.Analyzer/MessagePipe.Analyzer.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish - - run: dotnet pack ./src/MessagePipe.Redis/MessagePipe.Redis.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish - - run: dotnet pack ./src/MessagePipe.Interprocess/MessagePipe.Interprocess.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish - - run: dotnet pack ./src/MessagePipe.Nats/MessagePipe.Nats.csproj -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish + - run: dotnet pack -c Release --no-build -p:Version=${{ env.GIT_TAG }} -o ./publish # Store artifacts. - uses: actions/upload-artifact@v2 with: @@ -161,15 +102,9 @@ jobs: buildMethod: PackageExporter.Export versioning: None - - name: check all .meta is commited - run: | - if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then - echo "Detected .meta file generated. Do you forgot commit a .meta file?" - exit 1 - else - echo "Great, all .meta files are commited." - fi - working-directory: src/MessagePipe.Unity + - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files + with: + directory: src/MessagePipe.Unity # Store artifacts. - uses: actions/upload-artifact@v2 @@ -179,14 +114,11 @@ jobs: if-no-files-found: error create-release: - if: github.event.inputs.dry_run == 'false' + if: github.event.inputs.dry-run == 'false' needs: [update-packagejson, build-dotnet, build-unity] runs-on: ubuntu-latest - env: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - NUGET_XMLDOC_MODE: skip steps: + - uses: Cysharp/Actions/.github/actions/setup-dotnet@main # Create Releases - uses: actions/create-release@v1 id: create_release @@ -245,12 +177,8 @@ jobs: asset_content_type: application/octet-stream cleanup: - if: github.event.inputs.dry_run == 'true' - needs: [build-dotnet, build-unity] - runs-on: ubuntu-latest - steps: - - name: Delete branch - uses: dawidd6/action-delete-branch@v3 - with: - github_token: ${{ github.token }} - branches: ${{ env.DRY_RUN_BRANCH_PREFIX }}-${{ env.GIT_TAG }} + if: needs.update-packagejson.outputs.is-branch-created == 'true' + needs: [update-packagejson, build-unity] + uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main + with: + branch: ${{ needs.update-packagejson.outputs.branch-name }} From 1c831ef43033d982e73c526c5b625b2596f10782 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Mon, 25 Jul 2022 23:01:32 +0900 Subject: [PATCH 4/4] feat: missing .NET SDK 3.1.x --- .github/workflows/build-debug.yml | 3 ++- .github/workflows/build-release.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index c4105f3..3d2d363 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -34,6 +34,7 @@ jobs: - uses: Cysharp/Actions/.github/actions/setup-dotnet@main with: dotnet-version: | + 3.1.x 5.0.x 6.0.x - run: dotnet build ./tools/PostBuildUtility/ -c Debug @@ -92,5 +93,5 @@ jobs: # Store artifacts. - uses: actions/upload-artifact@v2 with: - name: MessagePipe.unitypackage-${{ matrix.unity }}.zip + name: MessagePipe.${{ matrix.unity }}.unitypackage.zip path: ./src/MessagePipe.Unity/*.unitypackage diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index f3d520f..29870c6 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -55,6 +55,7 @@ jobs: - uses: Cysharp/Actions/.github/actions/setup-dotnet@main with: dotnet-version: | + 3.1.x 5.0.x 6.0.x # build and pack