Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0d7d750

Browse files
committedNov 19, 2024·
brand new testing action
1 parent 8605b6f commit 0d7d750

File tree

18 files changed

+500
-21
lines changed

18 files changed

+500
-21
lines changed
 

‎.github/workflows/testing_action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313

1414
- name: Using the testing action
15-
uses: ./testing_action
15+
uses: ./test_action
1616
id: action
1717
with:
1818
test_name: TEST NAME

‎pyaction/action_template/{{action_slug}}/Dockerfile.jinja

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY . .
1717
RUN [ -f /action/pre-script.sh ] && sh /action/pre-script.sh || true
1818

1919
# Install project dependencies first for better caching
20-
RUN uv sync --frozen --no-cache
20+
RUN uv sync --no-cache
2121

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

‎testing_action/.dockerignore ‎test_action/.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ CONTRIBUTING.md
2121
CHANGELOG.md
2222
LICENSE
2323
Dockerfile
24-
Makefile
24+
Makefile
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Testing
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
Test:
10+
runs-on: ubuntu-latest
11+
name: Testing the action
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Running the action
17+
uses: ./

‎test_action/.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
7+
__pypackages__/
8+
9+
# Environments
10+
.env
11+
.venv
12+
env/
13+
venv/
14+
ENV/
15+
env.bak/
16+
venv.bak/

‎test_action/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Setting the base-image
2+
FROM python:3.12-slim
3+
4+
# Copy only the necessary binaries from uv
5+
COPY --from=ghcr.io/astral-sh/uv:0.5.1 /uv /uvx /bin/
6+
7+
# Set environment variable early to take advantage of layer caching
8+
ENV UV_PROJECT_ENVIRONMENT="/usr/local/"
9+
10+
# Set the working directory to /action
11+
WORKDIR /action
12+
13+
# Importing the action
14+
COPY . .
15+
16+
# Running the pre-script.sh
17+
RUN [ -f pre-script.sh ] && sh pre-script.sh || true
18+
19+
# Install project dependencies first for better caching
20+
RUN uv sync
21+
22+
# Running the post-script.sh
23+
RUN [ -f post-script.sh ] && sh post-script.sh || true
24+
25+
# Specify the command to run main.py with uv
26+
CMD [ "uv", "run", "/action/main.py" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎testing_action/main.py ‎test_action/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
workflow = PyAction()
88

99

10-
@workflow.action()
10+
@workflow.action
1111
def testing_action(test_name: str, test_age: int) -> None:
1212
annotations.warning("This is a warning annotation!")
1313
annotations.notice("This is a notice annotation!")

‎test_action/post-script.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "this is a post script running"

‎test_action/pre-script.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
echo "this is a pre script running (installing git)"
2+
3+
apt update
4+
apt install -y git

‎test_action/pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "test-action"
3+
version = "0.0.1"
4+
description = "An action for testing the latest changes of PyAction's main branch"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = ["pyaction @ git+https://github.com/lnxpy/pyaction#main"]
8+
9+
[project.optional-dependencies]
10+
dev = ["pyaction[cli] @ git+https://github.com/lnxpy/pyaction#main"]

‎test_action/uv.lock

+422
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎testing_action/Dockerfile

-14
This file was deleted.

‎testing_action/requirements.txt

-1
This file was deleted.

‎testing_action/script.sh

-2
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.