Harden CI and release artifacts

This commit is contained in:
2026-08-11 23:15:18 +09:00
parent ed2ba07ce1
commit a0750e4d5f
8 changed files with 107 additions and 39 deletions

View File

@@ -40,7 +40,8 @@ type table struct {
}
```
CSV/TSV/XLSXの読み込みでは、短い行を空文字で埋めて列数を揃えます。
CSV/TSV/XLSXの読み込みでは、短い行を空文字で埋めて列数を揃えます。ヘッダーより
長い行は、名前のない値を破棄しないようエラーにします。
XLSXの書き出しではヘッダーを太字にし、1行目を固定します。
## Flattening
@@ -49,6 +50,7 @@ structured -> table では、入れ子のmap/arrayを列パスへ展開します
- map: `user.name`
- array: `items[0].sku`
- delimiterを含むmap key: `settings["build.target"]`
- top-level scalar: `value`
列順は安定性を優先してソートしています。Excel上で列の位置が変わっても、
@@ -84,20 +86,37 @@ items[0].sku
- 小数または指数表記: float64
- その他: string
ゼロ埋め整数は、IDやコードを壊さないためstringとして保持します。複数列が同じパスで
異なる中間型を要求する場合は、先に構築された値を後続列で上書きしません。
ゼロ埋め整数と前後に空白があるセルは、IDや文字列を壊さないためstringとして
保持します。複数列が同じパスで異なる中間型を要求する場合はエラーにし、入力列を
黙って捨てません。
### Path grammar
現在の列パスは次の要素を扱います。
```text
path = key, { ".", key | "[", index, "]" };
index = digit, { digit };
path = first-key, { map-child | quoted-key | array-index };
first-key = bare-key | quoted-key;
map-child = ".", bare-key;
quoted-key = "[", JSON-string, "]";
array-index = "[", digit, { digit }, "]";
```
実例は `user.name``items[0].sku``orders[0].items[1].qty` です。
区切り文字を含むmap keyのescapeは未対応です。
実例は `user.name``items[0].sku``orders[0].items[1].qty` です。map keyに
`.``[``]` が含まれる場合や空文字の場合は、`["build.target"]``[""]`
ようなJSON quoted keyを使います。連続したarray indexも扱うため、
`matrix[0][1]` を復元できます。入力サイズに対して過大なmemory allocationを
起こさないよう、pathは最大256要素、array indexは最大10000です。
## Structured input integrity
- JSON inputはUTF-8として検証します。decoderは最初の値の後まで読み、空白以外の
後続データを拒否します。object keyもtoken単位で読み、重複を拒否します。
- YAML decoderはstream終端まで読み、複数文書を順序付きsliceとして保持します。
- `rows``records``items` wrapperはオブジェクト唯一のキーである場合だけ
table rowsとして展開します。
- recordが存在するのにscalar fieldが1つもないstructured valueは、表へ変換すると
record数を失うため拒否します。空のrecord listは空の表として扱います。
## TOML Output
@@ -110,10 +129,11 @@ TOMLはトップレベル配列を直接表せないため、表からTOMLへ出
- `gopkg.in/yaml.v3`: YAML読み書き
- `github.com/BurntSushi/toml`: TOML読み書き
Go 1.24以上を前提にしています。
Go 1.25以上を前提にしています。
## Error handling
- 未対応形式、decode失敗、workbook/sheet操作失敗は呼び出し元へerrorを返します。
- path復元中の型競合は既存値を保護するため、その列の適用を中止します。
- CSV/TSVのinvalid UTF-8、headerより長い行、値を持つ空header列を拒否します。
- path復元中の重複header、構文エラー、型競合は変換全体をerrorにします。
- XLSXのstyle・pane設定も通常の変換errorとして扱い、不完全なworkbookを成功扱いしません。

View File

@@ -2,7 +2,7 @@
## Requirements
- Go 1.24 or later
- Go 1.25 or later
## Setup
@@ -53,9 +53,14 @@ The current tests cover:
- JSON -> XLSX -> JSON round trip
- structured -> structured conversion without CLI/file I/O
- extension normalization and format inference
- ragged table row padding
- short table row padding and wider-row rejection
- conservative cell type inference, including zero-padded identifiers
- conflicting unflatten paths
- whitespace and UTF-8 BOM preservation rules
- invalid UTF-8, duplicate keys, and trailing-data rejection for JSON
- multi-document YAML streams and empty-record table boundaries
- wrapper arrays with sibling metadata
- duplicate, blank, malformed, and conflicting headers
- nested arrays and JSON-quoted path keys
When adding a new format or path rule, add tests around both directions where
possible.
@@ -67,14 +72,18 @@ Gitea Actions workflows live under `.gitea/workflows`.
- `ci.yml`: runs on pushes to `main`, pull requests, and manual dispatch.
- `release.yml`: runs on `v*` tag pushes and manual dispatch with a `tag` input.
The CI workflow checks formatting, runs tests, builds the CLI, and performs a
small YAML -> TSV -> JSON smoke test.
The CI workflow checks formatting, runs tests and `go vet`, scans reachable
vulnerabilities with `govulncheck`, builds the CLI, and performs a small
YAML -> TSV -> JSON smoke test.
The release workflow runs tests, cross-builds release archives for Linux,
macOS, and Windows on amd64/arm64, writes `checksums.txt`, creates or reuses a
Gitea Release, and uploads the generated assets. It uses the built-in
`${{ secrets.GITEA_TOKEN }}` provided by Gitea Actions.
Release binaries receive their tag through the `main.buildVersion` linker
variable. Verify an extracted native binary with `dataxl -version`.
## Release Notes
Create a release by pushing a version tag: