Skip to content

Commit dc39a23

Browse files
authored
chore(ci): re-use workflows, use composite action, cache built client. (#31)
1 parent c1ac7be commit dc39a23

File tree

10 files changed

+193
-132
lines changed

10 files changed

+193
-132
lines changed

.github/actions/cache/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Cache
2+
3+
description: Restore cached dependencies.
4+
5+
runs:
6+
using: 'composite'
7+
steps:
8+
- name: Get yarn cache directory path
9+
shell: bash
10+
id: yarn-cache-dir-path
11+
run: echo "::set-output name=dir::$(yarn cache dir)"
12+
13+
- name: Restore yarn cache
14+
uses: actions/cache@v2
15+
id: yarn-cache
16+
with:
17+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
18+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
19+
20+
- name: Restore node_modules
21+
uses: actions/cache@v2
22+
with:
23+
path: '**/node_modules'
24+
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}

.github/actions/setup/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Setup
2+
3+
description: Setup CI environment.
4+
5+
runs:
6+
using: 'composite'
7+
steps:
8+
- name: Restore cache
9+
uses: ./.github/actions/cache
10+
11+
- name: Update apt packages
12+
shell: bash
13+
run: sudo apt update
14+
15+
- name: Install Java
16+
uses: actions/setup-java@v2
17+
with:
18+
distribution: 'zulu'
19+
java-version: '11.0.4'
20+
21+
- name: Install Node
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version-file: '.nvmrc'
25+
26+
- name: Install JavaScript Dependencies
27+
shell: bash
28+
run: yarn install
29+
30+
- name: Install spec linter
31+
shell: bash
32+
run: sudo apt-get -y install yamllint

.github/workflows/check.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Checks
2+
3+
on: [push]
4+
5+
jobs:
6+
setup:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Setup
12+
uses: ./.github/actions/setup
13+
14+
specs:
15+
runs-on: ubuntu-20.04
16+
needs: setup
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Restore cache
21+
uses: ./.github/actions/cache
22+
23+
- name: Build
24+
run: yarn build:spec
25+
26+
- name: Validate
27+
run: yarn validate
28+
29+
- name: Lint
30+
run: yamllint specs
31+
32+
client_javascript:
33+
runs-on: ubuntu-20.04
34+
needs: [setup, specs]
35+
steps:
36+
- uses: actions/checkout@v2
37+
38+
- name: Restore cache
39+
uses: ./.github/actions/cache
40+
41+
- name: Generate search client
42+
run: yarn generate:js:search
43+
44+
- name: Build search client
45+
run: yarn client:build-js:search
46+
47+
- name: Generate recommend client
48+
run: yarn generate:js:recommend
49+
50+
- name: Build recommend client
51+
run: yarn client:build-js:recommend
52+
53+
- name: Generate personalization client
54+
run: yarn generate:js:personalization
55+
56+
- name: Build personalization client
57+
run: yarn client:build-js:personalization
58+
59+
- name: Lint
60+
run: yarn lint
61+
62+
cts:
63+
runs-on: ubuntu-20.04
64+
needs: [setup, specs, client_javascript]
65+
steps:
66+
- uses: actions/checkout@v2
67+
68+
- name: Restore cache
69+
uses: ./.github/actions/cache
70+
71+
- name: Generate clients
72+
run: yarn generate
73+
74+
- name: Build client
75+
run: yarn client:build
76+
77+
- name: Generate CTS
78+
run: yarn cts:generate
79+
80+
- name: Run CTS
81+
run: yarn cts:test

.github/workflows/client_javascript.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/cts.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/specs.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.yamllint

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
yaml-files:
3+
- '*.yml'
4+
5+
rules:
6+
line-length: disable
7+
braces: enable
8+
brackets: enable
9+
colons: enable
10+
commas: enable
11+
comments:
12+
level: warning
13+
comments-indentation:
14+
level: warning
15+
document-end: disable
16+
document-start: { present: false }
17+
empty-lines: enable
18+
empty-values: disable
19+
hyphens: enable
20+
indentation: enable
21+
key-duplicates: enable
22+
key-ordering: disable
23+
new-line-at-end-of-file: enable
24+
new-lines: enable
25+
octal-values: disable
26+
quoted-strings: disable
27+
trailing-spaces: enable
28+
truthy:
29+
level: warning
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
# handle /2/filters?search= as well
12
get:
2-
# handle /2/filters?search= as well

specs/analytics/spec.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ security:
1313
- appId: []
1414
apiKey: []
1515
paths:
16-
# ########################
17-
# ### Status Endpoints ###
18-
# ########################
19-
/2/status:
20-
$ref: './paths/status/getStatus.yml'
21-
#
2216
# ##################################
2317
# ### Search Analytics Endpoints ###
2418
# ##################################
@@ -48,7 +42,7 @@ paths:
4842
# $ref: './paths/search/getAttributeTopFilters.yml'
4943
# /2/countries:
5044
# $ref: './paths/search/getTopCountries.yml'
51-
#
45+
5246
# #################################
5347
# ### Click Analytics Endpoints ###
5448
# #################################
@@ -60,3 +54,9 @@ paths:
6054
# $ref: './paths/click/getClickThroughRate.yml'
6155
# /2/conversions/conversionRate:
6256
# $ref: './paths/click/getConversionRate.yml'
57+
58+
# ########################
59+
# ### Status Endpoints ###
60+
# ########################
61+
/2/status:
62+
$ref: './paths/status/getStatus.yml'

0 commit comments

Comments
 (0)