Skip to content

Commit c344fda

Browse files
authored
chore(tooling): setup GitHub actions, add CODEOWNERS and PR template (#20)
1 parent ef603fb commit c344fda

File tree

5 files changed

+109
-12
lines changed

5 files changed

+109
-12
lines changed

.github/CODEOWNERS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Default owners
2+
3+
- @algolia/data-ingestion

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 🧭 What and Why
2+
3+
🎟 JIRA Ticket:
4+
5+
### Changes included:
6+
7+
- List changes
8+
9+
## 🧪 Test
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: client_javascript
2+
3+
on:
4+
workflow_run:
5+
workflows: ['specs']
6+
types:
7+
- completed
8+
9+
jobs:
10+
build:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- uses: actions/setup-java@v2
17+
with:
18+
distribution: 'zulu'
19+
java-version: '11'
20+
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version-file: '.nvmrc'
24+
cache: 'yarn'
25+
cache-dependency-path: 'yarn.lock'
26+
27+
- name: Install Dependencies
28+
run: yarn install
29+
30+
- name: Generate search client
31+
run: yarn generate:js:search
32+
33+
- name: Build search client
34+
run: yarn client:build-js:search
35+
36+
- name: Generate recommend client
37+
run: yarn generate:js:recommend
38+
39+
- name: Build recommend client
40+
run: yarn client:build-js:recommend
41+
42+
- name: Lint
43+
run: yarn prettier --check clients/algoliasearch-client-javascript
44+
45+
build-failure:
46+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Error on `specs` workflow
50+
run: exit 1

.github/workflows/specs.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: specs
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- uses: actions/setup-java@v2
12+
with:
13+
distribution: 'zulu'
14+
java-version: '11'
15+
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version-file: '.nvmrc'
19+
cache: 'yarn'
20+
cache-dependency-path: 'yarn.lock'
21+
22+
- name: Install Dependencies
23+
run: yarn install
24+
25+
- name: Build
26+
run: yarn build:spec
27+
28+
- name: Validate
29+
run: yarn validate
30+
31+
- name: Lint
32+
run: yarn prettier --check specs

package.json

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,30 @@
66
"playground/javascript/"
77
],
88
"scripts": {
9-
"build:spec:recommend:json": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile dist/openapi.json --type json",
10-
"build:spec:search:json": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/openapi.json --type json",
11-
"build:spec:recommend": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile dist/recommend.yml --type yaml",
12-
"build:spec:search": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/search.yml --type yaml",
13-
"build:spec:json": "yarn build:spec:search:json",
9+
"build:spec:recommend:json": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile specs/dist/recommend.json --type json",
10+
"build:spec:search:json": "yarn swagger-cli bundle specs/search/spec.yml --outfile specs/dist/search.json --type json",
11+
"build:spec:recommend": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile specs/dist/recommend.yml --type yaml",
12+
"build:spec:search": "yarn swagger-cli bundle specs/search/spec.yml --outfile specs/dist/search.yml --type yaml",
13+
"build:spec:json": "yarn build:spec:search:json && yarn build:spec:recommend:json",
1414
"build:spec": "yarn build:spec:search && yarn build:spec:recommend",
1515
"clean": "rm -rf **/dist **/build **/node_modules",
16-
"client:build-js": "yarn workspace @algolia/recommend build && yarn workspace @algolia/client-search build",
16+
"client:build-js:search": "yarn workspace @algolia/client-search build",
17+
"client:build-js:recommend": "yarn workspace @algolia/client-search build",
18+
"client:build-js": "yarn client:build-js:search && yarn client:build-js:recommend",
1719
"client:build": "yarn client:build-js",
18-
"lint:js": "yarn prettier --write clients/algoliasearch-client-javascript",
20+
"lint:js": "yarn prettier --write clients/algoliasearch-client-javascript/${CLIENT}",
1921
"lint:specs": "yarn prettier --write specs",
2022
"lint": "yarn lint:specs && yarn lint:js",
21-
"generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js",
22-
"generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-client-search && CLIENT=client-search yarn utils:import-js",
23-
"generate:js": "yarn generate:js:search && yarn generate:js:recommend && yarn install",
23+
"generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js && CLIENT=recommend yarn lint:js",
24+
"generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-client-search && CLIENT=client-search yarn utils:import-js && CLIENT=client-search yarn lint:js",
25+
"generate:js": "yarn generate:js:search && yarn generate:js:recommend",
2426
"generate:recommend": "yarn generate:js:recommend",
2527
"generate:search": "yarn generate:js:search",
26-
"generate": "yarn generate:js && yarn lint",
28+
"generate": "yarn generate:js && yarn lint:specs",
2729
"playground:js:search": "yarn workspace javascript-playground start:search",
2830
"playground:js:recommend": "yarn workspace javascript-playground start:recommend",
29-
"utils:import-js": "mkdir -p -- clients/algoliasearch-client-javascript/${CLIENT}/utils && cp -R clients/algoliasearch-client-javascript/utils/ clients/algoliasearch-client-javascript/${CLIENT}/utils"
31+
"utils:import-js": "mkdir -p -- clients/algoliasearch-client-javascript/${CLIENT}/utils && cp -R clients/algoliasearch-client-javascript/utils/ clients/algoliasearch-client-javascript/${CLIENT}/utils",
32+
"validate": "yarn swagger-cli validate specs/dist/search.yml && yarn swagger-cli validate specs/dist/recommend.yml"
3033
},
3134
"devDependencies": {
3235
"@openapitools/openapi-generator-cli": "^2.4.13",

0 commit comments

Comments
 (0)