1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CI
on:
push:
branches:
pull_request:
branches:
workflow_dispatch:
permissions:
contents: read
actions: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo clippy --all-targets --locked -- -D warnings
- run: cargo check --all-targets --locked
test:
name: Test
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
# No-op on macOS via runner.os guard inside the composite action.
- uses: Swatinem/rust-cache@v2
# Runs the lib unit tests, the drift gate (tests/ported_fn_names_match_c.rs,
# which derives the legal-name set straight from the vendored vendor/ tree so
# a fresh checkout passes), and the example self-tests (tests/examples.rs
# runs every examples/*.vim, each of which asserts its own results with the
# built-in assert_* framework and exits non-zero on a regression).
- run: cargo test --locked --no-fail-fast
# fmt + clippy (deny warnings) run in the `check` job above. The `doc` gate
# stays without `-D warnings`: the ported tree carries faithful-to-C doc
# comments whose [bracket] snippets trip rustdoc's intra-doc-link lint, so
# cosmetic doc warnings are advisory (hard doc errors still fail the build).
doc:
name: Doc
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# No `-D warnings`: the ported tree carries many faithful-to-C doc
# comments whose `[bracket]` snippets trip rustdoc's intra-doc-link
# lint. Hard doc errors still fail the build; cosmetic warnings do not.
- run: cargo doc --no-deps --locked
examples:
name: Example scripts
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked
# Run every examples/*.vim through the real binary. Each example is a
# self-test: it asserts its results with the built-in assert_* framework
# and `throw`s (non-zero exit) on a failed assertion, so a behaviour
# regression in a ported builtin fails this job. The interactive example
# gets its canned stdin from tests/fixtures/interactive.in.
- name: Run example scripts
run: sh scripts/run_examples.sh
env:
VIMLRS: ${{ github.workspace }}/target/release/viml
release-build:
name: Release Build
needs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# No-op on macOS via runner.os guard in the composite action.
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: viml-${{ matrix.target }}
path: target/${{ matrix.target }}/release/viml