Skip to content

ちょっと色々と agent にお願いして調整してもらったもの #88

ちょっと色々と agent にお願いして調整してもらったもの

ちょっと色々と agent にお願いして調整してもらったもの #88

Workflow file for this run

name: build and test
on:
push:
pull_request:
branches: [ main ]
paths:
- '**.cs'
- '**.csproj'
- '**.slnx'
- '**.props'
- '**.targets'
- 'global.json'
- '.github/workflows/**'
env:
DOTNET_VERSION: '10.0.x'
jobs:
build-and-test:
name: build-and-test-${{ matrix.rid }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
- os: windows-latest
rid: win-x64
- os: macOS-latest
rid: osx-arm64
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Tool E2E (pack/install/run)
shell: bash
run: |
set -euo pipefail
rid="${{ matrix.rid }}"
rm -rf .artifacts/tool-e2e
mkdir -p .artifacts/tool-e2e
dotnet pack Interpreter/Esolang.Funge.Interpreter.csproj -r "$rid" -p:ToolPackageRuntimeIdentifiers= -o .artifacts/tool-e2e
nupkg_path=$(find .artifacts/tool-e2e -maxdepth 1 -type f -name "dotnet-funge.*.nupkg" ! -name "*.snupkg" | head -n 1)
if [ -z "$nupkg_path" ]; then
echo "Failed to find dotnet-funge nupkg in .artifacts/tool-e2e"
exit 1
fi
nupkg_name=$(basename "$nupkg_path")
tool_version=${nupkg_name#dotnet-funge.}
tool_version=${tool_version%.nupkg}
echo "Detected tool version: $tool_version"
dotnet new tool-manifest --force
dotnet tool install dotnet-funge \
--add-source .artifacts/tool-e2e \
--version "$tool_version"
dotnet tool run dotnet-funge -- --help
# hello.b98 ファイルで実行 → "Hello, World!" を検証
output1=$(dotnet tool run dotnet-funge -- --path samples/Generator.UseConsole/Programs/hello.b98)
echo "$output1"
test "$output1" = "Hello, World!"
# inline funge テキストで実行
output2=$(dotnet tool run dotnet-funge -- --source "64+\"!dlroW ,olleH\">:#,_@")
echo "$output2"
test "$output2" = "Hello, World!"
# 改行を含む inline funge テキストで実行
inline_source=$'v\n>25*"!dlroW ,olleH",,,,@'
output3=$(dotnet tool run dotnet-funge -- --source "$inline_source")
echo "$output3"
dotnet tool uninstall dotnet-funge
- name: Pack
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
dotnet pack Interpreter/Esolang.Funge.Interpreter.csproj -p:ToolPackageRuntimeIdentifiers= -o artifacts/
dotnet pack Interpreter/Esolang.Funge.Interpreter.csproj -p:PublishAot=false -p:ToolPackageRuntimeIdentifiers="" -o artifacts/
while IFS= read -r project; do
dotnet pack "$project" -o artifacts/
done < <(find . -type f -name "*.csproj" \
! -name "*.Tests.csproj" \
! -path "./Interpreter/*" \
! -path "./samples/*" | sort)
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: artifacts
path: artifacts/