-
Notifications
You must be signed in to change notification settings - Fork 111
189 lines (183 loc) · 6.76 KB
/
test.yml
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
on: [push, pull_request]
name: Test
jobs:
e2e-dependencies:
name: Run 'dependencies' end-to-end test
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: dependencies e2e test
working-directory: e2e/dependencies/consumer
run: |
cargo t
tsc bindings/* --noEmit --noUnusedLocals --strict
- name: dependencies e2e test with default export env
working-directory: e2e/dependencies/consumer
run: |
TS_RS_EXPORT_DIR=custom-bindings cargo t
shopt -s globstar
tsc custom-bindings/**/*.ts --noEmit --noUnusedLocals --strict
e2e-workspace:
name: Run 'workspace' end-to-end test
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: workspace e2e test
working-directory: e2e/workspace
run: |
cargo t
shopt -s globstar
tsc parent/bindings/**/*.ts --noEmit --noUnusedLocals --strict
rm -rf parent/bindings
- name: workspace e2e with default export env
working-directory: e2e/workspace
run: |
TS_RS_EXPORT_DIR=custom-bindings cargo t
shopt -s globstar
tsc parent/custom-bindings/**/*.ts --noEmit --noUnusedLocals --strict
rm -rf parent/custom-bindings
e2e-example:
name: End-to-end test example
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: example e2e test
working-directory: example
run: |
cargo t
tsc bindings/* --noEmit
- name: example e2e with default export env
working-directory: example
run: |
TS_RS_EXPORT_DIR=custom-bindings cargo t
shopt -s globstar
tsc custom-bindings/**/*.ts --noEmit --noUnusedLocals --strict
readme-up-to-date:
name: Check that README.md is up-to-date
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Check that README.md is up-to-date
working-directory: ts-rs
run: |
cargo install cargo-readme
diff -u ../README.md <(cargo readme)
test-all-features:
name: Test ts-rs with --all-features
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Test
working-directory: ts-rs
run: |
cargo test --all-features
shopt -s globstar
tsc bindings/**/*.ts --noEmit --noUnusedLocals --strict
rm -rf bindings
test-export-env:
name: Test ts-rs with TS_RS_EXPORT_DIR
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Test
working-directory: ts-rs
run: |
TS_RS_EXPORT_DIR=output cargo test --no-default-features
shopt -s globstar
tsc output/**/*.ts --noEmit --noUnusedLocals --strict
rm -rf output
test-absolute-export-env:
name: Test ts-rs with absolute TS_RS_EXPORT_DIR
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Test
working-directory: ts-rs
run: |
TS_RS_EXPORT_DIR=$(pwd)/output cargo test --no-default-features
shopt -s globstar
tsc output/**/*.ts --noEmit --noUnusedLocals --strict
rm -rf output
test-no-features:
name: Test ts-rs with --no-default-features
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Test
working-directory: ts-rs
run: |
cargo test --no-default-features
shopt -s globstar
tsc bindings/**/*.ts --noEmit --noUnusedLocals
rm -rf bindings
test-windows:
name: Test ts-rs with --all-features on Windows
runs-on: windows-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Test
working-directory: ts-rs
# Create empty tsconfig and cd into bindings to make tsc
# compile every ts file in the directory
run: |
cargo test --all-features
"{}" | Out-File bindings/tsconfig.json
cd bindings
npm i -g typescript
tsc --noEmit --noUnusedLocals --strict
cd ..
rm -r -fo bindings