Skip to content

Commit

Permalink
Make parse-tool-versions available to the world
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Nov 27, 2022
0 parents commit 0340ae5
Show file tree
Hide file tree
Showing 21 changed files with 6,397 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
parserOptions:
ecmaVersion: 2015
sourceType: module
rules:
no-trailing-spaces: error
camelcase: error
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Report a bug found in this project
labels: bug

---

# The bug

A clear and concise description of what the bug is.

## Software versions

A list of software versions where the bug is apparent, as detailed as possible:

- `parse-tool-versions`: ...
-
- [ ] MacOS: ...
-
- [ ] Ubuntu: ...
-
- [ ] Windows: ...
- other (where applicable): ...

## How to replicate

An ordered list of steps to replicate the bug, or (preferably) a public GitHub repository where the
bug is visible.

## Expected behaviour

What's expected to happen when you follow the steps listed above.

## Additional context

Any other context about the bug.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Request a feature for this project
labels: enhancement

---

# The feature

A clear and concise description of what's missing, e.g. "I'm always frustrated when ..."

## Describe the feature you'd like

A clear and concise description of what you want to happen after the new feature is implemented.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional context

Any other context about the feature request.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Lint

"on": push

jobs:
build:
name: Lint

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Create dist
run: |
npm install
npm run dist
- name: Check if build left artifacts
run: git diff --exit-code
48 changes: 48 additions & 0 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: MacOS CI

"on": push

jobs:
macos-ci:
name: MacOS CI

runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- id: tool-versions
name: Parse .tool-versions
uses: ./

- name: Test for bash
shell: bash
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
- name: Test for pwsh
shell: pwsh
run: |
$Env:RUBY="${{steps.tool-versions.outputs.ruby}}"
$Env:NPM="${{steps.tool-versions.outputs.npm}}"
$Env:PYTHON="${{steps.tool-versions.outputs.python}}"
Test-Path $Env:RUBY
Test-Path $Env:NPM
Test-Path $Env:PYTHON
- name: Test for sh
shell: sh
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
48 changes: 48 additions & 0 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Ubuntu CI

"on": push

jobs:
ubuntu-ci:
name: Ubuntu CI

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- id: tool-versions
name: Parse .tool-versions
uses: ./

- name: Test for bash
shell: bash
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
- name: Test for pwsh
shell: pwsh
run: |
$Env:RUBY="${{steps.tool-versions.outputs.ruby}}"
$Env:NPM="${{steps.tool-versions.outputs.npm}}"
$Env:PYTHON="${{steps.tool-versions.outputs.python}}"
Test-Path $Env:RUBY
Test-Path $Env:NPM
Test-Path $Env:PYTHON
- name: Test for sh
shell: sh
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
68 changes: 68 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: Windows CI

"on": push

jobs:
windows-ci:
name: Windows CI

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- id: tool-versions
name: Parse .tool-versions
uses: ./

- name: Test for bash
shell: bash
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
- name: Test for pwsh
shell: pwsh
run: |
$Env:RUBY="${{steps.tool-versions.outputs.ruby}}"
$Env:NPM="${{steps.tool-versions.outputs.npm}}"
$Env:PYTHON="${{steps.tool-versions.outputs.python}}"
Test-Path $Env:RUBY
Test-Path $Env:NPM
Test-Path $Env:PYTHON
- name: Test for sh
shell: sh
run: |
RUBY=${{steps.tool-versions.outputs.ruby}}
NPM=${{steps.tool-versions.outputs.npm}}
PYTHON=${{steps.tool-versions.outputs.python}}
echo "${RUBY?output not set}"
echo "${NPM?output not set}"
echo "${PYTHON?output not set}"
- name: Test for cmd
shell: cmd
run: |
set RUBY=${{steps.tool-versions.outputs.ruby}}
set NPM=${{steps.tool-versions.outputs.npm}}
set PYTHON=${{steps.tool-versions.outputs.python}}
if "%RUBY%" == "" exit 1
if "%NPM%" == "" exit 1
if "%PYTHON%" == "" exit 1
- name: Test for powershell
shell: powershell
run: |
$Env:RUBY="${{steps.tool-versions.outputs.ruby}}"
$Env:NPM="${{steps.tool-versions.outputs.npm}}"
$Env:PYTHON="${{steps.tool-versions.outputs.python}}"
Test-Path $Env:RUBY
Test-Path $Env:NPM
Test-Path $Env:PYTHON
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
4 changes: 4 additions & 0 deletions .markdownlint-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
default: true
MD013:
line_length: 100
3 changes: 3 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
printWidth: 100
singleQuote: true
5 changes: 5 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Example .tool-versions file, as used by CI (and the README)
ruby 2.5.3 # This is a comment
# This is another comment
npm 8.3.1
python 3.7.2 2.7.15 system # Only 3.7.2 used
5 changes: 5 additions & 0 deletions .yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
extends: default
rules:
line-length:
max: 100
87 changes: 87 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# CONTRIBUTING

## License

`parse-tool-versions` is licensed under [The MIT License](LICENSE.md), for all code.

## Reporting a bug

The easiest way to contribute to the project is to report bugs via
[GitHub issues: bug report](https://github.com/paulo-ferraz-oliveira/parse-tool-versions/issues/new?template=bug_report.md).

Some contributors and maintainers may be unpaid developers working on this project, in their own
time, with limited resources. We ask for respect and understanding, and we will provide the same back.

If your contribution is an actual bug fix, we ask you to include/update tests that, not only show
the issue is solved, but help prevent future regressions related to it.

## Requesting or implementing a feature

Before requesting or implementing a new feature, do the following:

- search, in existing [issues](https://github.com/paulo-ferraz-oliveira/parse-tool-versions/issues)
(open or closed), whether the feature might already be in the works, or has already been rejected,
- make sure you're using the latest software release (or even the latest code, if you're going for
_bleeding edge_).

If this is done, open up a
[GitHub issues: feature request](https://github.com/paulo-ferraz-oliveira/parse-tool-versions/issues/new?template=feature_request.md).

We may discuss details with you regarding the implementation, and its inclusion within the project.

We try to have as many of project's features tested as possible. Everything that a user can do,
and is repeatable in any way, should be tested, to guarantee backward compatibility.

## Setting up your environment

The only tool that should be required to submit changes to the project is Node.js.
After you have that installed, and you've cloned the repository locally you should `npm install`
from the root folder of the project. This will install all software (inside `node_modules`)
required for updating the code, testing it, and making sure building a pre- pull request package
is possible.

When your changes are finished execute `npm run dist` and this should do all local checks and
present a message like "Ready for submission!" at the end, for your convenience.

## Submitting your changes

### Code Style

We have formatting set in place for the JavaScript sources, via `npm run prettier`.

As the code will be put under CI, whenever a pull request is submitted, you'll be asked to solve all
issues before we consider the submission for merging to the main branch.

Also, as a general rule, the following applies:

- write small functions, whenever possible,
- use descriptive names for functions and variables
- comment tricky or non-obvious decisions made to explain their rationale

### Committing your changes

Merging to the main branch will usually be preceded by a squash.

While it's Ok (and expected) your commit messages relate to why a given change was made, be aware
that the final commit (the merge one) will be the issue title, so it's important it is as specific
as possible. This will also help eventual automated changelog generation.

**Note**: `npm run dist` will change the contents of the `dist/**` folder/files. You need not
change these by hand (they're just the mechanism we're using to have all of the action in a single
file). In any case, our CI should be comparing the results of executing `npm run dist` and
potential leftover artifacts, to make sure everything's pushed properly.

### Reviewing

It is possible, during the process of reviewing your changes, that a reviewer asks for changes via
a conversation. Do not resolve the conversation even if you think your changes address the
request: the reviewer will do this. We believe this eases the review process.

As a bonus, if you do not squash your changes, force-push, and/or add a comment with a specific
commit link to a requested change that is also very helpful for reviewers and will speed up the
process.

### Credits

`parse-tool-versions` has been improved by
[many contributors](https://github.com/paulo-ferraz-oliveira/parse-tool-versions/graphs/contributors)!
18 changes: 18 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# LICENSE

Copyright 2022 Paulo F. Oliveira

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 0340ae5

Please sign in to comment.