ci: isolate temporary test databases from runner overlay I/O
Build and publish container images / images (push) Successful in 10m42s
Build and publish container images / images (push) Successful in 10m42s
This commit is contained in:
1 parent
131a7ca01f
commit
61ecd1ffbd
2 files changed
+18
-1
No files matched your search
+4
-1
@@ -14,7 +14,10 @@ FROM source AS test
|
|||||||
# Test packages create independent SQLite stores. Serialize packages to avoid
|
# Test packages create independent SQLite stores. Serialize packages to avoid
|
||||||
# concurrent server/store initialization exhausting the shared runner's I/O.
|
# concurrent server/store initialization exhausting the shared runner's I/O.
|
||||||
# Keep production database deadlines and the complete test suite unchanged.
|
# Keep production database deadlines and the complete test suite unchanged.
|
||||||
RUN go test -p 1 ./...
|
# Temporary test databases use bounded RAM-backed storage rather than the
|
||||||
|
# runner's overlay filesystem. Compiler temporary files remain on disk.
|
||||||
|
RUN --mount=type=tmpfs,target=/test-tmp,size=2147483648 \
|
||||||
|
TMPDIR=/test-tmp GOTMPDIR=/tmp go test -p 1 ./...
|
||||||
|
|
||||||
FROM source AS runtime
|
FROM source AS runtime
|
||||||
RUN go build -o /pageswiki ./cmd/pageswiki
|
RUN go build -o /pageswiki ./cmd/pageswiki
|
||||||
|
|||||||
@@ -121,6 +121,19 @@ Gitea 1.24 の自動ジョブトークンによるパッケージ公開は前提
|
|||||||
|
|
||||||
アプリイメージにはソースコードが含まれるため、パッケージの公開範囲にも注意する。
|
アプリイメージにはソースコードが含まれるため、パッケージの公開範囲にも注意する。
|
||||||
|
|
||||||
|
## テスト用一時領域
|
||||||
|
|
||||||
|
Dockerfileのtest段階では、全Goテストを`-p 1`でパッケージ単位に直列化する。
|
||||||
|
テスト用`TMPDIR`は最大2GiBのtmpfsとし、SQLiteの一時DBをrunnerのoverlay filesystemから分離する。
|
||||||
|
コンパイラ用`GOTMPDIR`はディスク側の`/tmp`に残す。tmpfsは当該RUNの間だけ存在し、
|
||||||
|
runtime段階や本番の保存先・WAL・接続タイムアウトには影響しない。
|
||||||
|
|
||||||
|
CI run 54では、直列化後も既存の壁紙・Ordoschnellic・Seheweitのテストが
|
||||||
|
SQLite接続初期化の5秒タイムアウトで失敗した。ストレージ競合を避ける措置であり、
|
||||||
|
テスト除外・再試行による成功扱い・本番の期限緩和は行わない。
|
||||||
|
tmpfsは最大2GiBのメモリを消費し得るため、runnerにはコンパイラ等と合わせた余裕が必要。
|
||||||
|
実ファイル保存の移行確認は、CIとは別に本番DBの隔離コピーで行う。
|
||||||
|
|
||||||
## タグ・容量・本番利用
|
## タグ・容量・本番利用
|
||||||
|
|
||||||
3 イメージ共通で `sha-<40桁のコミットID>` を使用し、自動 latest は付けない。
|
3 イメージ共通で `sha-<40桁のコミットID>` を使用し、自動 latest は付けない。
|
||||||
@@ -161,3 +174,4 @@ prefix の変更は `PAGESWIKI_IMAGE_PREFIX`(既定 git.anya.jp/anya)。
|
|||||||
- [Gitea 1.24 Actions の互換性・制限](https://docs.gitea.com/1.24/usage/actions/comparison/)
|
- [Gitea 1.24 Actions の互換性・制限](https://docs.gitea.com/1.24/usage/actions/comparison/)
|
||||||
- [Gitea Container Registry](https://docs.gitea.com/usage/packages/container/)
|
- [Gitea Container Registry](https://docs.gitea.com/usage/packages/container/)
|
||||||
- [Docker コンテナの DNS と hosts](https://docs.docker.com/engine/network/#dns-services)
|
- [Docker コンテナの DNS と hosts](https://docs.docker.com/engine/network/#dns-services)
|
||||||
|
- [Dockerfileの一時tmpfsマウント](https://docs.docker.com/reference/dockerfile/#run---mounttype-tmpfs)
|
||||||
Reference in new issue
Block a user