Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tooling): setup GitHub actions, add CODEOWNERS and PR template #20

Merged
merged 8 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default owners

- @algolia/data-ingestion
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 🧭 What and Why

🎟 JIRA Ticket:

### Changes included:

- List changes

## 🧪 Test
50 changes: 50 additions & 0 deletions .github/workflows/client_javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: client_javascript

on:
workflow_run:
workflows: ['specs']
types:
- completed

jobs:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job could depend on specs because it won't build with invalid spec.

Copy link
Member Author

@shortcuts shortcuts Nov 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, apparently the workflow_run option is only triggered when deployed on the main branch, which seems odd 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I remember when I worked on Github Actions, there are a bunch of things that worked only on main and not on prs, this was quite an annoying limitation :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will see once this PR is merged and will fix if it's not the case!

build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Install Dependencies
run: yarn install

- name: Generate search client
run: yarn generate:js:search

- name: Build search client
run: yarn client:build-js:search

- name: Generate recommend client
run: yarn generate:js:recommend

- name: Build recommend client
run: yarn client:build-js:recommend

- name: Lint
run: yarn prettier --check clients/algoliasearch-client-javascript

build-failure:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
- name: Error on `specs` workflow
run: exit 1
32 changes: 32 additions & 0 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: specs

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Install Dependencies
run: yarn install

- name: Build
run: yarn build:spec

- name: Validate
run: yarn validate

- name: Lint
run: yarn prettier --check specs
27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,30 @@
"playground/javascript/"
],
"scripts": {
"build:spec:recommend:json": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile dist/openapi.json --type json",
"build:spec:search:json": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/openapi.json --type json",
"build:spec:recommend": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile dist/recommend.yml --type yaml",
"build:spec:search": "yarn swagger-cli bundle specs/search/spec.yml --outfile dist/search.yml --type yaml",
"build:spec:json": "yarn build:spec:search:json",
"build:spec:recommend:json": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile specs/dist/recommend.json --type json",
"build:spec:search:json": "yarn swagger-cli bundle specs/search/spec.yml --outfile specs/dist/search.json --type json",
"build:spec:recommend": "yarn swagger-cli bundle specs/recommend/spec.yml --outfile specs/dist/recommend.yml --type yaml",
"build:spec:search": "yarn swagger-cli bundle specs/search/spec.yml --outfile specs/dist/search.yml --type yaml",
"build:spec:json": "yarn build:spec:search:json && yarn build:spec:recommend:json",
"build:spec": "yarn build:spec:search && yarn build:spec:recommend",
"clean": "rm -rf **/dist **/build **/node_modules",
"client:build-js": "yarn workspace @algolia/recommend build && yarn workspace @algolia/client-search build",
"client:build-js:search": "yarn workspace @algolia/client-search build",
"client:build-js:recommend": "yarn workspace @algolia/client-search build",
"client:build-js": "yarn client:build-js:search && yarn client:build-js:recommend",
"client:build": "yarn client:build-js",
"lint:js": "yarn prettier --write clients/algoliasearch-client-javascript",
"lint:js": "yarn prettier --write clients/algoliasearch-client-javascript/${CLIENT}",
"lint:specs": "yarn prettier --write specs",
"lint": "yarn lint:specs && yarn lint:js",
"generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js",
"generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-client-search && CLIENT=client-search yarn utils:import-js",
"generate:js": "yarn generate:js:search && yarn generate:js:recommend && yarn install",
"generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js && CLIENT=recommend yarn lint:js",
"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",
"generate:js": "yarn generate:js:search && yarn generate:js:recommend",
"generate:recommend": "yarn generate:js:recommend",
"generate:search": "yarn generate:js:search",
"generate": "yarn generate:js && yarn lint",
"generate": "yarn generate:js && yarn lint:specs",
"playground:js:search": "yarn workspace javascript-playground start:search",
"playground:js:recommend": "yarn workspace javascript-playground start:recommend",
"utils:import-js": "mkdir -p -- clients/algoliasearch-client-javascript/${CLIENT}/utils && cp -R clients/algoliasearch-client-javascript/utils/ clients/algoliasearch-client-javascript/${CLIENT}/utils"
"utils:import-js": "mkdir -p -- clients/algoliasearch-client-javascript/${CLIENT}/utils && cp -R clients/algoliasearch-client-javascript/utils/ clients/algoliasearch-client-javascript/${CLIENT}/utils",
"validate": "yarn swagger-cli validate specs/dist/search.yml && yarn swagger-cli validate specs/dist/recommend.yml"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.4.13",
Expand Down