Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
breaking: Initial implementation. (#1)
Browse files Browse the repository at this point in the history
Note:
# Initial implementation

Initial configs without too many bugs, documentation lacking. Will be added later (I promise 😇).
  • Loading branch information
rajzik authored Jun 22, 2022
1 parent bac2b0b commit 288db0e
Show file tree
Hide file tree
Showing 151 changed files with 19,737 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

[**.{js,jsx,ts,tsx,css,json,md}]
indent_style = spaces
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
15 changes: 15 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.next/
coverage/
node_modules/
public/
esm/
lib/
!src/lib
tmp/
dist/
build/
jest.config.js
babel.config.js
webpack.config.js
build*/
\.eslintrc.js
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
root: true,
extends: ['rajzik', 'rajzik/node', 'rajzik/typescript', 'rajzik/future', 'rajzik/prettier'],
env: {
node: true,
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore all differences in line endings
* -crlf
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rajzik
11 changes: 11 additions & 0 deletions .github/actions/detect-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: detect-env
description: Sets node and yarn version from nvmrc and yvmrc files.
runs:
using: 'composite'
steps:
- name: Determine Node Version
run: echo NODE_VERSION=$(cat .nvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
- name: Determine Yarn Version
run: echo YARN_VERSION=$(cat .yvmrc | tr -d '\n') >> $GITHUB_ENV
shell: bash
59 changes: 59 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommitScopeDisabled"
],
"semanticCommitType": "deps",
"prCreation": "immediate",
"github-actions": {
"fileMatch": [
"^(workflow-templates|\\.github\\/workflows)\\/[^/]+\\.ya?ml$",
"(^|\\/)action\\.ya?ml$"
],
"semanticCommitType": "ci"
},
"npm": {
"enabled": true,
"semanticCommitType": "build"
},
"semanticCommits": "enabled",
"updateLockFiles": true,
"commitMessageSuffix": ".",
"packageRules": [
{
"matchDepTypes": [
"peerDependencies"
],
"rangeStrategy": "widen",
"semanticCommitType": "deps"
},
{
"matchDepTypes": [
"packageManager"
],
"semanticCommitType": "build"
},
{
"matchDepTypes": [
"devDependencies"
],
"rangeStrategy": "bump",
"semanticCommitType": "build"
},
{
"matchDepTypes": [
"dependencies"
],
"rangeStrategy": "bump",
"semanticCommitType": "deps"
},
{
"matchDepTypes": [
"resolutions"
],
"rangeStrategy": "bump",
"semanticCommitType": "build"
}
]
}
191 changes: 191 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:

env:
CI: 1
ARTIFACT_DIR: ./artifacts

jobs:
commit-watch:
name: Run Commit Watch
runs-on: ubuntu-latest
if:
"github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip
ci]')"
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- uses: ./.github/actions/detect-env

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}

- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: |
yarn install --immutable
- name: Build
run: yarn build

- run: rm babel.config.js

- run: npx danger ci --use-github-checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: commit-watch-artifacts
path: ${{ env.ARTIFACT_DIR }}

tests:
name: Lint & Tests
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}

- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: |
yarn install --immutable
- name: Build
run: yarn build

- name: Tests
run: yarn test

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: coverage-unit-tests
path: ./raw-coverage/jest

publish_preview:
name: Publish Preview
runs-on: ubuntu-latest
needs: [tests]
if:
"github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip
ci]')"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: ./.github/actions/detect-env

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}

- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v2
with:
path: |
./.yarn
.pnp.*
key: ${{ env.NODE_VERSION }}-${{ env.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --immutable

- name: Build
run: yarn build

- name: Fix entry points
run: yarn prepack

- name: Run Monodeploy in Dry Run Mode
id: run-monodeploy
run: |
echo "<!-- MONODEPLOY:BELOW -->" > ${{ env.ARTIFACT_DIR }}/CHANGELOG.md
yarn monodeploy \
--dry-run \
--log-level 0 \
--git-base-branch origin/${{ github.base_ref }} \
--changelog-filename ${{ env.ARTIFACT_DIR }}/CHANGELOG.md \
--force-write-change-files
changelog_body=$(cat ${{ env.ARTIFACT_DIR }}/CHANGELOG.md)
changelog_body="${changelog_body//'%'/'%25'}"
changelog_body="${changelog_body//$'\n'/'%0A'}"
changelog_body="${changelog_body//$'\r'/'%0D'}"
echo ::set-output name=changelog::$changelog_body
- name: Check for Changelog Comment
uses: peter-evans/find-comment@v1
id: found-comment
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'rajzik-bot'
body-includes: <!-- CHANGELOG_PREVIEW -->

- name: Post Changelog to PR
uses: peter-evans/create-or-update-comment@v1
if: github.event_name == 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.found-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
<!-- CHANGELOG_PREVIEW -->
# Monodeploy Publish Preview
This Pull Request introduces the following changes:
${{ steps.run-monodeploy.outputs.changelog }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: ${{ env.ARTIFACT_DIR }}
Loading

0 comments on commit 288db0e

Please sign in to comment.