diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eaf6372 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +# CI — テストの門番 +# +# 経緯: このリポジトリは dependabot-automerge.yml で非 major の依存更新を +# 自動マージしているが、required status checks が未設定だった。 +# 既存の workflow は +# - codeql.yml : セキュリティスキャン +# - pip-audit.yml: 依存の脆弱性スキャン +# - validate.yml : validator.py --git-diff(差分の自作ルール検査) +# のいずれもビルド・テストの門番ではなく、tests/ (57 テスト) は +# CI で一度も実行されていなかった。つまり依存更新が「テストされずに」 +# マージされ得る状態だった(同種の穴で jan-anime-map では版ずれによる +# テスト失敗が長期間気づかれなかった)。 +# この workflow の job 名を required status check に登録すること。 +name: CI + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version: "3.12" + cache: pip + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest + + - name: Run tests + run: python -m pytest tests/ -q