Repository navigation
160 lines (135 loc) · 4.74 KB
/
Copy pathtests.yml
File metadata and controls
160 lines (135 loc) · 4.74 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# From
# https://github.com/shortcuts/neovim-plugin-boilerplate/blob/main/.github/workflows/main.yml
name: tests
on:
push:
pull_request:
types: [opened, synchronize]
jobs:
lint:
runs-on: ubuntu-latest
name: lint
steps:
- uses: actions/checkout@v4
- name: Install StyLua
uses: JohnnyMorganz/stylua-action@v4
with:
version: latest
token: ${{ secrets.GITHUB_TOKEN }}
args: 'false'
- name: Check formatting
run: make format-check
typecheck:
runs-on: ubuntu-latest
name: typecheck
steps:
- uses: actions/checkout@v4
- name: setup neovim
id: setup_nvim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.11.4
- name: Add nvim to PATH
run: echo "${{ steps.setup_nvim.outputs.executable }}" >> $GITHUB_PATH
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install emmylua_check
run: cargo install emmylua_check --version 0.25.1 --locked
- name: Run type checks
run: make typecheck ARGS="-f github"
architecture:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: architecture check
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Check module imports against layer rules
id: check
env:
BASE_REF: ${{ github.base_ref }}
run: |
set +e
make -s topology-diff ARGS="--from origin/$BASE_REF --to HEAD --check --markdown" > architecture-report.md
echo "status=$?" >> "$GITHUB_OUTPUT"
cat architecture-report.md >> "$GITHUB_STEP_SUMMARY"
# Fork PRs get a read-only token; the job summary still carries the report.
- name: Post report on the pull request
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
run: |
[ -s architecture-report.md ] || exit 0
marker='<!-- architecture-check-report -->'
id=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" --paginate \
--jq ".[] | select(.body | startswith(\"$marker\")) | .id" | head -n1)
if [ -n "$id" ]; then
gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$id" -F body=@architecture-report.md
else
gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" -F body=@architecture-report.md
fi
- name: Fail on new problems
if: steps.check.outputs.status != '0'
run: exit 1
# See tests/unit/protocol_v2_event_coverage_spec.lua
event-contract:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.11.4
- name: Download opencode
run: |
VERSION=$(curl -fsSL "https://registry.npmjs.org/@opencode%2fcli-linux-x64" | jq -r '.["dist-tags"]["latest"]')
if [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; then
echo "::error::could not resolve latest @opencode/cli-linux-x64 version"
exit 1
fi
echo "opencode $VERSION (@opencode/cli-linux-x64)"
curl -fsSL "https://registry.npmjs.org/@opencode/cli-linux-x64/-/cli-linux-x64-$VERSION.tgz" -o /tmp/opencode.tgz
mkdir -p /tmp/opencode-unpack
tar -xzf /tmp/opencode.tgz -C /tmp/opencode-unpack
sudo install -m 0755 /tmp/opencode-unpack/package/bin/opencode /usr/local/bin/opencode
- name: Run event contract coverage
env:
OPENCODE_EVENTS_SOURCE: /usr/local/bin/opencode
run: ./run_tests.sh -t tests/unit/protocol_v2_event_coverage_spec.lua
test:
timeout-minutes: 4
strategy:
matrix:
os: [ubuntu-latest]
neovim_version: ["v0.10.3", "v0.11.4", "nightly"]
include:
- os: macos-latest
neovim_version: v0.11.4
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}
# only needed if testing in ssh but doesn't hurt
- name: Add nvim to PATH
run: echo "${{ steps.setup_nvim.outputs.executable }}" >> $GITHUB_PATH
- name: Run tests
run: make test
# # For sshing in to debug GH actions
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true