Skip to content

Commit

Permalink
Merge pull request #1 from madhead/feature/intellij-http-client-action
Browse files Browse the repository at this point in the history
Implement `intellij-http-client-action`
  • Loading branch information
madhead authored Dec 22, 2022
2 parents 502d677 + 2a46bb0 commit b9cc6e4
Show file tree
Hide file tree
Showing 20 changed files with 492 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

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

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers 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, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at siarhei.krukau@gmail.com.
All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
63 changes: 63 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Contributing to this repository

## Getting started

Before you begin:

- This project is powered by [Docker](https://www.docker.com) and [Bash](https://www.gnu.org/software/bash).
- Have you read the [code of conduct](CODE_OF_CONDUCT.md)?
- Check out the [existing issues](https://github.com/madhead/intellij-http-client-action/issues).

Don't see your issue?
[Open](https://github.com/madhead/intellij-http-client-action/issues/new) one.

## Ready to make a change?

Fork the repo.

### Fork using GitHub Desktop

- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!

### Fork using the command line

- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.

### Fork with [GitHub Codespaces](https://github.com/features/codespaces)

- [Fork, edit, and preview](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace) using [GitHub Codespaces](https://github.com/features/codespaces) without having to install and run the project locally.

## Make your update

Make your changes to the file(s) you'd like to update.

Touching the code?
Make sure to add some tests demonstrating the use cases or solved issues.

## Open a pull request

When you're done making changes and you'd like to propose them for review, open your PR (pull request).

You can use the GitHub user interface :pencil2: for small changes, like fixing a typo or updating a README.
You can also fork the repo and then clone it locally, to view changes and run your tests on your machine.

## Submit your PR & get it reviewed

- Once you submit your PR, it will be reviewed.
- After that, there may be questions, check back on your PR to keep up with the conversation.
- Did you have an issue, like a merge conflict?
Check out this [git tutorial](https://lab.github.com/githubtraining/managing-merge-conflicts) on how to resolve merge conflicts and other issues.

## Your PR is merged

Congratulations!

## Issue labels

Labels can help you find an issue you'd like to help with.

- The [`help wanted` label](https://github.com/madhead/intellij-http-client-action/labels/help%20wanted) is for problems or updates that anyone in the community can start working on.
- The [`good first issue` label](https://github.com/madhead/intellij-http-client-action/labels/good%20first%20issue) is for problems or updates we think are ideal for beginners.
- The [`ci` label](https://github.com/madhead/intellij-http-client-action/labels/CI%2FCD) is for problems or updates in the testing, releasing & publishing process.
These will usually require some knowledge of Jest, TypeScript, Node.js, NPM or Github Actions to fix.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github:
- madhead
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- madhead
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
assignees:
- madhead
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Test

on:
push:

jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
# httpbin.org is not highly available, so we use a local instance instead.
# This clause will set up one, available via Docker networking at 'http://httpbin:80'.
# Thus, all the tests below must set 'insecure' to 'true' to be able to use the 'http' protocol.
httpbin:
image: kennethreitz/httpbin
steps:
- uses: actions/checkout@v3

- name: Smoke test
uses: ./
with:
files: |-
tests/smoke test.http
insecure: true

- name: Test multuple input files
uses: ./
with:
files: |-
./tests/smoke test.http
./tests/404.http
insecure: true

- name: Test environment file
uses: ./
with:
files: |-
./tests/environment file.http
env: test
env_file: ./tests/http.env.json
insecure: true

- name: Test private environment file
uses: ./
with:
files: |-
./tests/private environment file.http
env: test
env_file: ./tests/http.env.json
private_env_file: ./tests/http.private.env.json
insecure: true

- name: Test environment variables
uses: ./
with:
files: |-
./tests/environment variables.http
env_variables: |-
host=httpbin
insecure: true

- name: Test private environment variables
uses: ./
with:
files: |-
./tests/private environment variables.http
env_variables: |-
host=httpbin
private_env_variables: |-
path=200
insecure: true

- name: Test multiple environment variables
uses: ./
with:
files: |-
./tests/private environment variables.http
env_variables: |-
host=httpbin
path=200
insecure: true

- name: Test multiple private environment variables
uses: ./
with:
files: |-
./tests/private environment variables.http
private_env_variables: |-
host=httpbin
path=200
insecure: true

- name: Test report generation
uses: ./
with:
files: |-
tests/smoke test.http
report: true
insecure: true
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @madhead
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM jetbrains/intellij-http-client:0.22

RUN apk add --no-cache bash

COPY intellij-http-client-action.sh /intellij-http-client-action.sh

ENTRYPOINT ["/intellij-http-client-action.sh"]
9 changes: 9 additions & 0 deletions LICENSE.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright ⓒ 2023 mailto:siarhei.krukau@gmail.com[madhead].

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.
44 changes: 44 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
= IntelliJ HTTP Client CLI GitHub Action

This is a thin GitHub Action wrapper around the https://blog.jetbrains.com/idea/2022/12/http-client-cli-run-requests-and-tests-on-ci[IntelliJ HTTP Client CLI].
It allows you to run `*.http` files in your GitHub Actions workflows.

== Usage

The action accepts the same inputs as the original CLI tool.
Refer to it's documentation for more details.
A simple way to get that documentation is to run the tool with Docker: `docker run --rm -it jetbrains/intellij-http-client:latest`.

Generally, the action is used like this 👇

[source, yaml]
----
jobs:
job:
steps:
- name: Execute HTTP requests
uses: madhead/intellij-http-client-cli-action@latest
with:
files: |-
request1.http
request2.http
env_file: environments.json
env: test
env_variables: |-
var1=value1
var2=value2
insecure: true
----

String and boolean values, like `--env` and `--insecure`, are passed as usually.

List values, like `--files` or `--env-variables`, are passed as https://yaml-multiline.info[YAML multiline strings] ⚠️

See link:.github/workflows/ci.yml[the test workflow] for a complete example.
It has https://www.jetbrains.com/help/idea/exploring-http-syntax.html#http_request_names[named tests], tests with https://www.jetbrains.com/help/idea/exploring-http-syntax.html#using_request_vars[variables & environments], tests with https://www.jetbrains.com/help/idea/exploring-http-syntax.html#response-handling[response handlers], etc.

== Issues
Do you have an issue or a question?
Do not hesitate https://github.com/madhead/intellij-http-client-action/issues/new[reporting it]!
Providing a minimal reproducible example in link:.github/workflows/ci.0yml[the test workflow] is highly appreciated 👐
41 changes: 41 additions & 0 deletions action-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
inputs:
files:
type: list
separator: ' '
list-item:
type: string

socket_timeout:
type: integer
connect_timeout:
type: integer
insecure:
type: boolean

env:
type: string
env_file:
type: string
env_variables:
type: list
separator: '\n'
list-item:
type: string
private_env_file:
type: string
private_env_variables:
type: list
separator: '\n'
list-item:
type: string

docker_mode:
type: boolean
log_level:
type: enum
allowed-values:
- BASIC
- HEADERS
- VERBOSE
report:
type: boolean
Loading

0 comments on commit b9cc6e4

Please sign in to comment.