Skip to content

Commit f9aa72c

Browse files
Merge pull request #76 from MatteoPologruto/test-typescript-task
Change development policy to continuous packaging
2 parents e64bccf + 6bcf322 commit f9aa72c

File tree

3 files changed

+147
-42
lines changed

3 files changed

+147
-42
lines changed

.github/CONTRIBUTING.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## Development workflow
2+
3+
### 1. Install tools
4+
5+
#### Node.js
6+
7+
[**npm**](https://www.npmjs.com/) is used for dependency management.
8+
9+
Follow the installation instructions here:<br />
10+
https://nodejs.dev/en/download
11+
12+
### 2. Install dependencies
13+
14+
To work on the codebase you have to install all the dependencies:
15+
16+
```
17+
npm install
18+
```
19+
20+
### 3. Coding
21+
22+
Now you're ready to work some [TypeScript](https://www.typescriptlang.org/) magic!
23+
24+
Make sure to write or update tests for your work when appropriate.
25+
26+
### 4. Format code
27+
28+
Format the code to follow the standard style for the project:
29+
30+
```
31+
npm run format
32+
```
33+
34+
### 5. Run tests
35+
36+
To run the tests:
37+
38+
```
39+
npm run test
40+
```
41+
42+
### 6. Build
43+
44+
It is necessary to compile the code before it can be used by GitHub Actions. We check in the `node_modules` to provide runtime dependencies to the system using the Action, so be careful not to `git add` all the development dependencies you might have under your local `node_modules`.
45+
Remember to run these commands before committing any code changes:
46+
47+
```
48+
npm run build
49+
```
50+
51+
remove all the dependencies:
52+
53+
```
54+
rm -rf node_modules
55+
```
56+
57+
add back **only** the runtime dependencies:
58+
59+
```
60+
npm install --production
61+
```
62+
63+
check in the code that matters:
64+
65+
```
66+
git add lib node_modules
67+
```
68+
69+
### 7. Commit
70+
71+
Everything is now ready to make your contribution to the project, so commit it to the repository and submit a pull request.
72+
73+
Thanks!
74+
75+
## Release workflow
76+
77+
To release a new version of the Action the workflow should be the following:
78+
79+
1. If the release will increment the major version, update the action refs in the examples in README.md
80+
(e.g., `uses: arduino/setup-protoc@v1` -> `uses: arduino/setup-protoc@v2`).
81+
1. open a PR and request a review.
82+
1. After PR is merged, create a release, following the `vX.X.X` tag name convention.
83+
1. After the release, rebase the release branch for that major version (e.g., `v1` branch for the v1.x.x tags) on the tag.
84+
If no branch exists for the release's major version, create one.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Check Packaging
2+
3+
env:
4+
# See: https://github.com/actions/setup-node/#readme
5+
NODE_VERSION: 16.x
6+
7+
on:
8+
push:
9+
paths:
10+
- ".github/workflows/check-packaging-ncc-typescript-npm.ya?ml"
11+
- "lerna.json"
12+
- "package.json"
13+
- "package-lock.json"
14+
- "Taskfile.ya?ml"
15+
- "tsconfig.json"
16+
- "**.[jt]sx?"
17+
pull_request:
18+
paths:
19+
- ".github/workflows/check-packaging-ncc-typescript-npm.ya?ml"
20+
- "lerna.json"
21+
- "package.json"
22+
- "package-lock.json"
23+
- "Taskfile.ya?ml"
24+
- "tsconfig.json"
25+
- "**.[jt]sx?"
26+
workflow_dispatch:
27+
repository_dispatch:
28+
29+
jobs:
30+
check-packaging:
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v3
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ env.NODE_VERSION }}
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Build project
46+
run: |
47+
npm run build
48+
49+
- name: Check packaging
50+
# Ignoring CR because ncc's output has a mixture of line endings, while the repository should only contain
51+
# Unix-style EOL.
52+
run: git diff --ignore-cr-at-eol --color --exit-code lib

README.md

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[![Check npm status](https://github.com/arduino/setup-protoc/actions/workflows/check-npm-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-npm-task.yml)
1111
[![Check TypeScript status](https://github.com/arduino/setup-protoc/actions/workflows/check-typescript-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-typescript-task.yml)
1212
[![Check tsconfig status](https://github.com/arduino/setup-protoc/actions/workflows/check-tsconfig-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-tsconfig-task.yml)
13+
[![Check Packaging status](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-npm.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-packaging-ncc-typescript-npm.yml)
1314

1415
This action makes the `protoc` compiler available to Workflows.
1516

@@ -28,7 +29,7 @@ If you want to pin a major or minor version you can use the `.x` wildcard:
2829
- name: Install Protoc
2930
uses: arduino/setup-protoc@v1
3031
with:
31-
version: '3.x'
32+
version: "3.x"
3233
```
3334

3435
You can also require to include releases marked as `pre-release` in Github using the `include-pre-releases` flag (the dafault value for this flag is `false`)
@@ -37,7 +38,7 @@ You can also require to include releases marked as `pre-release` in Github using
3738
- name: Install Protoc
3839
uses: arduino/setup-protoc@v1
3940
with:
40-
version: '3.x'
41+
version: "3.x"
4142
include-pre-releases: true
4243
```
4344

@@ -47,7 +48,7 @@ To pin the exact version:
4748
- name: Install Protoc
4849
uses: arduino/setup-protoc@v1
4950
with:
50-
version: '3.9.1'
51+
version: "3.9.1"
5152
```
5253

5354
The action queries the GitHub API to fetch releases data, to avoid rate limiting,
@@ -60,54 +61,22 @@ pass the default token with the `repo-token` variable:
6061
repo-token: ${{ secrets.GITHUB_TOKEN }}
6162
```
6263

63-
64-
## Development
65-
66-
To work on the codebase you have to install all the dependencies:
67-
68-
```sh
69-
# npm install
70-
```
71-
72-
To run the tests:
73-
74-
```sh
75-
# npm run test
76-
```
77-
7864
## Enable verbose logging for a pipeline
65+
7966
Additional log events with the prefix ::debug:: can be enabled by setting the secret `ACTIONS_STEP_DEBUG` to `true`.
8067

8168
See [step-debug-logs](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs) for reference.
8269

83-
84-
85-
## Release
86-
87-
We check in the `node_modules` to provide runtime dependencies to the system
88-
using the Action, so be careful not to `git add` all the development dependencies
89-
you might have under your local `node_modules`. To release a new version of the
90-
Action the workflow should be the following:
91-
92-
1. `npm install` to add all the dependencies, included development.
93-
1. `npm run test` to see everything works as expected.
94-
1. `npm run build` to build the Action under the `./lib` folder.
95-
1. `rm -rf node_modules` to remove all the dependencies.
96-
1. `npm install --production` to add back **only** the runtime dependencies.
97-
1. `git add lib node_modules` to check in the code that matters.
98-
1. If the release will increment the major version, update the action refs in the examples in README.md
99-
(e.g., `uses: arduino/setup-protoc@v1` -> `uses: arduino/setup-protoc@v2`).
100-
1. open a PR and request a review.
101-
1. After PR is merged, create a release, following the `vX.X.X` tag name convention.
102-
1. After the release, rebase the release branch for that major version (e.g., `v1` branch for the v1.x.x tags) on the tag.
103-
If no branch exists for the release's major version, create one.
104-
105-
106-
10770
## Security
10871

10972
If you think you found a vulnerability or other security-related bug in this project, please read our
11073
[security policy](https://github.com/arduino/setup-protoc/security/policy) and report the bug to our Security Team 🛡️
11174
Thank you!
11275

11376
e-mail contact: [email protected]
77+
78+
## Contributing
79+
80+
To report bugs or make feature requests, please submit an issue: https://github.com/arduino/setup-protoc/issues
81+
82+
Pull requests are welcome! Please see the [contribution guidelines](.github/CONTRIBUTING.md) for information.

0 commit comments

Comments
 (0)