v0.9.0: smart run-merge for cross-run .docx placeholders #48
Workflow file for this run
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: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: test (${{ matrix.os }} / node ${{ matrix.node-version }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| node-version: ['18', '20', '22'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm test | |
| coverage: | |
| name: coverage (line ≥ 80%) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| - run: npm ci | |
| - name: run coverage | |
| run: | | |
| out=$(node --test --experimental-test-coverage tests/test_*.mjs 2>&1) | |
| echo "$out" | tail -40 | |
| line=$(echo "$out" | awk -F'|' '/draft-cli\.mjs/ { gsub(/ /,"",$2); print $2 }') | |
| echo "line coverage: $line" | |
| awk -v c="$line" 'BEGIN { exit !(c+0 >= 80) }' \ | |
| || { echo "::error::line coverage ${line}% < 80%"; exit 1; } | |
| smoke: | |
| name: smoke (pack + install + run) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| - run: npm ci | |
| - run: npm pack | |
| - name: install the just-built tarball globally | |
| run: | | |
| tarball=$(ls -1t ./*.tgz | head -n1) | |
| npm install -g "$tarball" | |
| - name: assert the bin actually runs (regression guard for 0.1.0) | |
| run: | | |
| out=$(draft --version) | |
| echo "version output: $out" | |
| [[ "$out" == draft-cli* ]] || { echo "::error::draft --version produced unexpected output: '$out'"; exit 1; } | |
| demo=$(draft --demo) | |
| echo "demo first line: $(echo "$demo" | head -n1)" | |
| # --demo writes the substituted template to stdout (and the "demo: substituting..." line to stderr). | |
| # Grep for the substituted Party A value to prove the substitution actually ran end-to-end. | |
| echo "$demo" | grep -q "Acme Corporation" || { echo "::error::draft --demo stdout did not contain substituted [Party A]"; exit 1; } |