dycw-actions 0.7.1__py3-none-any.whl → 0.8.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- actions/__init__.py +1 -1
- actions/clean_dir/lib.py +1 -0
- actions/cli.py +10 -0
- actions/constants.py +64 -1
- actions/pre_commit/conformalize_repo/action_dicts.py +247 -0
- actions/pre_commit/conformalize_repo/cli.py +14 -14
- actions/pre_commit/conformalize_repo/constants.py +2 -38
- actions/pre_commit/conformalize_repo/lib.py +317 -242
- actions/pre_commit/conformalize_repo/settings.py +37 -33
- actions/pre_commit/touch_empty_py/lib.py +9 -1
- actions/pre_commit/touch_py_typed/lib.py +9 -1
- actions/pre_commit/update_requirements/classes.py +16 -3
- actions/pre_commit/update_requirements/lib.py +15 -4
- actions/pre_commit/utilities.py +3 -4
- actions/register_gitea_runner/cli.py +32 -0
- actions/register_gitea_runner/configs/config.yml +110 -0
- actions/register_gitea_runner/configs/entrypoint.sh +23 -0
- actions/register_gitea_runner/constants.py +23 -0
- actions/register_gitea_runner/lib.py +289 -0
- actions/register_gitea_runner/settings.py +33 -0
- actions/run_hooks/lib.py +13 -4
- actions/run_hooks/settings.py +3 -0
- actions/types.py +2 -2
- {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/METADATA +4 -3
- {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/RECORD +28 -23
- actions/action_dicts/constants.py +0 -8
- actions/action_dicts/lib.py +0 -186
- /actions/{action_dicts → register_gitea_runner}/__init__.py +0 -0
- {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/WHEEL +0 -0
- {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typed_settings import load_settings, option, settings
|
|
3
|
+
from typed_settings import Secret, load_settings, option, secret, settings
|
|
4
4
|
|
|
5
5
|
from actions.pre_commit.conformalize_repo.constants import RUN_VERSION_BUMP
|
|
6
6
|
from actions.utilities import LOADER
|
|
@@ -8,47 +8,53 @@ from actions.utilities import LOADER
|
|
|
8
8
|
|
|
9
9
|
@settings
|
|
10
10
|
class Settings:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
ci__ca_certificates: bool = option(
|
|
12
|
+
default=False, help="Update CA certficates before each step"
|
|
13
|
+
)
|
|
14
|
+
ci__gitea: bool = option(default=False, help="Set up CI on Gitea")
|
|
15
|
+
ci__token: str | None = option(default=None, help="Set up CI with this token")
|
|
16
|
+
ci__pull_request__pre_commit: bool = option(
|
|
17
|
+
default=False, help="Set up CI 'pull-request.yaml' pre-commit"
|
|
17
18
|
)
|
|
18
|
-
|
|
19
|
-
default=False, help="Set up 'pull-request.yaml'
|
|
19
|
+
ci__pull_request__pyright: bool = option(
|
|
20
|
+
default=False, help="Set up CI 'pull-request.yaml' pyright"
|
|
20
21
|
)
|
|
21
|
-
|
|
22
|
-
default=False, help="Set up 'pull-request.yaml'
|
|
22
|
+
ci__pull_request__pytest__macos: bool = option(
|
|
23
|
+
default=False, help="Set up CI 'pull-request.yaml' pytest with MacOS"
|
|
23
24
|
)
|
|
24
|
-
|
|
25
|
-
default=False, help="Set up 'pull-request.yaml'
|
|
25
|
+
ci__pull_request__pytest__ubuntu: bool = option(
|
|
26
|
+
default=False, help="Set up CI 'pull-request.yaml' pytest with Ubuntu"
|
|
26
27
|
)
|
|
27
|
-
|
|
28
|
-
default=False, help="Set up 'pull-request.yaml' pytest with
|
|
28
|
+
ci__pull_request__pytest__windows: bool = option(
|
|
29
|
+
default=False, help="Set up CI 'pull-request.yaml' pytest with Windows"
|
|
29
30
|
)
|
|
30
|
-
|
|
31
|
-
default=
|
|
31
|
+
ci__pull_request__pytest__sops_age_key: str | None = option(
|
|
32
|
+
default=None,
|
|
33
|
+
help="Set up CI 'pull-request.yaml' pytest with this 'age' key for 'sops'",
|
|
32
34
|
)
|
|
33
|
-
|
|
34
|
-
default=False, help="Set up 'pull-request.yaml'
|
|
35
|
+
ci__pull_request__ruff: bool = option(
|
|
36
|
+
default=False, help="Set up CI 'pull-request.yaml' ruff"
|
|
35
37
|
)
|
|
36
|
-
|
|
37
|
-
default=False, help="Set up '
|
|
38
|
+
ci__push__publish: bool = option(
|
|
39
|
+
default=False, help="Set up CI 'push.yaml' publishing"
|
|
38
40
|
)
|
|
39
|
-
|
|
40
|
-
default=
|
|
41
|
+
ci__push__publish__username: str | None = option(
|
|
42
|
+
default=None, help="Set up CI 'push.yaml' publishing with this username"
|
|
41
43
|
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
default=False, help="Set up 'push.yaml' with the 'major' tag"
|
|
44
|
+
ci__push__publish__password: Secret[str] | None = secret(
|
|
45
|
+
default=None, help="Set up CI 'push.yaml' publishing with this password"
|
|
45
46
|
)
|
|
46
|
-
|
|
47
|
-
default=
|
|
47
|
+
ci__push__publish__publish_url: Secret[str] | None = secret(
|
|
48
|
+
default=None, help="Set up CI 'push.yaml' publishing with this URL"
|
|
48
49
|
)
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
ci__push__tag: bool = option(default=False, help="Set up CI 'push.yaml' tagging")
|
|
51
|
+
ci__push__tag__all: bool = option(
|
|
52
|
+
default=False, help="Set up CI 'push.yaml' tagging with all tags"
|
|
51
53
|
)
|
|
54
|
+
coverage: bool = option(default=False, help="Set up '.coveragerc.toml'")
|
|
55
|
+
description: str | None = option(default=None, help="Repo description")
|
|
56
|
+
envrc: bool = option(default=False, help="Set up '.envrc'")
|
|
57
|
+
envrc__uv: bool = option(default=False, help="Set up '.envrc' with uv")
|
|
52
58
|
gitignore: bool = option(default=False, help="Set up '.gitignore'")
|
|
53
59
|
package_name: str | None = option(default=None, help="Package name")
|
|
54
60
|
pre_commit__dockerfmt: bool = option(
|
|
@@ -72,9 +78,6 @@ class Settings:
|
|
|
72
78
|
pre_commit__uv: bool = option(
|
|
73
79
|
default=False, help="Set up '.pre-commit-config.yaml' uv"
|
|
74
80
|
)
|
|
75
|
-
pre_commit__uv__script: str | None = option(
|
|
76
|
-
default=None, help="Set up '.pre-commit-config.yaml' uv lock script"
|
|
77
|
-
)
|
|
78
81
|
pyproject: bool = option(default=False, help="Set up 'pyproject.toml'")
|
|
79
82
|
pyproject__project__optional_dependencies__scripts: bool = option(
|
|
80
83
|
default=False,
|
|
@@ -100,6 +103,7 @@ class Settings:
|
|
|
100
103
|
repo_name: str | None = option(default=None, help="Repo name")
|
|
101
104
|
ruff: bool = option(default=False, help="Set up 'ruff.toml'")
|
|
102
105
|
run_version_bump: bool = option(default=RUN_VERSION_BUMP, help="Run version bump")
|
|
106
|
+
uv__native_tls: bool = option(default=False, help="Setup 'uv' with native TLS")
|
|
103
107
|
script: str | None = option(
|
|
104
108
|
default=None, help="Set up a script instead of a package"
|
|
105
109
|
)
|
|
@@ -5,8 +5,11 @@ from typing import TYPE_CHECKING
|
|
|
5
5
|
|
|
6
6
|
from libcst import parse_statement
|
|
7
7
|
from utilities.text import repr_str, strip_and_dedent
|
|
8
|
+
from utilities.throttle import throttle
|
|
9
|
+
from utilities.whenever import HOUR
|
|
8
10
|
|
|
9
11
|
from actions import __version__
|
|
12
|
+
from actions.constants import PATH_THROTTLE_CACHE
|
|
10
13
|
from actions.logging import LOGGER
|
|
11
14
|
from actions.pre_commit.utilities import yield_python_file
|
|
12
15
|
|
|
@@ -17,7 +20,7 @@ if TYPE_CHECKING:
|
|
|
17
20
|
from utilities.types import PathLike
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
def
|
|
23
|
+
def _touch_empty_py(*paths: PathLike) -> None:
|
|
21
24
|
LOGGER.info(
|
|
22
25
|
strip_and_dedent("""
|
|
23
26
|
Running '%s' (version %s) with settings:
|
|
@@ -38,6 +41,11 @@ def touch_empty_py(*paths: PathLike) -> None:
|
|
|
38
41
|
sys.exit(1)
|
|
39
42
|
|
|
40
43
|
|
|
44
|
+
touch_empty_py = throttle(
|
|
45
|
+
delta=12 * HOUR, path=PATH_THROTTLE_CACHE / _touch_empty_py.__name__
|
|
46
|
+
)(_touch_empty_py)
|
|
47
|
+
|
|
48
|
+
|
|
41
49
|
def _format_path(
|
|
42
50
|
path: PathLike, /, *, modifications: MutableSet[Path] | None = None
|
|
43
51
|
) -> None:
|
|
@@ -6,8 +6,11 @@ from typing import TYPE_CHECKING
|
|
|
6
6
|
|
|
7
7
|
from utilities.iterables import one
|
|
8
8
|
from utilities.text import repr_str, strip_and_dedent
|
|
9
|
+
from utilities.throttle import throttle
|
|
10
|
+
from utilities.whenever import HOUR
|
|
9
11
|
|
|
10
12
|
from actions import __version__
|
|
13
|
+
from actions.constants import PATH_THROTTLE_CACHE
|
|
11
14
|
from actions.logging import LOGGER
|
|
12
15
|
|
|
13
16
|
if TYPE_CHECKING:
|
|
@@ -16,7 +19,7 @@ if TYPE_CHECKING:
|
|
|
16
19
|
from utilities.types import PathLike
|
|
17
20
|
|
|
18
21
|
|
|
19
|
-
def
|
|
22
|
+
def _touch_py_typed(*paths: PathLike) -> None:
|
|
20
23
|
LOGGER.info(
|
|
21
24
|
strip_and_dedent("""
|
|
22
25
|
Running '%s' (version %s) with settings:
|
|
@@ -37,6 +40,11 @@ def touch_py_typed(*paths: PathLike) -> None:
|
|
|
37
40
|
sys.exit(1)
|
|
38
41
|
|
|
39
42
|
|
|
43
|
+
touch_py_typed = throttle(
|
|
44
|
+
delta=12 * HOUR, path=PATH_THROTTLE_CACHE / _touch_py_typed.__name__
|
|
45
|
+
)(_touch_py_typed)
|
|
46
|
+
|
|
47
|
+
|
|
40
48
|
def _format_path(
|
|
41
49
|
path: PathLike, /, *, modifications: MutableSet[Path] | None = None
|
|
42
50
|
) -> None:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# ruff: noqa: TC003
|
|
1
2
|
from __future__ import annotations
|
|
2
3
|
|
|
3
4
|
import re
|
|
4
5
|
from dataclasses import dataclass, field, replace
|
|
5
6
|
from functools import total_ordering
|
|
7
|
+
from pathlib import Path
|
|
6
8
|
from typing import Any, Self, override
|
|
7
9
|
|
|
8
10
|
from pydantic import BaseModel
|
|
@@ -22,6 +24,15 @@ type Version2or3 = Version2 | Version3
|
|
|
22
24
|
type VersionSet = dict[str, Version2or3]
|
|
23
25
|
|
|
24
26
|
|
|
27
|
+
##
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class PipListOutput(BaseModel):
|
|
31
|
+
name: str
|
|
32
|
+
version: str
|
|
33
|
+
editable_project_location: Path | None = None
|
|
34
|
+
|
|
35
|
+
|
|
25
36
|
class PipListOutdatedOutput(BaseModel):
|
|
26
37
|
name: str
|
|
27
38
|
version: str
|
|
@@ -29,6 +40,10 @@ class PipListOutdatedOutput(BaseModel):
|
|
|
29
40
|
latest_filetype: str
|
|
30
41
|
|
|
31
42
|
|
|
43
|
+
_ = PipListOutput.model_rebuild()
|
|
44
|
+
_ = PipListOutdatedOutput.model_rebuild()
|
|
45
|
+
|
|
46
|
+
|
|
32
47
|
##
|
|
33
48
|
|
|
34
49
|
|
|
@@ -100,11 +115,9 @@ def parse_version2(version: str, /) -> Version2:
|
|
|
100
115
|
_PARSE_VERSION2_PATTERN = re.compile(r"^(\d+)\.(\d+)(?:-(\w+))?")
|
|
101
116
|
|
|
102
117
|
|
|
103
|
-
_ = PipListOutdatedOutput.model_rebuild()
|
|
104
|
-
|
|
105
|
-
|
|
106
118
|
__all__ = [
|
|
107
119
|
"PipListOutdatedOutput",
|
|
120
|
+
"PipListOutput",
|
|
108
121
|
"TwoSidedVersions",
|
|
109
122
|
"Version1or2",
|
|
110
123
|
"Version2",
|
|
@@ -5,12 +5,14 @@ from functools import partial
|
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from pydantic import TypeAdapter
|
|
8
|
+
from utilities.functions import max_nullable
|
|
8
9
|
from utilities.text import repr_str, strip_and_dedent
|
|
9
10
|
|
|
10
11
|
from actions import __version__
|
|
11
12
|
from actions.logging import LOGGER
|
|
12
13
|
from actions.pre_commit.update_requirements.classes import (
|
|
13
14
|
PipListOutdatedOutput,
|
|
15
|
+
PipListOutput,
|
|
14
16
|
Version1or2,
|
|
15
17
|
Version2,
|
|
16
18
|
Version3,
|
|
@@ -25,7 +27,7 @@ if TYPE_CHECKING:
|
|
|
25
27
|
from pathlib import Path
|
|
26
28
|
|
|
27
29
|
from utilities.packaging import Requirement
|
|
28
|
-
from utilities.types import PathLike
|
|
30
|
+
from utilities.types import PathLike, StrDict
|
|
29
31
|
|
|
30
32
|
from actions.pre_commit.update_requirements.classes import Version2or3, VersionSet
|
|
31
33
|
|
|
@@ -66,11 +68,20 @@ def _format_path(
|
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
def _get_versions() -> VersionSet:
|
|
69
|
-
|
|
71
|
+
json1 = logged_run(
|
|
72
|
+
"uv", "pip", "list", "--format", "json", "--strict", return_=True
|
|
73
|
+
)
|
|
74
|
+
models1 = TypeAdapter(list[PipListOutput]).validate_json(json1)
|
|
75
|
+
versions1 = {p.name: parse_version2_or_3(p.version) for p in models1}
|
|
76
|
+
json2 = logged_run(
|
|
70
77
|
"uv", "pip", "list", "--format", "json", "--outdated", "--strict", return_=True
|
|
71
78
|
)
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
models2 = TypeAdapter(list[PipListOutdatedOutput]).validate_json(json2)
|
|
80
|
+
versions2 = {p.name: parse_version2_or_3(p.latest_version) for p in models2}
|
|
81
|
+
out: StrDict = {}
|
|
82
|
+
for key in set(versions1) | set(versions2):
|
|
83
|
+
out[key] = max_nullable([versions1.get(key), versions2.get(key)])
|
|
84
|
+
return out
|
|
74
85
|
|
|
75
86
|
|
|
76
87
|
def _format_req(requirement: Requirement, /, *, versions: VersionSet) -> Requirement:
|
actions/pre_commit/utilities.py
CHANGED
|
@@ -15,19 +15,18 @@ from tomlkit.items import AoT, Array, Table
|
|
|
15
15
|
from utilities.functions import ensure_class, ensure_str
|
|
16
16
|
from utilities.iterables import OneEmptyError, OneNonUniqueError, one
|
|
17
17
|
from utilities.packaging import Requirement
|
|
18
|
-
from utilities.types import PathLike
|
|
18
|
+
from utilities.types import PathLike, StrDict
|
|
19
19
|
|
|
20
20
|
from actions.constants import YAML_INSTANCE
|
|
21
21
|
from actions.logging import LOGGER
|
|
22
|
-
from actions.types import StrDict
|
|
23
22
|
from actions.utilities import are_equal_modulo_new_line, write_text, yaml_dump
|
|
24
23
|
|
|
25
24
|
if TYPE_CHECKING:
|
|
26
25
|
from collections.abc import Callable, Iterable, Iterator, MutableSet
|
|
27
26
|
|
|
28
|
-
from utilities.types import PathLike
|
|
27
|
+
from utilities.types import PathLike, StrDict
|
|
29
28
|
|
|
30
|
-
from actions.types import FuncRequirement, HasAppend, HasSetDefault
|
|
29
|
+
from actions.types import FuncRequirement, HasAppend, HasSetDefault
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
def ensure_aot_contains(array: AoT, /, *tables: Table) -> None:
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typed_settings import click_options
|
|
4
|
+
from utilities.logging import basic_config
|
|
5
|
+
from utilities.os import is_pytest
|
|
6
|
+
|
|
7
|
+
from actions.logging import LOGGER
|
|
8
|
+
from actions.register_gitea_runner.lib import register_gitea_runner
|
|
9
|
+
from actions.register_gitea_runner.settings import Settings
|
|
10
|
+
from actions.utilities import LOADER
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click_options(Settings, [LOADER], show_envvars_in_help=True)
|
|
14
|
+
def register_gitea_runner_sub_cmd(settings: Settings, /) -> None:
|
|
15
|
+
if is_pytest():
|
|
16
|
+
return
|
|
17
|
+
basic_config(obj=LOGGER)
|
|
18
|
+
register_gitea_runner(
|
|
19
|
+
ssh_user=settings.ssh_user,
|
|
20
|
+
ssh_host=settings.ssh_host,
|
|
21
|
+
gitea_container_user=settings.gitea_container_user,
|
|
22
|
+
gitea_container_name=settings.gitea_container_name,
|
|
23
|
+
runner_certificate=settings.runner_certificate,
|
|
24
|
+
runner_capacity=settings.runner_capacity,
|
|
25
|
+
runner_container_name=settings.runner_container_name,
|
|
26
|
+
gitea_host=settings.gitea_host,
|
|
27
|
+
gitea_port=settings.gitea_port,
|
|
28
|
+
runner_instance_name=settings.runner_instance_name,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
__all__ = ["register_gitea_runner_sub_cmd"]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Example configuration file, it's safe to copy this as the default config file without any modification.
|
|
2
|
+
|
|
3
|
+
# You don't have to copy this file to your instance,
|
|
4
|
+
# just run `./act_runner generate-config > config.yaml` to generate a config file.
|
|
5
|
+
|
|
6
|
+
log:
|
|
7
|
+
# The level of logging, can be trace, debug, info, warn, error, fatal
|
|
8
|
+
level: info
|
|
9
|
+
|
|
10
|
+
runner:
|
|
11
|
+
# Where to store the registration result.
|
|
12
|
+
file: .runner
|
|
13
|
+
# Execute how many tasks concurrently at the same time.
|
|
14
|
+
capacity: ${CAPACITY}
|
|
15
|
+
# Extra environment variables to run jobs.
|
|
16
|
+
envs:
|
|
17
|
+
A_TEST_ENV_NAME_1: a_test_env_value_1
|
|
18
|
+
A_TEST_ENV_NAME_2: a_test_env_value_2
|
|
19
|
+
# Extra environment variables to run jobs from a file.
|
|
20
|
+
# It will be ignored if it's empty or the file doesn't exist.
|
|
21
|
+
env_file: .env
|
|
22
|
+
# The timeout for a job to be finished.
|
|
23
|
+
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
|
24
|
+
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
|
25
|
+
timeout: 3h
|
|
26
|
+
# The timeout for the runner to wait for running jobs to finish when shutting down.
|
|
27
|
+
# Any running jobs that haven't finished after this timeout will be cancelled.
|
|
28
|
+
shutdown_timeout: 0s
|
|
29
|
+
# Whether skip verifying the TLS certificate of the Gitea instance.
|
|
30
|
+
insecure: false
|
|
31
|
+
# The timeout for fetching the job from the Gitea instance.
|
|
32
|
+
fetch_timeout: 5s
|
|
33
|
+
# The interval for fetching the job from the Gitea instance.
|
|
34
|
+
fetch_interval: 2s
|
|
35
|
+
# The github_mirror of a runner is used to specify the mirror address of the github that pulls the action repository.
|
|
36
|
+
# It works when something like `uses: actions/checkout@v4` is used and DEFAULT_ACTIONS_URL is set to github,
|
|
37
|
+
# and github_mirror is not empty. In this case,
|
|
38
|
+
# it replaces https://github.com with the value here, which is useful for some special network environments.
|
|
39
|
+
github_mirror: ""
|
|
40
|
+
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
|
41
|
+
# Like: "macos-arm64:host" or "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
|
42
|
+
# Find more images provided by Gitea at https://gitea.com/docker.gitea.com/runner-images .
|
|
43
|
+
# If it's empty when registering, it will ask for inputting labels.
|
|
44
|
+
# If it's empty when execute `daemon`, will use labels in `.runner` file.
|
|
45
|
+
labels:
|
|
46
|
+
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
|
47
|
+
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
|
48
|
+
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
|
|
49
|
+
|
|
50
|
+
cache:
|
|
51
|
+
# Enable cache server to use actions/cache.
|
|
52
|
+
enabled: true
|
|
53
|
+
# The directory to store the cache data.
|
|
54
|
+
# If it's empty, the cache data will be stored in ${HOME}/.cache/actcache.
|
|
55
|
+
dir: ""
|
|
56
|
+
# The host of the cache server.
|
|
57
|
+
# It's not for the address to listen, but the address to connect from job containers.
|
|
58
|
+
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
|
|
59
|
+
host: ""
|
|
60
|
+
# The port of the cache server.
|
|
61
|
+
# 0 means to use a random available port.
|
|
62
|
+
port: 0
|
|
63
|
+
# The external cache server URL. Valid only when enable is true.
|
|
64
|
+
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
|
|
65
|
+
# The URL should generally end with "/".
|
|
66
|
+
external_server: ""
|
|
67
|
+
|
|
68
|
+
container:
|
|
69
|
+
# Specifies the network to which the container will connect.
|
|
70
|
+
# Could be host, bridge or the name of a custom network.
|
|
71
|
+
# If it's empty, act_runner will create a network automatically.
|
|
72
|
+
network: ""
|
|
73
|
+
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
|
|
74
|
+
privileged: false
|
|
75
|
+
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
|
76
|
+
options: "-v ${CERTIFICATE}:/usr/local/share/ca-certificates/root.crt:ro"
|
|
77
|
+
# The parent directory of a job's working directory.
|
|
78
|
+
# NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically.
|
|
79
|
+
# If the path starts with '/', the '/' will be trimmed.
|
|
80
|
+
# For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
|
|
81
|
+
# If it's empty, /workspace will be used.
|
|
82
|
+
workdir_parent:
|
|
83
|
+
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
|
|
84
|
+
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
|
|
85
|
+
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
|
|
86
|
+
# valid_volumes:
|
|
87
|
+
# - data
|
|
88
|
+
# - /src/*.json
|
|
89
|
+
# If you want to allow any volume, please use the following configuration:
|
|
90
|
+
# valid_volumes:
|
|
91
|
+
# - '**'
|
|
92
|
+
valid_volumes: ["**"]
|
|
93
|
+
# overrides the docker client host with the specified one.
|
|
94
|
+
# If it's empty, act_runner will find an available docker host automatically.
|
|
95
|
+
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
|
96
|
+
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
|
97
|
+
docker_host: ""
|
|
98
|
+
# Pull docker image(s) even if already present
|
|
99
|
+
force_pull: true
|
|
100
|
+
# Rebuild docker image(s) even if already present
|
|
101
|
+
force_rebuild: false
|
|
102
|
+
# Always require a reachable docker daemon, even if not required by act_runner
|
|
103
|
+
require_docker: false
|
|
104
|
+
# Timeout to wait for the docker daemon to be reachable, if docker is required by require_docker or act_runner
|
|
105
|
+
docker_timeout: 0s
|
|
106
|
+
|
|
107
|
+
host:
|
|
108
|
+
# The parent directory of a job's working directory.
|
|
109
|
+
# If it's empty, ${HOME}/.cache/act/ will be used.
|
|
110
|
+
workdir_parent:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -euxo
|
|
3
|
+
|
|
4
|
+
# echo
|
|
5
|
+
echo_date() { echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*" >&2; }
|
|
6
|
+
|
|
7
|
+
# main
|
|
8
|
+
wait-for-it.sh \
|
|
9
|
+
--host="${GITEA_HOST}" \
|
|
10
|
+
--port="${GITEA_PORT}" \
|
|
11
|
+
--strict \
|
|
12
|
+
-- \
|
|
13
|
+
echo "${GITEA_HOST}:${GITEA_PORT} is up"
|
|
14
|
+
|
|
15
|
+
if ! command -v update-ca-certificates >/dev/null 2>&1; then
|
|
16
|
+
echo_date "Installing 'ca-certificates'..."
|
|
17
|
+
apk update
|
|
18
|
+
apk add --no-cache ca-certificates
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
update-ca-certificates || true
|
|
22
|
+
|
|
23
|
+
exec /sbin/tini -- run.sh
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import actions.constants
|
|
4
|
+
from actions.constants import PATH_ACTIONS
|
|
5
|
+
|
|
6
|
+
REGISTER_GITEA_RUNNER_SUB_CMD = "register-gitea-runner"
|
|
7
|
+
REGISTER_GITEA_RUNNER_DOCSTRING = "Register a Gitea runner"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
PATH_CACHE = actions.constants.PATH_CACHE / REGISTER_GITEA_RUNNER_SUB_CMD
|
|
11
|
+
PATH_CONFIGS = PATH_ACTIONS / "register_gitea_runner/configs"
|
|
12
|
+
PATH_WAIT_FOR_IT = PATH_CACHE / "wait-for-it.sh"
|
|
13
|
+
URL_WAIT_FOR_IT = "https://raw.githubusercontent.com/vishnubob/wait-for-it/refs/heads/master/wait-for-it.sh"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"PATH_CACHE",
|
|
18
|
+
"PATH_CONFIGS",
|
|
19
|
+
"PATH_WAIT_FOR_IT",
|
|
20
|
+
"REGISTER_GITEA_RUNNER_DOCSTRING",
|
|
21
|
+
"REGISTER_GITEA_RUNNER_SUB_CMD",
|
|
22
|
+
"URL_WAIT_FOR_IT",
|
|
23
|
+
]
|