-
Notifications
You must be signed in to change notification settings - Fork 83
173 lines (144 loc) · 5.31 KB
/
test.yaml
File metadata and controls
173 lines (144 loc) · 5.31 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
161
162
163
164
165
166
167
168
169
170
171
172
173
name: tests
on:
push:
branches: [master]
pull_request:
jobs:
lint:
name: Lint (Python)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install ruff
run: pip install ruff
- name: Lint Python (undefined names, syntax errors)
working-directory: libs/openant-core
run: ruff check .
python-tests:
name: Python tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: ${{ github.repository == 'knostic/OpenAnt' && fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') || fromJSON('["ubuntu-latest"]') }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
libs/openant-core/requirements.txt
libs/openant-core/pyproject.toml
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: libs/openant-core/parsers/javascript/package-lock.json
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: libs/openant-core/parsers/go/go_parser/go.mod
cache-dependency-path: libs/openant-core/parsers/go/go_parser/go.mod
- name: Install Python dependencies
working-directory: libs/openant-core
run: pip install -r requirements.txt && pip install ".[dev]"
- name: Cache JS parser node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: libs/openant-core/parsers/javascript/node_modules
key: ${{ runner.os }}-jsparser-nodemodules-${{ hashFiles('libs/openant-core/parsers/javascript/package-lock.json') }}
- name: Install JS parser dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: libs/openant-core/parsers/javascript
run: npm ci
- name: Build go_parser binary (Linux/macOS)
if: runner.os != 'Windows'
working-directory: libs/openant-core/parsers/go/go_parser
run: go build -o go_parser .
- name: Build go_parser binary (Windows)
if: runner.os == 'Windows'
working-directory: libs/openant-core/parsers/go/go_parser
run: go build -o go_parser.exe .
- name: Run Python and parser tests
working-directory: libs/openant-core
run: python -m pytest tests/ -v
go-tests:
name: Go build + integration (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
env:
OPENANT_PYTHON: python
strategy:
fail-fast: false
matrix:
os: ${{ github.repository == 'knostic/OpenAnt' && fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') || fromJSON('["ubuntu-latest"]') }}
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: apps/openant-cli/go.mod
cache-dependency-path: apps/openant-cli/go.sum
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
libs/openant-core/requirements.txt
libs/openant-core/pyproject.toml
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "npm"
cache-dependency-path: libs/openant-core/parsers/javascript/package-lock.json
- name: Vet
working-directory: apps/openant-cli
run: go vet ./...
- name: Run Go unit tests
working-directory: apps/openant-cli
run: go test ./... -v
- name: Build (Linux/macOS)
if: runner.os != 'Windows'
working-directory: apps/openant-cli
run: go build -o openant .
- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: apps/openant-cli
run: go build -o openant.exe .
- name: Verify binary exists
working-directory: apps/openant-cli
shell: bash
run: |
if [ -f openant ] || [ -f openant.exe ]; then
echo "Binary built successfully"
else
echo "ERROR: Binary not found" && exit 1
fi
- name: Install Python dependencies
working-directory: libs/openant-core
run: pip install -r requirements.txt && pip install ".[dev]"
- name: Cache JS parser node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: libs/openant-core/parsers/javascript/node_modules
key: ${{ runner.os }}-jsparser-nodemodules-${{ hashFiles('libs/openant-core/parsers/javascript/package-lock.json') }}
- name: Install JS parser dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: libs/openant-core/parsers/javascript
run: npm ci
- name: Run Go CLI integration tests
working-directory: libs/openant-core
run: python -m pytest tests/test_go_cli.py -v --tb=short