gm3dmo/the-power
Sobre
The Power exists because documentation without examples is just an API reference, and it's been the industry's biggest productivity killer for decades.
Produtividade e automaçãoCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalThe Power
Table of Contents
- What is the Power?
- Setup Instructions
- Contributing to The Power
- Known Issues/Problems/Solutions
- Testcases
- Setting up a GitHub App to use with The Power
- GitHub API Learning Resources
- Scaling to create larger environments
What is The Power?
The Power is a simple test framework for GitHub's API's. It's goal is to help you learn to interact with and understand GitHub API's by building test scenarios such as; a repository with a pull request, teams and users on a testing instance of GitHub Enterprise or GitHub.com a pre-existing Organization and Enterprise Account.
The Power can create the following on a blank appliance or organization in <=30 seconds:
- An Organization.
- Users
- A team of users.
- A private repository named testrepo with a branch called new_branch,
- Branch protection rules on branch
main. - CODEOWNERS file configured for the README.md and
.gitattributesfiles. - An Issue with the label
bug. - A pull request with a code owner requested for review. The pull request contains 2 commits against 2 files and activates the tree view.
- A manifest file for a package manager file with a vulnerability to trigger Dependabot.
- A webhook on testrepo that outputs to it's own smee.io url.
- A Release.
- GitHub Pages configured for testrepo.
- A Gist.
- Mermaid diagrams using create-commit-mermaid.sh to demonstrate the GitHub supported diagram types on the mermaid project.
There are many other features and test-cases you can use or adapt to build scenarios of your own.
[!NOTE]
The power is not intended as an example of how to write shell scripts.
The Power is a tool for learning
- Designed to be as simple as possible to understand. To keep things simple we exclusively uses only
curlandjqto complete most tasks. Only a few of the more complex scenarios have other dependencies.
The Power is vast and deep
There are hundreds of pre-baked scripts to:
- Create commits, secrets, hooks, issue comments, environments.
- Bulk up your appliance by creating hundreds or thousands of users/orgs/repos/teams/pull requests.
- Set up a Tiny GitHub App in less than 1 minute.
- Demonstrate GitHub Actions.
- Demonstrate Code scanning.
The Power is fast
You can stitch together scripts to create demos of features or rapidly test a bug or capability.
- The Base Testcase: build-testcase demo of the features of The Power's base test case
build-testcase. - Push Protection Speed Run a speed run demo of GitHub Push Protection feature.
- Secret Scanning Speed Run creates a repository, enables secret scanning, clones the repository and leaves you ready to commit secrets using build-testcase-secret-scanning.
- GitHub App Commit Signing Demo uses the run-testcase-tiny-app-commit-signing testcase to demonstrate a GitHub App.
- Build a Simple GitHub Actions Workflow uses the build-testcase-workflow-simple script to demonstrate building a GitHub Actions Workflow.
The Power is highly configurable
The configuration file .gh-api.examples.conf is the green fuse that drives The Power. The configuration file format is a simple list of key value pairs:
### [Branches](https://docs.github.com/en/rest/commits/commits)
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/
proposing-changes-to-your-work-with-pull-requests/about-branches
branch_name="new_branch"
protected_branch_name="main"
required_approving_reviewers=1
required_status_check_name="ci-test/this-check-is-required"
enforce_admins="false"
base_branch=main
The Power's configuration can be shared with other tools
The use of kv pairs in .gh-api-examples.conf provides maximum flexibility and simplicity. It allows the configuration file to provide the basic descriptors for other more advanced tools like Apache JMeter or hurl
Hurl using the .gh-api-examples.conf file
hurl-repo-characteristics.sh shows hurl provisioned with values .gh-api-examples.conf:
hurl --test --variables-file .gh-api-examples.conf --json hurl-tests/repo-characteristics.hurl | jq -r
The hurl-tests/repo-characteristics file looks like:
GET {{ GITHUB_API_BASE_URL }}/repos/{{ org }}/{{ repo }}
Accept: application/vnd.github.v3+json
Authorization: token {{ GITHUB_TOKEN }}
HTTP/2 200
[Asserts]
status >= 200
status < 300
header "Content-Type" == "application/json; charset=utf-8"
header "x-github-request-id" isString
jsonpath "$.name" == "{{ repo }}"
jsonpath "$.full_name" == "{{ org}}/{{ repo }}"
Why The Power
There are lots of great tools like JMeter for interacting with API's and building testsuites and many of the latest API's come with their own interactive documentation built-in like the swagger petstore. The Power is a solution for times and places where those tools just aren't available.
Explore projetos relacionados
Carregando…