Skip to content

Commit

Permalink
test_action CI created
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxpy committed May 15, 2024
1 parent 006a72c commit 58dbeb8
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/testing_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Testing Action

on:
push:
branches: [main]

jobs:
Testing:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Using the testing action
uses: ./testing_action
id: action

- name: Show message
run: echo ${{ steps.action.outputs.message }}
24 changes: 24 additions & 0 deletions testing_action/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Ignore all files and folders that start with a dot.
.*

# Ignore all virtual envs'
venv/

# Ignore all Python bytecode files.
__pycache__/

# Ignore all temporary files.
*.tmp
*.swp

# Ignore all build artifacts.
build/
dist/

# Ignore all pyaction-related files.
README.md
CONTRIBUTING.md
CHANGELOG.md
LICENSE
Dockerfile
Makefile
14 changes: 14 additions & 0 deletions testing_action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# setting the base-image
FROM python:3-slim

# importing the action
COPY . /action

# running the script.sh
RUN [ -f /action/script.sh ] && sh /action/script.sh || true

# installing the requirements
RUN pip install -U pip -r /action/requirements.txt

# running the main.py file
CMD [ "python", "/action/main.py" ]
1 change: 1 addition & 0 deletions testing_action/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This action gets triggered when a push happens to `pyaction@main`. The aim of this action is to ensure that PyAction is safely usable in practice.
34 changes: 34 additions & 0 deletions testing_action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Testing Action
description: Example testing PyAction action
author: Sadra Yahyapour

branding:
icon: check
color: blue

runs:
using: docker
image: Dockerfile

inputs:
github_token:
description: The GitHub auth token
default: ${{ github.token }}
required: true

repository:
description: The repository name in the form of "<owner>/<repo>"
default: ${{ github.repository }}
required: true

test_name:
description: Testing name
required: true

test_age:
description: Testing age
required: true

outputs:
message:
description: Testing message
12 changes: 12 additions & 0 deletions testing_action/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pyaction import PyAction

workflow = PyAction()


@workflow.action()
def testing_action(sample_name: str, sample_age: int) -> None:
workflow.write(
{
"message": f"{sample_name=} | {sample_age=}",
}
)
1 change: 1 addition & 0 deletions testing_action/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyaction @ git+https://github.com/lnxpy/pyaction@main
2 changes: 2 additions & 0 deletions testing_action/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apt update
apt install -y git

0 comments on commit 58dbeb8

Please sign in to comment.