-
Notifications
You must be signed in to change notification settings - Fork 96
fix(ci): GitHub で回っていなかったユニットテストを回し、ローカルと経路を揃える #1911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mhaya
wants to merge
33
commits into
develop_v2.0.5
Choose a base branch
from
fix/issue62764
base: develop_v2.0.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,647
−1,188
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
9e32ff8
ci: GitHub で回っていなかったユニットテストを回す
mhaya 06a072d
ci: ローカルと CI で同じ経路を通す仕組みを入れる
mhaya 7ecb552
ci: ローカル実行を CPU アーキで分岐させない
mhaya 7bd194b
test: CI で初めて走ったユニットテストの失敗を直す (第1弾)
mhaya c4f611d
test: CI で初めて走ったユニットテストの失敗を直す (第2弾)
mhaya 7093021
test: weko-itemtypes-ui の register ACL / 重複マッピング判定を直す
mhaya 4046d35
test: CI で初めて走ったユニットテストの失敗を直す (第3弾)
mhaya ecd14da
test: CI で初めて走ったユニットテストの失敗を直す (第4弾)
mhaya 3e5e371
test: CI で初めて走ったユニットテストの失敗を直す (第5弾)
mhaya 449e2c9
test: CI で初めて走ったユニットテストの失敗を直す (第6弾)
mhaya 73422d2
test: CI で初めて走ったユニットテストの失敗を直す (第7弾)
mhaya b73242d
test: CI で初めて走ったユニットテストの失敗を直す (第8弾)
mhaya a2d3c5a
test: CI で初めて走ったユニットテストの失敗を直す (第9弾)
mhaya 608d096
test: 残りのユニットテスト失敗を直し、ジョブの制限時間を実測に合わせる
mhaya 01972a3
ci: 5時間かかるモジュールをテスト本数で分割して回す
mhaya 51c092b
ci: 分割の偏りに合わせて分割数と制限時間を見直す
mhaya 8dbb3aa
test: weko-search-ui の NDL JaLC まわりの期待値を実挙動に合わせる
mhaya 0590cc8
test: weko-workflow の残り 15 本を直す
mhaya e03613f
test: weko-workflow [8/8] が 120 分で打ち切られていた原因を潰す
mhaya 8cd4b70
test: weko-deposit [8/8] が 120 分で打ち切られていた原因を潰す
mhaya a2e0de7
ci: テストのタイムアウトを実際に効かせる
mhaya fd2f386
test: weko-deposit の失敗を直す (1/2)
mhaya 1510213
test: weko-deposit の失敗を直す (2/2)
mhaya e6cd609
test: weko-deposit の残り 3 本を直す
mhaya d532a5b
test: weko-records-ui の 5 本を直す
mhaya 3d3852c
test: weko-search-ui の 10 本を直す
mhaya 4b38d9e
test: weko-search-ui の最後の1本 (test_check_jsonld_import_items) を直す
mhaya 5a7e6d6
test: CI に残っていた5本を直す
mhaya d6115d2
test: test_function_issue35902 の比較を並び順に依存させない
mhaya b69d49b
test: weko-search-ui [6/6] の 3 本を直す
mhaya cefaa30
test: 時刻依存と werkzeug 依存の2本を直す
mhaya d7803c6
test: 共有された WEKO_SEARCH_KEYWORDS_DICT の破壊を止める
mhaya f22d8d1
test: create_export_all_data のレコード数を減らす
mhaya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # WEKO3 リポジトリ(RCOSDP/weko)の .github/workflows/ に配置する。 | ||
| # | ||
| # 台帳ツールの単体テスト。**Docker も実機も台帳も要らない**ので数秒で終わる。 | ||
| # api-inventory-drift.yml(実機を起こして突き合わせる。60分枠)とは役割が違う: | ||
| # | ||
| # このワークフロー … 台帳を作る側(スクリプト・手順書)が壊れていないか | ||
| # drift ワークフロー … 台帳の中身が実機とずれていないか | ||
| # | ||
| # ツールが壊れたまま drift だけ回すと、検知器が黙って死んでいても緑で通る。 | ||
| # 先にこちらを通すこと。Secret も不要なので fork からの PR でも動く。 | ||
|
|
||
| name: API Inventory Tests | ||
|
|
||
| # 対象は tools/api-inventory/ だけなので、そこを触ったときだけ回す。 | ||
| # push と pull_request でパスの並びを揃えること(片方だけ古びると、 | ||
| # 「PR では回るが push では回らない」といった説明のつかない差になる)。 | ||
| on: | ||
| pull_request: | ||
| paths: &paths | ||
| - 'tools/api-inventory/**' | ||
| - '.github/workflows/api-inventory-tests.yml' | ||
| push: | ||
| branches: ['**'] | ||
| paths: *paths | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| unit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install pytest | ||
| run: python3 -m pip install --disable-pip-version-check pytest | ||
|
|
||
| - name: Run unit tests | ||
| working-directory: tools/api-inventory | ||
| run: python3 -m pytest -q | ||
|
|
||
| # 台帳が無くても、ソースからの経路検知そのものは動く。 | ||
| # 検知件数が 0 に落ちていれば、検知器が壊れている。 | ||
| - name: Smoke check the static detector | ||
| run: | | ||
| set -o pipefail | ||
| python3 tools/api-inventory/scripts/detect_routes.py \ | ||
| --weko-root "$PWD" --summary-only | tee /tmp/detect.md | ||
| python3 - <<'PY' | ||
| import re, sys | ||
| text = open('/tmp/detect.md', encoding='utf-8').read() | ||
| total = int(re.search(r'\*\*計\*\* \| \*\*(\d+)\*\*', text).group(1)) | ||
| print(f'detections={total}') | ||
| # 経路が数百ある前提のリポジトリ。2桁に落ちたら検知器の故障を疑う。 | ||
| sys.exit(0 if total >= 300 else 1) | ||
| PY | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): GitHub Actions rejects these workflow files because its workflow parser does not support YAML anchors and aliases. The
API Inventory Testsworkflow therefore fails validation and never starts, so neither the 107 unit tests nor the smoke check runs.Suggested fix: Spell out the
pathslist separately forpull_requestandpush, or generate/synchronize the workflow files outside GitHub Actions rather than using YAML anchors.