Skip to content
Open
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
6 changes: 6 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Explanation of Changes

## Checklist before requesting a review

- [ ] I have performed a self-review of my code
- [ ] Tested via unit tests
44 changes: 0 additions & 44 deletions .github/workflows/branch.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build
on:
workflow_call:
inputs:
node_version:
required: true
type: string
environment:
required: true
type: string
tag:
required: false
type: string
default: latest
build_cache_key:
required: false
type: string
default: build-cache-${{ github.sha }}

jobs:
initenv:
uses: ./.github/workflows/initialize.environment.yml
with:
environment: ${{ inputs.environment }}
build_cache_key: ${{ inputs.build_cache_key }}
node_version: ${{ inputs.node_version }}

dependencies:
needs: [initenv]
uses: ./.github/workflows/node.dependencies.yml
secrets: inherit
with:
node_version: ${{ needs.initenv.outputs.node_version }}
environment: ${{ needs.initenv.outputs.environment }}

compile:
needs: [initenv, dependencies]
uses: ./.github/workflows/compile.yml
secrets: inherit
with:
node_version: ${{ inputs.node_version }}
build_cache_key: ${{ inputs.build_cache_key }}
dependencies_cache_key: ${{ needs.dependencies.outputs.cache_key }}

unittest:
needs: [initenv, dependencies, compile]
uses: ./.github/workflows/unit.test.yml
secrets: inherit
with:
node_version: ${{ inputs.node_version }}
build_cache_key: ${{ inputs.build_cache_key }}
coverage_artifact_folder: 'apps/cli/coverage/lcov.info'

deploy:
name: Deploy
uses: ./.github/workflows/deploy.yml
needs: [unittest]
secrets: inherit
with:
node_version: ${{ inputs.node_version }}
build_cache_key: ${{ inputs.build_cache_key }}
tag: ${{ inputs.tag }}
89 changes: 89 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Compile
on:
workflow_call:
inputs:
node_version:
required: true
type: string
build_cache_key:
required: true
type: string
dependencies_cache_key:
required: true
type: string
package_manager:
required: false
type: string
default: pnpm
node_modules_path:
required: false
type: string
default: ./node_modules
turbo_cache_path:
required: false
type: string
default: ./.turbo

jobs:
Compile:
runs-on: ubuntu-latest
env:
CLI_BUILD: pnpm turbo build:ci
CLI_INSTALL: pnpm install --frozen-lockfile
CLI_LINT: pnpm turbo lint
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Install pnpm
if: ${{ inputs.package_manager == 'pnpm' }}
uses: pnpm/action-setup@v4

- name: Setup Node ${{ inputs.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: ${{ inputs.package_manager }}

- name: Retrieve dependencies cache
id: dependencies-cache
uses: actions/cache/restore@v4
with:
path: ${{ inputs.node_modules_path }}
key: ${{ inputs.dependencies_cache_key }}
fail-on-cache-miss: true

- name: Retrieve turbo cache
uses: actions/cache/restore@v4
with:
path: ${{ inputs.turbo_cache_path }}
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: ${{ runner.os }}-turbo-

- name: Install dependencies
env:
NODE_ENV: development # ensure all the dev dependencies are installed
run: ${{ env.CLI_INSTALL }}

- name: Build
run: ${{ env.CLI_BUILD }}

- name: Lint
run: ${{ env.CLI_LINT }}

- name: Upload turbo cache
uses: actions/cache@v4
with:
path: ${{ inputs.turbo_cache_path }}
key: ${{ runner.os }}-turbo-${{ github.sha }}

- name: Upload build cache
uses: actions/cache@v4
with:
path: ./*
key: ${{ inputs.build_cache_key }}
25 changes: 25 additions & 0 deletions .github/workflows/conclusion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Conclusion
on:
workflow_call:
inputs:
is_success:
required: true
type: boolean
release_title:
required: true
type: string

jobs:
github-release:
if: github.ref == 'refs/heads/main' && inputs.is_success
name: Update github release
uses: flexbase-eng/.github/.github/workflows/notify.github.release.yml@main
secrets: inherit

notify-slack:
name: Slack notification
uses: flexbase-eng/.github/.github/workflows/notify.slack.yml@main
secrets: inherit
with:
release_title: ${{ inputs.release_title }}
is_success: ${{ inputs.is_success }}
67 changes: 67 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Coverage
on:
workflow_call:
inputs:
project_key:
required: false
type: string
default: 'flexbase-eng_${{ github.event.repository.name }}'
coverage_artifact_folder:
required: false
type: string
default: 'coverage'
coverage_artifact_name:
required: false
type: string
default: 'code-coverage-report'
js_report_path:
required: false
type: string
default: 'coverage/lcov.info'
src_path:
required: false
type: string
default: './src/'
test_path:
required: false
type: string
default: './tests/'
exclusions:
required: false
type: string
default: '**/generated/**'

env:
SONAR_ORG: flexbase
SONAR_PROJECT_KEY: ${{ inputs.project_key }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

jobs:
sonarcloud:
name: Sonarcloud Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Retrieve coverage artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.coverage_artifact_name }}
path: ${{ inputs.coverage_artifact_folder }}

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=${{ env.SONAR_ORG }}
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.javascript.lcov.reportPaths=${{ inputs.js_report_path }}
-Dsonar.sources=${{inputs.src_path}}
-Dsonar.tests=${{inputs.test_path}}
-Dsonar.exclusions=${{inputs.exclusions}}
-Dsonar.log.level=WARN
72 changes: 72 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy
on:
workflow_call:
inputs:
node_version:
required: true
type: string
build_cache_key:
required: true
type: string
tag:
required: false
type: string
default: latest
registry_url:
required: false
type: string
default: 'https://registry.npmjs.org'
description: The package registry to use. Defaults to 'https://registry.npmjs.org'
secrets:
NODE_AUTH_TOKEN:
required: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
CLI_DEPLOY: pnpm deploy --prod ./apps/cli/bin --filter=cli
CLI_PUBLISH: pnpm publish ./apps/cli/bin --tag ${{ inputs.tag }} --no-git-checks

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node ${{ inputs.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: pnpm
registry-url: ${{ inputs.registry_url }}
always-auth: true

- name: Retrieve build cache
id: cache
uses: actions/cache/restore@v4
with:
path: ./*
key: ${{ inputs.build_cache_key }}
fail-on-cache-miss: true

# reference: https://stackoverflow.com/questions/54310050/how-to-version-build-artifacts-using-github-actions
# - name: beta - version value from package.json
# if: inputs.tag != 'latest'
# run: |
# npm i -g json
# json -I -f package.json -e "this.version=\"$(json -f package.json | json version)-${{ inputs.tag }}.${{ github.run_number }}\""

- name: Prep
run: |
${{ env.CLI_DEPLOY }}
pnpm turbo packr
npm i -g json
json -I -f ./apps/cli/bin/package.json -e "this.name=@flexbase/openapi-generator"

- name: Publish
run: ${{ env.CLI_PUBLISH }}
Loading
Loading