Skip to content

共有テクスチャの宣言違反を診断する #5

共有テクスチャの宣言違反を診断する

共有テクスチャの宣言違反を診断する #5

Workflow file for this run

name: リリース
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
permissions:
contents: write
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
DOTNET_NOLOGO: "1"
jobs:
validate:
name: バージョン検証とテスト
runs-on: windows-2022
defaults:
run:
shell: bash
outputs:
version: ${{ steps.parse.outputs.version }}
version_prefix: ${{ steps.parse.outputs.version_prefix }}
version_suffix: ${{ steps.parse.outputs.version_suffix }}
is_prerelease: ${{ steps.parse.outputs.is_prerelease }}
# ComputeWeave.Dxc が参照する環境変数。
# https://github.com/actions/runner-images/issues/6531 への対処。
env:
CI_RUNNER_DOTNET_TEST_PLATFORM: x64
steps:
- name: ソースコードを取得
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: タグからバージョン番号を抽出
id: parse
run: |
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
PREFIX="${VERSION%%-*}"
if [[ "${VERSION}" == *"-"* ]]; then
SUFFIX="${VERSION#*-}"
IS_PRERELEASE=true
else
SUFFIX=""
IS_PRERELEASE=false
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "version_prefix=${PREFIX}" >> "$GITHUB_OUTPUT"
echo "version_suffix=${SUFFIX}" >> "$GITHUB_OUTPUT"
echo "is_prerelease=${IS_PRERELEASE}" >> "$GITHUB_OUTPUT"
- name: 抽出したバージョン番号を確認
run: |
echo "タグ : ${{ github.ref_name }}"
echo "バージョン : ${{ steps.parse.outputs.version }}"
echo "接頭辞 : ${{ steps.parse.outputs.version_prefix }}"
echo "接尾辞 : ${{ steps.parse.outputs.version_suffix }}"
echo "プレリリース : ${{ steps.parse.outputs.is_prerelease }}"
- name: .NET SDK をセットアップ
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.x"
- name: ソリューションをビルド
run: |
dotnet build ComputeWeave.sln -c Release -p:Platform=x64 \
-p:VersionPrefix=${{ steps.parse.outputs.version_prefix }} \
-p:VersionSuffix=${{ steps.parse.outputs.version_suffix }}
- name: ソースジェネレーターのテストを実行
run: dotnet test tests/ComputeWeave.Tests.SourceGenerators/ComputeWeave.Tests.SourceGenerators.csproj -c Release -p:Platform=x64
- name: 内部実装のテストを実行
run: dotnet test tests/ComputeWeave.Tests.Internals/ComputeWeave.Tests.Internals.csproj -c Release -p:Platform=x64
- name: 本体のテストを実行
run: dotnet test tests/ComputeWeave.Tests/ComputeWeave.Tests.csproj -c Release -p:Platform=x64
# デバイス消失のテストは実デバイスを破棄するため、他のテストとは別のプロセスで実行する。
validate-device-lost:
name: デバイス消失のテスト
runs-on: windows-2022
defaults:
run:
shell: bash
env:
CI_RUNNER_DOTNET_TEST_PLATFORM: x64
steps:
- name: ソースコードを取得
uses: actions/checkout@v4
- name: .NET SDK をセットアップ
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.x"
- name: デバイス消失のテストを実行
run: dotnet test tests/ComputeWeave.Tests.DeviceLost/ComputeWeave.Tests.DeviceLost.csproj -c Release -p:Platform=x64
pack:
name: NuGet パッケージの作成
runs-on: windows-2022
needs: [validate, validate-device-lost]
defaults:
run:
shell: bash
steps:
- name: ソースコードを取得
uses: actions/checkout@v4
- name: .NET SDK をセットアップ
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.x"
- name: パッケージを作成
run: |
for project in \
src/ComputeWeave.Core/ComputeWeave.Core.csproj \
src/ComputeWeave/ComputeWeave.csproj \
src/ComputeWeave.Dxc/ComputeWeave.Dxc.csproj \
src/ComputeWeave.D3D12MemoryAllocator/ComputeWeave.D3D12MemoryAllocator.csproj
do
dotnet pack "$project" -c Release \
-p:VersionPrefix=${{ needs.validate.outputs.version_prefix }} \
-p:VersionSuffix=${{ needs.validate.outputs.version_suffix }}
done
- name: 作成されたパッケージ一覧を確認
run: ls -la ./artifacts/
- name: パッケージをアーティファクトとして保存
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: artifacts/
retention-days: 90
if-no-files-found: error
publish-nuget:
name: NuGet.org へ公開
runs-on: ubuntu-latest
needs: [validate, pack]
environment: nuget-release
permissions:
id-token: write
packages: write
defaults:
run:
shell: bash
steps:
- name: .NET SDK をセットアップ
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.x"
- name: パッケージをダウンロード
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./artifacts
- name: ダウンロードしたファイルを確認
run: ls -la ./artifacts/
- name: NuGet Trusted Publishing でログイン
uses: NuGet/login@v1
id: nuget-login
with:
user: routersys
- name: NuGet.org へパッケージを発行
run: |
dotnet nuget push ./artifacts/*.nupkg \
--api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: GitHub Packages へも発行
run: |
dotnet nuget push ./artifacts/*.nupkg \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source https://nuget.pkg.github.com/routersys/index.json \
--skip-duplicate
continue-on-error: true
github-release:
name: GitHub Release の作成
runs-on: ubuntu-latest
needs: [validate, pack, publish-nuget]
defaults:
run:
shell: bash
steps:
- name: ソースコードを取得
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: パッケージをダウンロード
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./artifacts
- name: 直前のリリースタグを取得
id: prev_tag
run: |
PREV=$(git tag --sort=-version:refname \
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
| sed -n '2p' || true)
echo "tag=${PREV}" >> "$GITHUB_OUTPUT"
- name: コミット履歴からリリースノートを生成
id: changelog
run: |
PREV="${{ steps.prev_tag.outputs.tag }}"
CURRENT="${{ github.ref_name }}"
if [ -n "${PREV}" ]; then
LOG=$(git log "${PREV}..${CURRENT}" --pretty=format:"- %s (%h)" --no-merges)
else
LOG=$(git log -n 30 --pretty=format:"- %s (%h)" --no-merges)
fi
{
echo "notes<<NOTES_EOF"
echo "### 変更内容"
echo "${LOG:-変更履歴を取得できませんでした。}"
echo ""
echo "### インストール"
echo '```sh'
echo "dotnet add package ComputeWeave --version ${{ needs.validate.outputs.version }}"
echo '```'
echo ""
echo "### NuGet"
echo "https://www.nuget.org/packages/ComputeWeave/${{ needs.validate.outputs.version }}"
echo "NOTES_EOF"
} >> "$GITHUB_OUTPUT"
- name: GitHub Release を作成してパッケージを添付
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.notes }}
prerelease: ${{ needs.validate.outputs.is_prerelease }}
files: |
artifacts/*.nupkg
artifacts/*.snupkg