Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Nov 11, 2023
0 parents commit 8762007
Show file tree
Hide file tree
Showing 100 changed files with 19,865 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
44 changes: 44 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/typedef": ["error"]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
5 changes: 5 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
self-hosted-runner:
labels:
- buildjet-2vcpu-ubuntu-2204
- buildjet-4vcpu-ubuntu-2204
- buildjet-8vcpu-ubuntu-2204
60 changes: 60 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Setup
description: ''

inputs:
node-version:
description: Node.js version
required: true
default: 20.4.0

pnpm-version:
description: pnpm version
required: true
default: 8.7.4

runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: ${{ inputs.pnpm-version }}

- uses: actions/setup-node@v3
name: Install Node.js
with:
node-version: ${{ inputs.node-version }}
registry-url: https://registry.npmjs.org
cache: pnpm

- name: Install dependencies
run: pnpm install
shell: bash
env:
CI: 'true'

- name: Set GITHUB_BRANCH and NX_BRANCH environment variable in pull request
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "GITHUB_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "NX_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Set GITHUB_BRANCH and NX_BRANCH environment variable
if: github.event_name != 'pull_request'
shell: bash
run: |
echo "GITHUB_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "NX_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3

- name: Cache Nx
uses: actions/cache@v2
with:
path: node_modules/.cache/nx
key: cache-nx-${{ env.NX_BASE }}-${{ env.NX_HEAD }}
restore-keys: |
cache-nx-2-${{ env.NX_BASE }}-
cache-nx-2-
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
67 changes: 67 additions & 0 deletions .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
on:
workflow_call:
inputs:
skip:
default: ''
required: false
type: string

env:
NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}
NX_VERBOSE_LOGGING: ${{ secrets.NX_VERBOSE_LOGGING }}
NX_SKIP_NX_CACHE: ${{ secrets.NX_SKIP_NX_CACHE }}
NX_TASKS_RUNNER: ${{ secrets.NX_TASKS_RUNNER }}
NX_PERF_LOGGING: ${{ secrets.NX_PERF_LOGGING }}

permissions:
contents: read
actions: read
pull-requests: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
if: contains(inputs.skip, 'build') == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
id: setup
uses: ./.github/actions/setup

- name: Run affected builds
run: pnpm nx affected:build

test:
runs-on: ubuntu-latest
if: contains(inputs.skip, 'test') == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
id: setup
uses: ./.github/actions/setup

- name: Run affected tests
run: pnpm nx affected:test

lint:
runs-on: ubuntu-latest
if: contains(inputs.skip, 'lint') == false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
id: setup
uses: ./.github/actions/setup

- name: Run affected linting
run: pnpm nx affected:lint
29 changes: 29 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
pull_request:
types: [synchronize, edited, opened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup

- name: Lint commit messages
run: pnpm commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}

- name: Lint pull request title
run: echo $PR_TITLE | yarn commitlint --verbose
env:
PR_TITLE: ${{ github.event.pull_request.title }}
122 changes: 122 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
on:
push:
branches:
- main
# Specify to run a workflow manually from the Actions tab on GitHub
workflow_dispatch:

permissions:
id-token: write
pages: write

env:
INSTANCE: Writerside/${{ github.event.repository.name }}
ARTIFACT: webHelp${{ github.event.repository.name }}2-all.zip
DOCKER_VERSION: 232.10165.1
ALGOLIA_ARTIFACT: algolia-indexes-${{ github.event.repository.name }}.zip
ALGOLIA_APP_NAME: Deepkit GraphQL
ALGOLIA_INDEX_NAME: docs
ALGOLIA_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
CONFIG_JSON_PRODUCT: ${{ github.event.repository.name }}
CONFIG_JSON_VERSION: 1.0

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.INSTANCE }}
artifact: ${{ env.ARTIFACT }}
docker-version: ${{ env.DOCKER_VERSION }}

- name: Upload documentation
uses: actions/upload-artifact@v3
with:
name: docs
path: |
artifacts/${{ env.ARTIFACT }}
artifacts/report.json
retention-days: 7

- name: Upload algolia-indexes
uses: actions/upload-artifact@v3
with:
name: algolia-indexes
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
retention-days: 7

test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: docs
path: artifacts

- name: Test documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.INSTANCE }}

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docs

- name: Unzip artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.ARTIFACT }} -d dir

- name: Setup Pages
uses: actions/configure-pages@v2

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: dir

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

publish-indexes:
needs: build
runs-on: ubuntu-latest
container:
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-2
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: algolia-indexes

- uses: montudor/action-zip@v1
with:
args: unzip -qq ${{ env.ALGOLIA_ARTIFACT }} -d algolia-indexes

- run: |
env "algolia-key=${{env.ALGOLIA_KEY}}" java -jar /opt/builder/help-publication-agent.jar \
update-index \
--application-name ${{env.ALGOLIA_APP_NAME}} \
--index-name ${{env.ALGOLIA_INDEX_NAME}} \
--product ${{env.CONFIG_JSON_PRODUCT}} \
--version ${{env.CONFIG_JSON_VERSION}} \
--index-directory algolia-indexes/ \
2>&1 | tee algolia-update-index-log.txt
27 changes: 27 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NX_VERBOSE_LOGGING: ${{ secrets.NX_VERBOSE_LOGGING }}
NX_SKIP_NX_CACHE: ${{ secrets.NX_SKIP_NX_CACHE }}
NX_TASKS_RUNNER: ${{ secrets.NX_TASKS_RUNNER }}
NX_PERF_LOGGING: ${{ secrets.NX_PERF_LOGGING }}
NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }}
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }}

permissions:
actions: write
contents: read
pull-requests: write
id-token: write

jobs:
build-test-lint:
uses: ./.github/workflows/build-test-lint.yml
secrets: inherit
with:
skip: lint
Loading

0 comments on commit 8762007

Please sign in to comment.