Skip to content
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
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.4/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 run `yarn changeset`
- [ ] I have updated `README.md`
39 changes: 0 additions & 39 deletions .github/workflows/branch.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/build.test.package.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build, Test, Package, and Deploy
on:
workflow_call:
inputs:
node_version:
required: true
type: string
build_cache_key:
required: true
type: string
is_beta:
required: true
type: boolean
node_env:
required: true
type: string

jobs:
dependencies:
uses: ./.github/workflows/node.dependencies.yml
secrets: inherit
with:
node_version: ${{ inputs.node_version }}
node_env: ${{ inputs.node_env }}

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

unittest:
needs: [compile]
uses: ./.github/workflows/unit.test.yml
secrets: inherit
with:
node_version: ${{ inputs.node_version }}
build_cache_key: ${{ inputs.build_cache_key }}

coverage:
needs: [unittest]
uses: ./.github/workflows/coverage.yml
secrets: inherit

package:
needs: [compile]
uses: ./.github/workflows/package.yml
with:
node_version: ${{ inputs.node_version }}
build_cache_key: ${{ inputs.build_cache_key }}
build_artifact_folder: 'output'
build_artifact_name: 'dist'

deploy:
needs: [package, coverage]
uses: ./.github/workflows/deploy.yml
with:
build_cache_key: ${{ inputs.build_cache_key }}
build_artifact_name: ${{ needs.package.outputs.build_artifact_name }}
build_artifact_folder: ${{ needs.package.outputs.build_artifact_folder }}
node_version: ${{ inputs.node_version }}
is_beta: ${{ inputs.is_beta }}
secrets: inherit
52 changes: 52 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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

jobs:
Compile:
runs-on: ubuntu-latest
env:
CLI_BUILD: yarn build
CLI_LINT: yarn lint
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

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

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

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

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

- name: Upload build cache
uses: actions/cache@v4
with:
path: ./*
key: ${{ inputs.build_cache_key }}
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
74 changes: 74 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Npm Deploy
on:
workflow_call:
inputs:
build_artifact_folder:
required: true
type: string
build_artifact_name:
required: true
type: string
build_cache_key:
required: true
type: string
is_beta:
required: true
type: boolean
package_manager:
required: false
type: string
default: yarn
package_visibility:
required: false
type: string
default: public
node_version:
required: true
type: string
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_PUBLISH: yarn publish --access ${{ inputs.package_visibility }} --tag ${{ inputs.is_beta && 'beta' || 'latest' }}

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

- name: Retrieve build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ inputs.build_artifact_name }}
path: ${{ inputs.build_artifact_folder }}

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

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

- name: Publish
run: ${{ env.CLI_PUBLISH }}
26 changes: 26 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Merge
on:
workflow_dispatch:
push:
branches:
- main

jobs:
dev:
uses: ./.github/workflows/build.test.package.deploy.yml
secrets: inherit
with:
node_version: '20'
build_cache_key: build-cache-${{ github.sha }}
is_beta: true
node_env: 'development'

prod:
needs: [dev]
uses: ./.github/workflows/build.test.package.deploy.yml
secrets: inherit
with:
node_version: '20'
build_cache_key: build-cache-${{ github.sha }}
is_beta: false
node_env: 'production'
Loading
Loading