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

Add Github actions #35

Merged
merged 12 commits into from
Jan 22, 2021
23 changes: 23 additions & 0 deletions .github/actions/dead-links/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dead Links
description: Run Dead Links Tests
runs:
using: "composite"
steps:
- name: Install deps
run: npm ci
shell: bash
- name: Prepare documentation
run: npm run doc-prepare
shell: bash
- name: Install docs repositories
run: npx kuzdoc iterate-repos:install --repos_path doc/framework/.repos/
shell: bash
- name: Link kuzdoc
run: npx kuzdoc framework:link -d /sdk/jvm/1/ -v 1
shell: bash
- name: Install typhoeus
run: sudo gem install typhoeus
shell: bash
- name: Run dead links tests
run: cd doc/framework/ && HYDRA_MAX_CONCURRENCY=20 ruby .ci/dead-links.rb -p src/sdk/jvm/1/
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy package
description: Run Deploy package

inputs:
BINTRAY_KEY:
description: BINTRAY_KEY
required: true
BINTRAY_USER:
description: BINTRAY_USER
required: true

runs:
using: "composite"
steps:
- name: Deploy to bintray
run: ./gradlew bintrayUpload
env:
BINTRAY_KEY: ${{ inputs.BINTRAY_KEY }}
BINTRAY_USER: ${{ inputs.BINTRAY_USER }}
shell: bash
53 changes: 53 additions & 0 deletions .github/actions/doc-deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy Documentation
description: Build doc, upload it to S3 and invalidate Cloudfront cache

inputs:
AWS_ACCESS_KEY_ID:
description: AWS Access key ID
required: true
AWS_SECRET_ACCESS_KEY:
description: AWS secret key
required: true
S3_BUCKET:
description: S3 bucket name
required: true
CLOUDFRONT_ID:
description: Cloudfront distribution ID
required: true
REGION:
description: AWS default region
required: true
FRAMEWORK_BRANCH:
description: Documentation framework branch to use
required: true

runs:
using: "composite"
steps:
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install python python-pip
pip install awscli --upgrade --user
shell: bash
- name: Build documentation
run: |
rm -fr doc/framework
npm install --production=false
npm run doc-prepare
npm run doc-build
env:
NODE_ENV: production
FRAMEWORK_BRANCH: ${{ inputs.FRAMEWORK_BRANCH }}
shell: bash
- name: Deploy documentation
run: |
npm run doc-upload
npm run doc-cloudfront
env:
AWS_DEFAULT_REGION: ${{ inputs.REGION }}
AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: ${{ inputs.S3_BUCKET }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ inputs.CLOUDFRONT_ID }}
shell: bash
13 changes: 13 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint
description: Run KTLint
runs:
using: "composite"
steps:
- name: Get ktlint
run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.40.0/ktlint
chmod a+x ktlint
shell: bash
- name: Run ktlint
run: ./ktlint "src/**/*.kt"
shell: bash
8 changes: 8 additions & 0 deletions .github/actions/snippets-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Snippets Tests
description: Run Snippets Testss
runs:
using: "composite"
steps:
- name: Launch Tests
run: docker-compose -f .ci/doc/docker-compose.yml run doc-tests index
shell: bash
8 changes: 8 additions & 0 deletions .github/actions/unit-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Unit Test
description: Run Unit Tests
runs:
using: "composite"
steps:
- name: Launch Tests
run: ./gradlew test
shell: bash
72 changes: 72 additions & 0 deletions .github/workflows/pull_request.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Pull request checks

on: [pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "8"
architecture: x64
- uses: ./.github/actions/lint

unit-tests:
name: Unit Tests
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "8"
architecture: x64
- uses: ./.github/actions/unit-tests

documentation-snippets-tests:
name: Documentation - Snippets Tests
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/[email protected]
with:
node-version: "12"
- uses: ./.github/actions/snippets-tests

documentation-dead-links:
name: Documentation - Dead links check
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/[email protected]
with:
node-version: "12"
- uses: ./.github/actions/dead-links
106 changes: 106 additions & 0 deletions .github/workflows/push_dev.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Deployment Doc Dev

on:
push:
branches:
- 1-dev

jobs:
lint:
name: Lint
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "8"
architecture: x64
- uses: ./.github/actions/lint

unit-tests:
name: Unit Tests
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "8"
architecture: x64
- uses: ./.github/actions/unit-tests

documentation-snippets-tests:
name: Documentation - Snippets Tests
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/[email protected]
with:
node-version: "12"
- uses: ./.github/actions/snippets-tests

documentation-dead-links:
name: Documentation - Dead links check
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/[email protected]
with:
node-version: "12"
- uses: ./.github/actions/dead-links


documentation-staging:
name: Documentation - Deploy to staging
runs-on: ubuntu-18.04
timeout-minutes: 30
needs: [lint, unit-tests, documentation-dead-links, documentation-snippets-tests]
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1
with:
node-version: "12"
- uses: ./.github/actions/doc-deploy
with:
REGION: us-west-2
S3_BUCKET: docs-next.kuzzle.io
CLOUDFRONT_ID: E2ZCCEK9GRB49U
FRAMEWORK_BRANCH: develop
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Loading