Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit efebc6b

Browse files
committed
ci(project): setup a smoke test
1 parent c0fd7dd commit efebc6b

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
docker:
2828
- image: circleci/node:12
2929

30+
test-smoke:
31+
<<: *defaults
32+
steps:
33+
- checkout
34+
- <<: *install
35+
- run: ./.circleci/smoke.sh
36+
3037
lint:
3138
<<: *defaults
3239
steps:
@@ -58,5 +65,6 @@ workflows:
5865
- test-node8
5966
- test-node10
6067
- test-node12
68+
- test-smoke
6169
- lint
6270
- docs

.circleci/smoke.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
TMPDIR="$(mktemp -d 2>/dev/null || mktemp -d -t 'apiejs-smoketest')"
6+
API_ELEMENTS="$(pwd)"
7+
8+
create_package() {
9+
cd "$TMPDIR" && npm init --yes && cd "$API_ELEMENTS"
10+
}
11+
12+
install() {
13+
PACKAGE="$1"
14+
15+
TARBALL="$(cd packages/$PACKAGE && npm pack)"
16+
mv "packages/$PACKAGE/$TARBALL" "$TMPDIR"
17+
18+
cd "$TMPDIR" && npm install "$TARBALL" && cd "$API_ELEMENTS"
19+
}
20+
21+
echo "Setting up Fury in $TMPDIR"
22+
23+
create_package
24+
install fury
25+
install fury-adapter-apib-parser
26+
install fury-adapter-oas3-parser
27+
install fury-adapter-apiary-blueprint-parser
28+
install fury-adapter-apib-serializer
29+
install fury-cli
30+
31+
cd "$TMPDIR"
32+
npx fury --help
33+
npx fury --version
34+
35+
# Parse Apiary Blueprint
36+
cat << EOF | npx fury -
37+
HOST: http://www.google.com/
38+
39+
--- Sample API v2 ---
40+
---
41+
Welcome to the our sample API documentation. All comments can be written in (support [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax)
42+
---
43+
EOF
44+
45+
# Parse API Blueprint
46+
cat << EOF | npx fury -
47+
FORMAT: 1A
48+
49+
# GET /
50+
51+
+ Response 204
52+
EOF
53+
54+
# Parse OpenAPI 2.0
55+
cat << EOF | npx fury -
56+
swagger: '2.0'
57+
info:
58+
title: My API
59+
version: 1.0.0
60+
paths: {}
61+
EOF
62+
63+
# Parse OpenAPI 3.0
64+
cat << EOF | npx fury -
65+
openapi: 3.0.2
66+
info:
67+
title: My API
68+
version: 1.0.0
69+
paths: {}
70+
EOF
71+
72+
rm -fr "$TMPDIR"

0 commit comments

Comments
 (0)