Skip to content

Commit

Permalink
Prototype wrote
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed May 13, 2022
1 parent 0013211 commit 4501d55
Show file tree
Hide file tree
Showing 19 changed files with 3,748 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig docs: <https://editorconfig.org/>

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"env": {
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto

dist/** -diff linguist-generated=true
Makefile linguist-detectable=false
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>

version: 2

updates:
- package-ecosystem: github-actions
directory: /
schedule: {interval: monthly}

- package-ecosystem: npm
directory: /
schedule: {interval: monthly}
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: release

on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
types: [published]

jobs:
update-git-tag: # Reason: <https://github.com/actions/toolkit/blob/master/docs/action-versioning.md#recommendations>
name: Update latest major git tag
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- uses: gacts/github-slug@v1
id: slug

- name: Setup git
env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"}
run: |
git config --local user.email '[email protected]'
git config --local user.name "${{ github.actor }}"
git remote set-url origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/$REPO_PATH.git"
- name: Update major tag
env: {VERSION: "${{ steps.slug.outputs.version-major }}"}
run: |
git tag -fa "v$VERSION" -m "Update v$VERSION tag (using GitHub actions)"
git push --set-upstream origin "v$VERSION" --force
- name: Update minor tag
env: {VERSION: "${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}"}
run: |
git tag -fa "v$VERSION" -m "Update v$VERSION tag (using GitHub actions)"
git push --set-upstream origin "v$VERSION" --force
109 changes: 109 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: tests

on:
push:
branches: [master, main]
tags-ignore: ['**']
paths-ignore: ['**.md']
pull_request:
paths-ignore: ['**.md']

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 0}

- name: Check for GitLeaks
uses: gacts/gitleaks@v1 # Action page: <https://github.com/gacts/gitleaks>

eslint:
name: Run eslint
runs-on: ubuntu-20.04
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with: {node-version: '16'}

- uses: actions/cache@v3
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive

- run: yarn lint

dist-built:
name: Check distributive built state
runs-on: ubuntu-20.04
outputs:
dist-changed: ${{ steps.state.outputs.changed }}
env: {FORCE_COLOR: 'true'}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with: {node-version: '16'}

- uses: actions/cache@v3
id: yarn-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --no-progress --non-interactive

- run: yarn build

- uses: actions/upload-artifact@v3
with: {name: dist, path: ./dist/, retention-days: 1}

- id: state
run: echo "::set-output name=changed::`git diff --diff-filter=ACMUXTR --name-only | grep dist/ > /dev/null && echo 'true' || echo 'false'`"

commit-and-push-fresh-dist:
name: Commit and push fresh distributive
needs: [dist-built]
if: ${{ needs.dist-built.outputs.dist-changed == 'true' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with: {name: dist, path: ./dist/}

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automatic distributive rebuild

run-this-action: # non-existing files will not generate an error
name: Run action (${{ matrix.runs-on }}, version ${{ matrix.version }})
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
version: [1.3.0, latest]
steps:
- uses: actions/checkout@v3

- name: Run this action
uses: ./
with:
version: ${{ matrix.version }}

- run: hurl --version
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# IDEs
/.vscode
/.idea

# Vendor
/node_modules

# Environment files
*.env

# npm lock file (use yarn only)
package-lock.json

# Logs
logs
*.log
yarn-debug.log*
yarn-error.log*

# Temp dirs & trash
/temp
/tmp
.DS_Store
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].

## v1.0.0

### Added

- First action release

[keepachangelog]:https://keepachangelog.com/en/1.0.0/
[semver]:https://semver.org/spec/v2.0.0.html
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 https://github.com/gacts

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.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/make
# Makefile readme (ru): <https://blog.hook.sh/nix/makefile-full-doc/>
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>

SHELL = /bin/bash
DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"

.PHONY : help install shell lint test build
.DEFAULT_GOAL : help

help: ## Show this help
@printf "\033[33m%s:\033[0m\n" 'Available commands'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-18s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install all dependencies
docker-compose run $(DC_RUN_ARGS) node yarn install --no-progress --non-interactive

shell: ## Start shell into a container with node
docker-compose run $(DC_RUN_ARGS) node sh

lint: ## Execute provided linters
docker-compose run $(DC_RUN_ARGS) node yarn lint

build: ## Build frontend
docker-compose run $(DC_RUN_ARGS) node yarn build
85 changes: 84 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
# install-hurl
<p align="center">
<img src="https://hsto.org/webt/35/4-/o-/354-o-9pgi-abkq7d5mxu_-jxyc.png" alt="Logo" width="100" />
</p>

# Install [hurl][hurl] action

![Release version][badge_release_version]
[![Build Status][badge_build]][link_build]
[![License][badge_license]][link_license]

This action installs [hurl][hurl] as a binary file into your workflow. It can be run on **Linux** (`ubuntu-latest`), **macOS** (`macos-latest`), or **Windows** (`windows-latest`).

- 🚀 Hurl releases page: <https://github.com/Orange-OpenSource/hurl/releases>

Additionally, this action uses GitHub **caching mechanism** to speed up your workflow execution time!

## Usage

```yaml
jobs:
install-hurl:
runs-on: ubuntu-20.04
steps:
- uses: gacts/install-hurl@v1
#with:
# version: 1.2.0 # `latest` by default, but you can set a specific version to install, e.g.: `1.6.0`

- run: hurl version # any hurl command can be executed
```
## Customizing
### Inputs
Following inputs can be used as `step.with` keys:

| Name | Type | Default | Required | Description |
|----------------|:--------:|:---------------------:|:--------:|------------------------------------------------------------|
| `version` | `string` | `latest` | no | Hurl version to install |
| `github-token` | `string` | `${{ github.token }}` | no | GitHub token (for requesting the latest hurl version info) |

### Outputs

| Name | Type | Description |
|------------|:--------:|------------------------------|
| `hurl-bin` | `string` | Path to the hurl binary file |

## Releasing

New versions releasing scenario:

- Make required changes in the [changelog](CHANGELOG.md) file
- Build the action distribution (`make build` or `yarn build`)
- Commit and push changes (including `dist` directory changes - this is important) into the `master` branch
- Publish new release using repo releases page (git tag should follow `vX.Y.Z` format)

Major and minor git tags (`v1` and `v1.2` if you publish `v1.2.Z` release) will be updated automatically.

## Support

[![Issues][badge_issues]][link_issues]
[![Issues][badge_pulls]][link_pulls]

If you find any action errors, please, [make an issue][link_create_issue] in the current repository.

## License

This is open-sourced software licensed under the [MIT License][link_license].

[badge_build]:https://img.shields.io/github/workflow/status/gacts/install-hurl/tests?maxAge=30
[badge_release_version]:https://img.shields.io/github/release/gacts/install-hurl.svg?maxAge=30
[badge_license]:https://img.shields.io/github/license/gacts/install-hurl.svg?longCache=true
[badge_release_date]:https://img.shields.io/github/release-date/gacts/install-hurl.svg?maxAge=180
[badge_commits_since_release]:https://img.shields.io/github/commits-since/gacts/install-hurl/latest.svg?maxAge=45
[badge_issues]:https://img.shields.io/github/issues/gacts/install-hurl.svg?maxAge=45
[badge_pulls]:https://img.shields.io/github/issues-pr/gacts/install-hurl.svg?maxAge=45

[link_build]:https://github.com/gacts/install-hurl/actions
[link_license]:https://github.com/gacts/install-hurl/blob/master/LICENSE
[link_issues]:https://github.com/gacts/install-hurl/issues
[link_create_issue]:https://github.com/gacts/install-hurl/issues/new
[link_pulls]:https://github.com/gacts/install-hurl/pulls

[hurl]:https://hurl.dev/
24 changes: 24 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Install hurl (cross-platform)
description: Installs hurl binary file into your actions workflow

inputs:
version:
description: Hurl version
required: true
default: latest
github-token:
description: GitHub auth token. Since there's a default, this is typically not supplied by the user
required: false
default: ${{ github.token }}

outputs:
hurl-bin:
description: Path to the hurl binary file

runs:
using: node16
main: dist/index.js

branding:
icon: battery-charging
color: green
202 changes: 202 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/sourcemap-register.js

Large diffs are not rendered by default.

Loading

0 comments on commit 4501d55

Please sign in to comment.