Skip to content

Commit

Permalink
restructure repo and publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
angusfretwell committed Nov 13, 2024
1 parent 10a1a2e commit 42cb999
Show file tree
Hide file tree
Showing 18 changed files with 2,531 additions and 1,452 deletions.
12 changes: 8 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
steps:
- name: ":mocha: Test"
command: npm test
- name: ":vitest: Test"
command: npx vitest --run
plugins:
- docker-compose#v4.16.0:
config: test/docker-compose.yml
run: tests
run: app
- name: ":prettier: Prettier"
command: npx prettier . --check
plugins:
- docker-compose#v4.16.0:
run: app
132 changes: 132 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[[email protected]](mailto:[email protected]).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
20 changes: 11 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Contributing to the repo
# Contributing

1. Fork this repo
1. Create a feature branch with a nice name (`git checkout -b my-new-feature`)
1. Write your code!
1. Commit your changes (`git commit -am 'Add some feature'`)
- In an ideal world we have [atomic commits](https://www.pauline-vos.nl/atomic-commits/) and use [Tim Pope-style commit messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), but so long as it's clear what's happening in your PR, that's fine. We try to not be super persnickety about these things.
1. Push to your branch (`git push origin my-new-feature`)
1. Create a pull request for your branch. Make sure that your PR has a nice description, and that it's linked to any relevant issues.
1. Create a fork of this repository to commit your changes to.
1. Make your changes, and include some [tests](#Tests).
1. Create a pull request, and include a description of your changes. Ideally, include a link to the relevant documentation in the [Buildkite Pipelines docs](https://buildkite.com/docs/pipelines/configuration-overview).

Our objective is to have no PR wait more than a week for some sort of interaction from us -- this might be a review, or it might be a "I'm going to come back to this and review it a bit later". This isn't a guarantee though, and sometimes other work might get in the way of reviewing opensource contributions. If we're really dragging our feet on reviewing a PR, please feel free to ping us through GitHub or Slack, or get in touch with [email protected], and they can bug us to get things done :)
## Tests

The schema is tested by validating example schemas (see [`test/valid-pipelines`](../test/valid-pipelines/)). Please extend these or add a new one to verify your changes.

## Review

Our objective is to have no pull request wait more than a week for some sort of interaction from us — this might be a review, or it might be a "I'm going to come back to this and review it a bit later". This isn't a guarantee though, and sometimes other work might get in the way of reviewing open source contributions. If we're really dragging our feet on reviewing a PR, please feel free to ping us through GitHub or Slack, or get in touch with [email protected], and they can bug us to get things done :smile:
Binary file modified .github/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test/node_modules
node_modules
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM node:18

WORKDIR /app/test
WORKDIR /app

COPY package.json package-lock.json /app/test/
COPY package.json package-lock.json /app/
RUN npm install

COPY . /app/test
COPY . /app

CMD ["npm", "test"]
File renamed without changes.
109 changes: 91 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,107 @@
# Buildkite Pipeline JSON Schema [![Build status](https://badge.buildkite.com/67d936a0910be01a8851c5e97156d54ac4d7ee39b7900b682b.svg)](https://buildkite.com/buildkite/pipeline-schema)
# Buildkite Pipeline JSON Schema

A [JSON Schema](https://json-schema.org) for Buildkite’s [pipeline file format](https://buildkite.com/docs/pipelines/defining-steps), covering all current, documented options. Useful for linting/validating your pipeline.yml files using tools like [YAML VSCode Extension by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).
[![Build status](https://badge.buildkite.com/67d936a0910be01a8851c5e97156d54ac4d7ee39b7900b682b.svg)](https://buildkite.com/buildkite/pipeline-schema)

![Screenshot of YAML VSCode Extension by Red Hat](vscode-screenshot.png)
A [JSON Schema](https://json-schema.org) for Buildkite’s [pipeline file format](https://buildkite.com/docs/pipelines/defining-steps), covering all current, documented options.

See:
![Screenshot of YAML VSCode Extension by Red Hat](./.github/screenshot.png)

* [schema.json](schema.json)
* [test/valid-pipelines](test/valid-pipelines)
See

## Testing
- [Schema](schema.json)
- [Example valid pipelines](test/valid-pipelines)

If you have [Node 10+](https://nodejs.org/en/) installed:
## Usage

```shell
cd test
npm install && npm test
### npm package

The schema is provided as a [package on npm](https://www.npmjs.com/package/buildkite-pipeline-schema).

You can install it in your project:

```sh
npm i buildkite-json-schema
```

Or you can use [Docker Compose](https://docs.docker.com/compose/):
```js
// CommonJS
const schema = require("buildkite-pipeline-schema");

```shell
cd test
docker-compose build && docker-compose run --rm tests
// ESM
import schema from "buildkite-json-schema" assert { type: "json" };
```

Or use it with via a CDN:

```json
{
"$schema": "https://unpkg.com/buildkite-pipeline-schema@latest/schema.json"
// ...
}
```

### Editor integration

You can lint and validate your `pipeline.yml` files using an editor extension that supports [RedHat YAML Language Server](https://github.com/redhat-developer/yaml-language-server#clients).

#### VSCode

Install the [YAML VSCode Extension by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).

If the schema isn't picked up automatically, click _No JSON Schema_ in the status bar from your `pipeline.yml`, and select _Buildkite_.

### Install with npm

```sh
npm install buildkite-pipeline-schema
```

## Development

### Testing

With [Node 16+](https://nodejs.org/en/) installed,i nstall dependencies:

```sh
npm install
```

Run tests:

```sh
npm test
```

Alternatively, tests can be run with [Docker Compose](https://docs.docker.com/compose/):

```sh
docker-compose run --build --rm app
```

## Contributing

See [contributing.md](./contributing.md)
Bug reports and pull requests are welcome, see [CONTRIBUTING.md](./.github/CONTRIBUTING.md).

### Contributors

Many thanks to our fine contributors!

A full list can be found [here](https://github.com/buildkite/pipeline-schema/graphs/contributors), but you're all amazing, and we greatly appreciate your input.

## Releasing

```sh
# Version bump the code, tag and push
npm version [major/minor/patch]
git push && git push --tags

# Publish to the NPM registry
npm publish

# Create a new GitHub release
open "https://github.com/buildkite/pipeline-schema/releases"
```

## Contributors
## License

Many thanks to our fine contributors! A full list can be found [here](https://github.com/buildkite/pipeline-schema/graphs/contributors), but you're all amazing, and we greatly appreciate your input ❤️
The package is available as open source under the terms of the [MIT License](./LICENSE.md).
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: "3.6"
services:
tests:
app:
build: .
volumes:
- "../schema.json:/app/schema.json"
Loading

0 comments on commit 42cb999

Please sign in to comment.