From 8855f61234f02cbc4547681fc66ddf0bad670f2b Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 17 May 2023 09:33:50 +0200 Subject: [PATCH 1/5] Reformat commands in contributor guide The commands were prefixed by "#", evidently to indicate a command prompt. But that is the shell comment syntax, so it is very unintuitive. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c52b5b..da61ce6 100644 --- a/README.md +++ b/README.md @@ -77,14 +77,14 @@ The action accepts some properties: To work on the codebase you have to install all the dependencies: -```sh -# npm install +``` +npm install ``` To run tests: -```sh -# npm run test +``` +npm run test ``` See the [official Github documentation][pat-docs] to know more about Personal Access Tokens. From 6ecbca8d5cab382e855410b9d6e55c9f4167c4de Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 17 May 2023 09:38:15 +0200 Subject: [PATCH 2/5] Use ordered list for development section of contributor guide The development process for contributors follows a reasonably linear set of distinct steps, so this is an appropriate way of organizing the information. --- README.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index da61ce6..25fb02d 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,18 @@ The action accepts some properties: case-insensitive-regex: true ``` -## Development +## Development workflow + +### 1. Install tools + +#### Node.js + +[**npm**](https://www.npmjs.com/) is used for dependency management. + +Follow the installation instructions here:
+https://nodejs.dev/download + +### 2. Install dependencies To work on the codebase you have to install all the dependencies: @@ -81,6 +92,22 @@ To work on the codebase you have to install all the dependencies: npm install ``` +### 3. Coding + +Now you're ready to work some [TypeScript](https://www.typescriptlang.org/) magic! + +Make sure to write or update tests for your work when appropriate. + +### 4. Format code + +Format the code to follow the standard style for the project: + +``` +npm run format +``` + +### 5. Run tests + To run tests: ``` @@ -89,7 +116,13 @@ npm run test See the [official Github documentation][pat-docs] to know more about Personal Access Tokens. -## Release +### 6. Commit + +Everything is now ready to make your contribution to the project, so commit it to the repository and submit a pull request. + +Thanks! + +## Release workflow 1. `npm install` to add all the dependencies, included development. 2. `npm run build` to build the Action under the `./lib` folder. From 51174a50dd0d0a21da1636d2e7d5acaf68ba69d5 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 17 May 2023 09:41:08 +0200 Subject: [PATCH 3/5] Change development policy to repackaging on every code change The previous development policy was to only repackage on each release. This prevented contributors from doing casual beta testing by simply referencing the action as `arduino/arduino-lint-action@main` in a workflow. --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 25fb02d..fefc081 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,16 @@ npm run test See the [official Github documentation][pat-docs] to know more about Personal Access Tokens. -### 6. Commit +### 6. Build + +It is necessary to compile the code before it can be used by GitHub Actions. Remember to run these commands before committing any code changes: + +``` +npm run build +npm run pack +``` + +### 7. Commit Everything is now ready to make your contribution to the project, so commit it to the repository and submit a pull request. @@ -124,12 +133,11 @@ Thanks! ## Release workflow -1. `npm install` to add all the dependencies, included development. -2. `npm run build` to build the Action under the `./lib` folder. -3. `npm run test` to see everything works as expected. -4. `npm run pack` to package for distribution -5. `git add src dist` to check in the code that matters. -6. open a PR and request a review. +Instructions for releasing a new version of the action: + +1. If the release will increment the major version, update the action refs in the examples in `README.md` (e.g., `uses: arduino/arduino-lint-action@v1` -> `uses: arduino/arduino-lint-action@v2`). +1. Create a [GitHub release](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release), following the `vX.Y.Z` tag name convention. Make sure to follow [the SemVer specification](https://semver.org/). +1. Rebase the release branch for that major version (e.g., `v1` branch for the `v1.x.x` tags) on the tag. If no branch exists for the release's major version, create one. [pat-docs]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token From c130260038b11246ed163807449ca04db5e62077 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 17 May 2023 09:46:58 +0200 Subject: [PATCH 4/5] Add CI workflow to check project packaging is up to date On every push and pull request that affects relevant files, check to make sure the ncc packaging is up to date. --- .../check-packaging-ncc-typescript-npm.yml | 51 +++++++++++++++++++ README.md | 1 + 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/check-packaging-ncc-typescript-npm.yml diff --git a/.github/workflows/check-packaging-ncc-typescript-npm.yml b/.github/workflows/check-packaging-ncc-typescript-npm.yml new file mode 100644 index 0000000..3e0f64a --- /dev/null +++ b/.github/workflows/check-packaging-ncc-typescript-npm.yml @@ -0,0 +1,51 @@ +name: Check Packaging + +env: + # See: https://github.com/actions/setup-node/#readme + NODE_VERSION: 16.x + +on: + push: + paths: + - ".github/workflows/check-packaging-ncc-typescript-npm.yml" + - "lerna.json" + - "package.json" + - "package-lock.json" + - "tsconfig.json" + - "**.[jt]sx?" + pull_request: + paths: + - ".github/workflows/check-packaging-ncc-typescript-npm.yml" + - "lerna.json" + - "package.json" + - "package-lock.json" + - "tsconfig.json" + - "**.[jt]sx?" + workflow_dispatch: + repository_dispatch: + +jobs: + check-packaging: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install dependencies + run: npm install + + - name: Build project + run: | + npm run-script build + npm run-script pack + + - name: Check packaging + # Ignoring CR because ncc's output has a mixture of line endings, while the repository should only contain + # Unix-style EOL. + run: git diff --ignore-cr-at-eol --color --exit-code dist diff --git a/README.md b/README.md index fefc081..079c9d8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Create Changelog [![Actions Status](https://github.com/arduino/create-changelog/workflows/Test%20Action/badge.svg)](https://github.com/arduino/create-changelog/actions) +[![Check Packaging status](https://github.com/arduino/create-changelog/actions/workflows/check-packaging-ncc-typescript-npm.yml/badge.svg)](https://github.com/arduino/create-changelog/actions/workflows/check-packaging-ncc-typescript-npm.yml) This actions is an highly opinionated tool that creates changelogs from the git repository commit history. From 7c15626d4d4b51b81c825f0891994b20aa74cef5 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 17 May 2023 10:06:51 +0200 Subject: [PATCH 5/5] Add CI workflow to run integration tests On every push and pull request that affects relevant files, run the integration tests. --- .github/workflows/test-integration.yml | 46 ++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/test-integration.yml diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml new file mode 100644 index 0000000..8e71245 --- /dev/null +++ b/.github/workflows/test-integration.yml @@ -0,0 +1,46 @@ +name: Integration Tests + +on: + pull_request: + push: + schedule: # Scheduled trigger checks for breakage caused by changes to create-changelog + # run every Tuesday at 3 AM UTC + - cron: "0 3 * * 2" + # workflow_dispatch event allows the workflow to be triggered manually + # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + # repository_dispatch event allows the workflow to be triggered via the GitHub API + # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch + repository_dispatch: + +jobs: + defaults: + runs-on: ubuntu-latest + + steps: + - name: Checkout local repository + uses: actions/checkout@v3 + + # Run the action using default values as much as possible. + - name: Run action + uses: ./ # Use the action from the local path. + + expected-pass: + runs-on: ubuntu-latest + + env: + CHANGELOG_FILE_PATH: /tmp/CHANGELOG.md + steps: + - name: Checkout local repository + uses: actions/checkout@v3 + + - name: Run action + uses: ./ + with: + tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+.*$' + case-insensitive-regex: true + changelog-file-path: "${{ env.CHANGELOG_FILE_PATH }}" + + - name: Verify report file exists + run: | + [ -e "${{ env.CHANGELOG_FILE_PATH }}" ] diff --git a/README.md b/README.md index 079c9d8..6b93bd2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Actions Status](https://github.com/arduino/create-changelog/workflows/Test%20Action/badge.svg)](https://github.com/arduino/create-changelog/actions) [![Check Packaging status](https://github.com/arduino/create-changelog/actions/workflows/check-packaging-ncc-typescript-npm.yml/badge.svg)](https://github.com/arduino/create-changelog/actions/workflows/check-packaging-ncc-typescript-npm.yml) +[![Integration Tests status](https://github.com/arduino/create-changelog/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/create-changelog/actions/workflows/test-integration.yml) This actions is an highly opinionated tool that creates changelogs from the git repository commit history.