Skip to content

Commit

Permalink
feat: initial commit (#1)
Browse files Browse the repository at this point in the history
* feat: init from template

* feat: initial
  • Loading branch information
ovsds authored Jul 19, 2024
1 parent ab07de7 commit c039c53
Show file tree
Hide file tree
Showing 18 changed files with 2,620 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.sh]
indent_size = 4
35 changes: 35 additions & 0 deletions .github/actions/assert_equals/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: AssertEquals
description: Asserts that actual value equals expected value

inputs:
actual:
description: "Value to assert"
required: true

expected:
description: "Expected value"
required: true

message:
description: "Message to display if assertion fails"
required: false
default: "Assertion failed"

runs:
using: "composite"
steps:
- name: Assert
id: assert
shell: bash
run: |
actual="${{ inputs.actual }}"
expected="${{ inputs.expected }}"
message="${{ inputs.message }}"
if [[ "$actual" != "$expected" ]]; then
echo "$message. Expected: $expected, Actual: $actual"
exit 1
fi
branding:
icon: "check-circle"
color: "green"
16 changes: 16 additions & 0 deletions .github/actions/setup_environment/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Setup Environment"
description: "Setting environment for the project"

inputs:
task-version:
description: "Task version"
required: true
default: "3.33.1"

runs:
using: "composite"
steps:
- name: Install Task
uses: arduino/setup-task@v1
with:
version: ${{ inputs.task-version }}
30 changes: 30 additions & 0 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check PR

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
check-pr:
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup_environment

- name: Install Dependencies
run: |
task ci-init
- name: Lint PR
run: |
task lint
185 changes: 185 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: E2E

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
e2e-default:
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Test Run
id: test-run
uses: ./
with:
owner: ovsds
repo: push-version-tags-action
tag_name: v1.0.0

- name: Assert exists
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.exists }}
expected: "true"

- name: Assert tag name
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_name }}
expected: "v1.0.0"

- name: Assert tag sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_sha }}
expected: "29ae696c9f5bdb8d25dc5dbfd3a88acb2af001f3"

- name: Assert tag type
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_type }}
expected: "commit"

- name: Assert commit sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.commit_sha }}
expected: "29ae696c9f5bdb8d25dc5dbfd3a88acb2af001f3"

- name: Assert tag message
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_message }}
expected: "feat: init (#1)"

- name: Assert verified
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.verified }}
expected: "true"

e2e-unverified-commit-type:
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Test Run
id: test-run
uses: ./
with:
tag_name: unverified_tag

- name: Assert exists
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.exists }}
expected: "true"

- name: Assert tag name
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_name }}
expected: "unverified_tag"

- name: Assert tag sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_sha }}
expected: "518c2e81cd748430d589f760efa3b0847d1e1c3d"

- name: Assert tag type
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_type }}
expected: "commit"

- name: Assert commit sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.commit_sha }}
expected: "518c2e81cd748430d589f760efa3b0847d1e1c3d"

- name: Assert tag message
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_message }}
expected: "unverified_commit"

- name: Assert verified
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.verified }}
expected: "false"

e2e-not-exists:
runs-on: ubuntu-20.04

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Test Run
id: test-run
uses: ./
with:
tag_name: definitely-not-a-tag

- name: Assert exists
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.exists }}
expected: "false"

- name: Assert tag name
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_name }}
expected: ""

- name: Assert tag sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_sha }}
expected: ""

- name: Assert tag type
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_type }}
expected: ""

- name: Assert commit sha
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.commit_sha }}
expected: ""

- name: Assert tag message
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.tag_message }}
expected: ""

- name: Assert verified
uses: ./.github/actions/assert_equals
with:
actual: ${{ steps.test-run.outputs.verified }}
expected: ""
18 changes: 18 additions & 0 deletions .github/workflows/push-version-tags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Push version tags

on:
release:
types: [published]

jobs:
push-version-tags:
runs-on: ubuntu-20.04

permissions:
contents: write

steps:
- name: Push Version Tags
uses: ovsds/push-version-tags-action@v1
with:
version: ${{ github.event.release.tag_name }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# OS
.DS_Store

# IDE
.idea/
.vscode/

# Dependencies
node_modules/
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fund=false
audit=false
save-exact=true
unsafe-perm=true
engine-strict=true
update-notifier=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v21.5.0
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) 2024 Dmitry Ovsiannikov

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 c039c53

Please sign in to comment.