Skip to content

Commit

Permalink
brand new testing action
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxpy committed Nov 19, 2024
1 parent 8605b6f commit 2e22e0f
Show file tree
Hide file tree
Showing 18 changed files with 236 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4

- name: Using the testing action
uses: ./testing_action
uses: ./test_action
id: action
with:
test_name: TEST NAME
Expand Down
2 changes: 1 addition & 1 deletion pyaction/action_template/{{action_slug}}/Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY . .
RUN [ -f /action/pre-script.sh ] && sh /action/pre-script.sh || true

# Install project dependencies first for better caching
RUN uv sync --frozen --no-cache
RUN uv sync --no-cache

# running the post-script.sh
RUN [ -f /action/post-script.sh ] && sh /action/post-script.sh || true
Expand Down
2 changes: 1 addition & 1 deletion testing_action/.dockerignore → test_action/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ CONTRIBUTING.md
CHANGELOG.md
LICENSE
Dockerfile
Makefile
Makefile
17 changes: 17 additions & 0 deletions test_action/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Testing

on:
push:
branches:
- main

jobs:
Test:
runs-on: ubuntu-latest
name: Testing the action
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Running the action
uses: ./
16 changes: 16 additions & 0 deletions test_action/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
28 changes: 28 additions & 0 deletions test_action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# setting the base-image
FROM python:3.12-slim

# Copy only the necessary binaries from uv
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /uvx /bin/

# Set environment variable early to take advantage of layer caching
ENV UV_PROJECT_ENVIRONMENT="/usr/local/"

# Set the working directory to /action
WORKDIR /action

# importing the action
COPY . .

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

# Install project dependencies first for better caching
RUN uv sync --frozen --no-cache

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

RUN ls -ltrha

# Specify the command to run main.py with uv
CMD [ "python", "/action/main.py" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion testing_action/main.py → test_action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
workflow = PyAction()


@workflow.action()
@workflow.action
def testing_action(test_name: str, test_age: int) -> None:
annotations.warning("This is a warning annotation!")
annotations.notice("This is a notice annotation!")
Expand Down
1 change: 1 addition & 0 deletions test_action/post-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "this is a post script running"
4 changes: 4 additions & 0 deletions test_action/pre-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "this is a pre script running (installing git)"

apt update
apt install -y git
7 changes: 7 additions & 0 deletions test_action/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
name = "test-action"
version = "0.0.1"
description = "An action for testing the latest changes of PyAction's main branch"
readme = "README.md"
requires-python = ">=3.12"
dependencies = ["pyaction @ git+https://github.com/lnxpy/pyaction#main"]
159 changes: 159 additions & 0 deletions test_action/uv.lock

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions testing_action/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion testing_action/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions testing_action/script.sh

This file was deleted.

0 comments on commit 2e22e0f

Please sign in to comment.