Repository navigation
#334 を実装する(スプリント m7a) #971
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 | |
| on: | |
| # push は main と統合ブランチ(release/** と mission/**)だけで走らせる。 | |
| # それ以外のブランチは Pull Request の検査で見るため、二重に走らせない。 | |
| push: | |
| branches: [main, 'release/**', 'mission/**'] | |
| # Pull Request は宛先を絞らない(積み重ねた Pull Request も検査する)。 | |
| pull_request: | |
| jobs: | |
| python-syntax: | |
| name: Python syntax check | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Compile-check Python sources | |
| run: python -m compileall -q lib bin | |
| lint: | |
| name: Ruff lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: "check --select=E9,F63,F7,F82 lib" | |
| shellcheck: | |
| name: ShellCheck | |
| runs-on: ubuntu-latest | |
| env: | |
| # 手元の基準 (devbase-base:latest の shellcheck) に揃える。containers/base/Dockerfile の版の確認と一緒に上げる (#247) | |
| SHELLCHECK_VERSION: v0.11.0 | |
| SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198 | |
| # どの step も水準を絞らない (既定の style まで)。検査の前に使う shellcheck の版をログへ出す。 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install ShellCheck ${{ env.SHELLCHECK_VERSION }} | |
| run: | | |
| f="shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | |
| curl -fsSL -o "$RUNNER_TEMP/$f" "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/$f" | |
| echo "${SHELLCHECK_SHA256} $RUNNER_TEMP/$f" | sha256sum -c - | |
| tar -xJf "$RUNNER_TEMP/$f" -C "$RUNNER_TEMP" | |
| echo "$RUNNER_TEMP/shellcheck-${SHELLCHECK_VERSION}" >> "$GITHUB_PATH" | |
| # GITHUB_PATH へ書いた場所は次の step から効くため、版の確認は導入と分ける | |
| - name: Check ShellCheck version | |
| run: | | |
| shellcheck --version | grep -Fx "version: ${SHELLCHECK_VERSION#v}" | |
| - name: Run ShellCheck on bin/ | |
| run: shellcheck --version | sed -n 2p && shellcheck bin/* | |
| - name: Run ShellCheck on install.sh | |
| run: shellcheck --version | sed -n 2p && shellcheck install.sh | |
| # containers/base のシェルスクリプト (#259)。シェルスクリプトを足したらここへも足す。 | |
| # 漏れは tests/containers/test_base_shellcheck_ci.py が落とす | |
| - name: Run ShellCheck on containers/base/ | |
| run: | | |
| shellcheck --version | sed -n 2p && shellcheck \ | |
| containers/base/ai-cli-aliases.sh \ | |
| containers/base/dind \ | |
| containers/base/entrypoint.sh \ | |
| containers/base/shellrc-dir.sh \ | |
| containers/base/tmux-clean \ | |
| containers/base/tmux-first \ | |
| containers/base/tmux-session | |
| pytest: | |
| name: Pytest (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # requires-python の下限と、手元で使う版 (PLAN60 前提 1) | |
| python-version: ["3.10", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies from uv.lock | |
| run: uv sync --locked | |
| - name: Run pytest | |
| # CI に DEVBASE_ROOT は無い。テストは自前の tmp を DEVBASE_ROOT に向ける (PLAN60 前提 4) | |
| run: uv run --locked pytest tests/ -q | |
| # pytest の matrix の全版を 1 つのチェックにまとめる (#277)。main の必須チェックはこの名前で照合する。 | |
| # matrix の版を変えても名前は変わらないため、保護設定を直さずに済む。 | |
| # always() で pytest の結論に関わらず走らせる。skipped は必須チェックで合格と扱われるため出さない。 | |
| pytest-all: | |
| name: Pytest | |
| needs: pytest | |
| if: always() | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check all pytest versions passed | |
| env: | |
| RESULT: ${{ needs.pytest.result }} | |
| run: | | |
| echo "pytest の matrix の結果: ${RESULT}" | |
| test "${RESULT}" = success | |
| # CHANGELOG の検査 (#335)。main 宛ての Pull Request だけで走り、見張るパスを変えて CHANGELOG.md を | |
| # 変えていなければ未記入の警告を出す。警告ではジョブを失敗にしない。見張るパスは | |
| # .github/scripts/changelog_check.py の WATCHED_PATHS にだけ置く | |
| changelog: | |
| name: CHANGELOG check | |
| if: github.event_name == 'pull_request' && github.base_ref == 'main' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check CHANGELOG.md is updated | |
| env: | |
| BASE_REF: ${{ github.base_ref }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: python3 .github/scripts/changelog_check.py | |
| # 固有の語の検査 (#353)。すべてのトリガーで走り、secret PROPER_TERMS の語の一覧で追跡されたファイルを探す。 | |
| # secret は検査の手順の env にだけ渡す。フォークや未登録で空なら、検査は飛ばして成功で終わる。 | |
| # secret の登録と更新は人が行う | |
| proper-terms: | |
| name: Proper term check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Check proper terms | |
| env: | |
| PROPER_TERMS: ${{ secrets.PROPER_TERMS }} | |
| run: python3 .github/scripts/proper_term_check.py |