diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 00000000..b2efc7c3 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,217 @@ +# Build details + +## Local builds + +To build locally you do need: + +once: +``` +(have at least nodejs >=12 installed) +npm install -g typescript +npm install -g vsce +npm install +```` +then +``` +vsce package +``` +and you can install your own generated package (dlt-logs-...vsix). + +## Creating a PR + +After testing your changes locally you can simply create a PR the usual github way. +Please use branch name "feature/..." or "feat/..." for features and "fix/..." for fixes. + +## CI setup + +I describe the setup here that is used to build and release versions. +The releases are generated automatically in CI. + +The following steps are done: +- enforce commit message rules to be able to + - autogenerate changelog (via semantic-release) + - automatically define the version (via semantic-release) +- on push to master branch: generate and publish a new release. + +### Commit message rules + +The [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) rules are used. + +commitlint is used: +```sh +npm install --save-dev @commitlint/{cli,config-conventional} +``` + +We use the config in the package.json (as we use git hooks ... later as well): +```json + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + } +``` + +Husky is used for easy git commit hooks on local setup: +```sh +npm install --save-dev husky +or +yarn add -D husky +``` +and activated in package.json as well: +```json +"husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + } +``` + +activated as github action (see file `.github/workflows/commitlint.yml`) +```yml +name: Lint Commit Messages +on: + push: + # release.yml workflow does it already there. + branches-ignore: + - master + - gh-pages + pull_request: +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v2 +``` + +### Semantic release + +Semantic-release is used to + - determine the next semantic version based on the commit messages and last version tag + - create/update release notes / CHANGELOG.md + - update package.json version + - create a github release tag/version + +```sh +npm install --save-dev semantic-release @semantic-release/changelog @semantic-release/git +npm install --save-dev semantic-release-vsce +``` +and configured in package.json via: +```json +"release": { + "branches": [ + "master" + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "releaseRules": [ + { + "type": "docs", + "scope": "readme", + "release": "patch" + } + ] + } + ], + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md", + "changelogTitle": "# Change log for 'DLT-Logs':" + } + ], + [ + "@semantic-release/npm", + { + "npmPublish": false + } + ], + [ + "semantic-release-vsce", + { + "packageVsix": "dlt-logs.vsix" + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "dlt-logs.vsix", + "label": "DLT-Logs Visual Studio Code extension package" + } + ] + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): ${nextRelease.version} [skip ci]" + } + ] + ], + "preset": "conventionalcommits" + } +``` + +In addition to the conventional-commits rule a commit of type ```'docs'``` and scope ```'readme'``` triggers a patch release as well. +Besides that only the default rules apply: +- breaking -> major +- revert -> patch +- feat -> minor +- fix -> patch +- perf -> patch. + +the last non automatic released version (v0.30.3) was tagged via +```sh +git tag v0.30.3 cac3d9b6b29a7d595f7388d4e14abee9c0caf7c4 +git push origin v0.30.3 +``` + +as semantic-release doesn't support major version being 0 and I didn't want to introduce an artifical breaking change I manually created a tag v1.0.0: + +```sh +git tag v1.0.0 1ab80ce0dabe121ea1acb76b473509083e3d551a +git push origin v1.0.0 +``` + +with this a manual release can be created via +```sh +VSCE_TOKEN= GH_TOKEN=... npx semantic-release --no-ci +```` + +activated as github action (see file `.github/workflows/release.yml`) +```yml +name: Semantic Release and Publish +on: + push: + branches: + - master +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Commitlint + uses: wagoid/commitlint-github-action@v2 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: Install dependencies + run: npm ci + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} + run: npx semantic-release +``` +This needs a ```VSCE_TOKEN``` secret defined in github/repo/settings/secrets. diff --git a/README.md b/README.md index 890fd255..4a55dad7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ This Visual Studio Code(tm) extension adds support to open DLT (diagnostic log a **Note:** It works well with [![Version](https://vsmarketplacebadge.apphb.com/version/mbehr1.smart-log.svg)](https://marketplace.visualstudio.com/items?itemName=mbehr1.smart-log) **smart-log** extension and supports the "time-sync" feature. (todo picture/animation...) +**Note:** It works well with [![Version](https://vsmarketplacebadge.apphb.com/version/mbehr1.fishbone.svg)](https://marketplace.visualstudio.com/items?itemName=mbehr1.fishbone) **fishbone** extension and provides a rest query and filter API that can be used for badges and "apply filter". (todo picture/animation...) + A more detailed documentation is available here: [Docs](https://mbehr1.github.io/dlt-logs/). ## Features @@ -22,8 +24,8 @@ A more detailed documentation is available here: [Docs](https://mbehr1.github.io - Lifecycles can be graphically decorated by defining *dlt-log.decorations* with id 'lifecycleEven' (for the lifecycles #0, #2,...) / 'lifecycleOdd' (for the lifecycles #1,#3,...). Default decorations contains light transparent green(dark)/gray(light) background for 'lifecycleOdd'. Only the ECU with the highest amount of messages will be decorated. - **Export/filter DLT file...** - Merge multiple DLT files into on file. - - Sort msgs within lifecycles by timestamp (**reorder msgs by calculated time?**) - - Rewrite received time with the calculated time (**rewrite msg times by calculated times?**). For more details see here (todo wiki page with background on lifecycle detection model explaining the different times (recorded time vs. timestamp vs. real time and buffering delay)). + - Sort msgs within lifecycles by timestamp (**reorder msgs by calculated time? option**) + - Rewrite received time with the calculated time (**rewrite msg times by calculated times? option**). For more details see [Docs/Export and filter DLT files](https://mbehr1.github.io/dlt-logs/docs/exportAndFilter). - Allows to export selected lifecycles only. - Allows to export by time range. @@ -73,7 +75,7 @@ The extension uses telemetry with two events (`activate` (no parameters) and `op - Add button to edit configs. - Allow filter add/edit for report, timesync, MSTP and log levels (currently only possible via JSON configuration) -- Check whether revaling the line on broadcasted time is possible if document is hidden/not visible. +- Check whether revealing the line on broadcasted time is possible if document is hidden/not visible. - Support easier splitting of huge files into files per lifecycle. Currently only possible to restrict to lifecycles via Export/filter... - Allow merging/opening of multiple DLT files. Currently only possible via Export/filter ... - Check default colors on multiple color themes. Check color contrast to background. @@ -162,6 +164,8 @@ Open an [issue](https://github.com/mbehr1/dlt-logs/issues) or create a pull requ [![Donations](https://www.paypalobjects.com/en_US/DK/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2ZNMJP5P43QQN&source=url) Donations are welcome! (Contact me for commercial use or different [license](https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode)). +[GitHub ♥︎ Sponsors are welcome!](https://github.com/sponsors/mbehr1) + ## Release Notes See [Changelog](./CHANGELOG.md)