Repository navigation
Merge pull request #127 from ponponusa/develop #207
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| # デフォルト権限。全ジョブに対して GITHUB_TOKEN は読み取りだけ許可。 | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: [ "develop", "release", "draft" ] | |
| push: | |
| branches: [ "release", "draft" ] | |
| jobs: | |
| # | |
| # Repository-local AI agent context and skill drift check | |
| # | |
| agent-context-check: | |
| if: github.event_name == 'pull_request' | |
| name: agent-context-check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Set Python cache prefix | |
| run: echo "PYTHONPYCACHEPREFIX=${RUNNER_TEMP}/agent-context-pycache" >> "$GITHUB_ENV" | |
| - name: Validate agent context script | |
| run: | | |
| python3 -c "from pathlib import Path; p = Path('.agents/skills/agent-context-maintainer/scripts/agent_context.py'); compile(p.read_text(encoding='utf-8'), str(p), 'exec')" | |
| - name: Check agent context and project skills | |
| run: | | |
| python3 .agents/skills/agent-context-maintainer/scripts/agent_context.py check . | |
| python3 .agents/skills/agent-context-maintainer/scripts/agent_context.py skills check . | |
| - name: Check generated agent context drift | |
| run: | | |
| python3 .agents/skills/agent-context-maintainer/scripts/agent_context.py scaffold . --agent codex | |
| python3 .agents/skills/agent-context-maintainer/scripts/agent_context.py skills sync . | |
| python3 .agents/skills/agent-context-maintainer/scripts/agent_context.py skills routes . | |
| git diff --exit-code -- \ | |
| AGENTS.md \ | |
| CLAUDE.md \ | |
| GEMINI.md \ | |
| .github/copilot-instructions.md \ | |
| .gemini/settings.json \ | |
| .agents | |
| untracked=$(git ls-files --others --exclude-standard -- \ | |
| AGENTS.md \ | |
| CLAUDE.md \ | |
| GEMINI.md \ | |
| .github/copilot-instructions.md \ | |
| .gemini/settings.json \ | |
| .agents) | |
| if [ -n "$untracked" ]; then | |
| echo "Generated agent context contains untracked files:" | |
| echo "$untracked" | |
| exit 1 | |
| fi | |
| # | |
| # 1) PR用ビルド・テストジョブ | |
| # - develop / release draft 向け PR で走る | |
| # - RSpec を実行 | |
| # - Astro UI のビルドとテスト | |
| # | |
| build-test: | |
| if: github.event_name == 'pull_request' | |
| name: narou-ci-tests | |
| runs-on: ubuntu-latest | |
| env: | |
| BUNDLE_JOBS: "1" | |
| BUNDLE_RETRY: "3" | |
| BUNDLE_PATH: vendor/bundle | |
| BUNDLER_VERSION: "2.7.2" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby (3.4) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: false | |
| - name: Install bundler | |
| run: gem install bundler:${{ env.BUNDLER_VERSION }} | |
| - name: Cache bundle | |
| uses: actions/cache@v4 | |
| with: | |
| path: vendor/bundle | |
| key: ${{ runner.os }}-ruby-3.4-bundle-${{ hashFiles('**/Gemfile.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ruby-3.4-bundle- | |
| ${{ runner.os }}-ruby- | |
| ${{ runner.os }}- | |
| - name: Bundle install | |
| run: | | |
| bundle _${BUNDLER_VERSION}_ config set path "${BUNDLE_PATH}" | |
| bundle _${BUNDLER_VERSION}_ check || bundle _${BUNDLER_VERSION}_ install | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build Astro UI | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Check TypeScript types | |
| working-directory: frontend | |
| run: npm run check | |
| - name: Run RSpec | |
| run: | | |
| mkdir -p test_results/rspec | |
| bundle _${BUNDLER_VERSION}_ exec rspec \ | |
| --format progress \ | |
| --format RspecJunitFormatter \ | |
| --out test_results/rspec/results.xml | |
| - name: Upload test results (JUnit XML) | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rspec-junit | |
| path: test_results | |
| - name: Upload coverage | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage | |
| - name: Upload Astro build | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: astro-dist | |
| path: frontend/dist | |
| # | |
| # 2) Linux/macOS 向け gem をビルド | |
| # - release / draft ブランチへの push で実行 | |
| # - Astro UI をビルドして含める | |
| # - bootsnap を依存関係に含む | |
| # | |
| build-gem-linux: | |
| if: github.event_name == 'push' && (github.ref_name == 'release' || github.ref_name == 'draft') | |
| name: Build gem (Linux/macOS) | |
| runs-on: ubuntu-latest | |
| env: | |
| BUNDLER_VERSION: "2.7.2" | |
| outputs: | |
| gemfile: ${{ steps.build.outputs.gemfile }} | |
| version: ${{ steps.get_version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby (3.4) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: false | |
| - name: Install bundler | |
| run: gem install bundler:${{ env.BUNDLER_VERSION }} | |
| - name: Bundle install | |
| run: | | |
| bundle _${BUNDLER_VERSION}_ install --path vendor/bundle | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build Astro UI | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| VERSION=$(ruby -r ./lib/core/version.rb -e 'print Narou::VERSION + (Narou::COMMIT ? "-#{Narou::COMMIT}" : "")') | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Build gem (Linux/macOS) | |
| id: build | |
| run: | | |
| gem build narou-mod.gemspec | |
| # mingw を含まない gem ファイルを取得 | |
| GEMFILE=$(ls narou-mod-*.gem | grep -v mingw || true) | |
| echo "gemfile=${GEMFILE}" >> $GITHUB_OUTPUT | |
| - name: Upload gem artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: narou-gem-linux | |
| path: ${{ steps.build.outputs.gemfile }} | |
| # | |
| # 3) Windows (mingw-ucrt) 向け gem をビルド | |
| # - release / draft ブランチへの push で実行 | |
| # - win32ole を依存関係に含む | |
| # | |
| build-gem-windows: | |
| if: github.event_name == 'push' && (github.ref_name == 'release' || github.ref_name == 'draft') | |
| name: Build gem (Windows) | |
| runs-on: windows-latest | |
| outputs: | |
| gemfile: ${{ steps.build.outputs.gemfile }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby (3.4 on Windows) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build Astro UI | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Build gem (Windows) | |
| id: build | |
| shell: bash | |
| run: | | |
| gem build narou-mod.gemspec | |
| # Windows向け: mingw を含む gem ファイルを取得 | |
| GEMFILE=$(ls narou-mod-*-mingw*.gem || ls narou-mod-*-x64-mingw*.gem || true) | |
| echo "gemfile=${GEMFILE}" >> $GITHUB_OUTPUT | |
| - name: Upload gem artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: narou-gem-windows | |
| path: ${{ steps.build.outputs.gemfile }} | |
| # | |
| # 4) GitHub Release の作成/更新 (draft) | |
| # - draft ブランチへの push で実行 | |
| # | |
| release-draft: | |
| if: github.event_name == 'push' && github.ref_name == 'draft' | |
| name: Create/Update Draft Release (staging) | |
| runs-on: ubuntu-latest | |
| needs: [ build-gem-linux, build-gem-windows ] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout (for git log) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Linux gem artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: narou-gem-linux | |
| path: dist | |
| - name: Download Windows gem artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: narou-gem-windows | |
| path: dist | |
| - name: List dist contents | |
| run: | | |
| echo "dist contains:" | |
| ls -R dist | |
| - name: Generate release body with license info | |
| id: gen_body | |
| env: | |
| LINUX_GEM: ${{ needs.build-gem-linux.outputs.gemfile }} | |
| WINDOWS_GEM: ${{ needs.build-gem-windows.outputs.gemfile }} | |
| run: | | |
| CURRENT_TAG="${{ needs.build-gem-linux.outputs.version }}" | |
| ALL_TAGS=$(git tag --sort=-creatordate) | |
| PREV_TAG=$(echo "$ALL_TAGS" | grep -v "^${CURRENT_TAG}$" | head -n1) | |
| echo "CURRENT_TAG=$CURRENT_TAG" | |
| echo "PREV_TAG=$PREV_TAG" | |
| { | |
| echo "## 📦 インストール案内" | |
| echo "" | |
| echo "### Linux / macOS" | |
| echo "" | |
| echo "\`\`\`bash" | |
| echo "gem install ./${LINUX_GEM}" | |
| echo "\`\`\`" | |
| echo "" | |
| echo "### Windows" | |
| echo "" | |
| echo "\`\`\`powershell" | |
| echo "gem install ./${WINDOWS_GEM}" | |
| echo "\`\`\`" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| if [ -n "$PREV_TAG" ]; then | |
| echo "## 🧩 ${PREV_TAG}からの変更点" | |
| else | |
| echo "## 🧩 変更点" | |
| fi | |
| echo "" | |
| RANGE="${PREV_TAG:+${PREV_TAG}..HEAD}" | |
| git log ${RANGE:-HEAD} --pretty=format:'- %s (%h)' | grep -v -i "^-\s*merge" || echo "(No commits found)" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "## ⚖️ ライセンス・著作権表示" | |
| echo "" | |
| echo "- 本ソフトウェアは [narou.rb (by whiteleaf7)](https://github.com/whiteleaf7/narou) をオリジナルとしています。" | |
| echo "- 本リポジトリ ([ponponusa/narou](https://github.com/ponponusa/narou)) は、" | |
| echo " オリジナルの narou.rb をベースに改良・保守を行っている非公式フォークです。" | |
| echo "" | |
| echo "- ライセンス: [MIT License](https://opensource.org/licenses/MIT)" | |
| echo "- 著作者: [whiteleaf7](https://github.com/whiteleaf7) (original), [Rumia-Channel](https://github.com/Rumia-Channel) (fork from), [ponponusa](https://github.com/ponponusa) (mod maintainer)" | |
| echo "" | |
| echo "この改良版はオープンソースライセンスに基づき配布されています。" | |
| echo "利用・再配布・改変は自由ですが、利用者自身の責任のもとで行ってください。" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "_※このリリースはドラフト (テスト用) です。一般公開前の検証ステージです。_" | |
| echo "" | |
| echo "_自動生成: GitHub Actions (${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})_" | |
| } > release_body.md | |
| echo "----- release_body.md -----" | |
| cat release_body.md | |
| echo "body_path=release_body.md" >> $GITHUB_OUTPUT | |
| - name: Create or Update Draft GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.build-gem-linux.outputs.version }} | |
| name: "${{ needs.build-gem-linux.outputs.version }} (draft)" | |
| draft: true | |
| prerelease: false | |
| files: dist/*.gem | |
| body_path: ${{ steps.gen_body.outputs.body_path }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # | |
| # 5) GitHub Release の作成/更新 (public) | |
| # - release ブランチへの push で実行 | |
| # | |
| release-final: | |
| if: github.event_name == 'push' && github.ref_name == 'release' | |
| name: Create/Update Public Release | |
| runs-on: ubuntu-latest | |
| needs: [ build-gem-linux, build-gem-windows ] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout (for git log) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Linux gem artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: narou-gem-linux | |
| path: dist | |
| - name: Download Windows gem artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: narou-gem-windows | |
| path: dist | |
| - name: List dist contents | |
| run: | | |
| echo "dist contains:" | |
| ls -R dist | |
| - name: Generate release body with license info | |
| id: gen_body | |
| env: | |
| LINUX_GEM: ${{ needs.build-gem-linux.outputs.gemfile }} | |
| WINDOWS_GEM: ${{ needs.build-gem-windows.outputs.gemfile }} | |
| run: | | |
| CURRENT_TAG="${{ needs.build-gem-linux.outputs.version }}" | |
| ALL_TAGS=$(git tag --sort=-creatordate) | |
| PREV_TAG=$(echo "$ALL_TAGS" | grep -v "^${CURRENT_TAG}$" | head -n1) | |
| { | |
| echo "## 📦 インストール案内" | |
| echo "" | |
| echo "### Linux / macOS" | |
| echo "" | |
| echo "\`\`\`bash" | |
| echo "gem install ./${LINUX_GEM}" | |
| echo "\`\`\`" | |
| echo "" | |
| echo "### Windows" | |
| echo "" | |
| echo "\`\`\`powershell" | |
| echo "gem install ./${WINDOWS_GEM}" | |
| echo "\`\`\`" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| if [ -n "$PREV_TAG" ]; then | |
| echo "## 🧩 ${PREV_TAG}からの変更点" | |
| else | |
| echo "## 🧩 変更点" | |
| fi | |
| echo "" | |
| RANGE="${PREV_TAG:+${PREV_TAG}..HEAD}" | |
| git log ${RANGE:-HEAD} --pretty=format:'- %s (%h)' | grep -v -i "^-\s*merge" || echo "(No commits found)" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "## ⚖️ ライセンス・著作権表示" | |
| echo "" | |
| echo "- 本ソフトウェアは [narou.rb (by whiteleaf7)](https://github.com/whiteleaf7/narou) をオリジナルとしています。" | |
| echo "- 本リポジトリ ([ponponusa/narou](https://github.com/ponponusa/narou)) は、" | |
| echo " オリジナルの narou.rb をベースに改良・保守を行っている非公式フォークです。" | |
| echo "" | |
| echo "- ライセンス: [MIT License](https://opensource.org/licenses/MIT)" | |
| echo "- 著作者: [whiteleaf7](https://github.com/whiteleaf7) (original), [Rumia-Channel](https://github.com/Rumia-Channel) (fork from), [ponponusa](https://github.com/ponponusa) (mod maintainer)" | |
| echo "" | |
| echo "この改良版はオープンソースライセンスに基づき配布されています。" | |
| echo "利用・再配布・改変は自由ですが、利用者自身の責任のもとで行ってください。" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "_自動生成: GitHub Actions (${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})_" | |
| } > release_body.md | |
| echo "body_path=release_body.md" >> $GITHUB_OUTPUT | |
| - name: Create or Update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.build-gem-linux.outputs.version }} | |
| name: ${{ needs.build-gem-linux.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| files: dist/*.gem | |
| body_path: ${{ steps.gen_body.outputs.body_path }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |