.gitea/workflows/demo.yaml
This commit is contained in:
parent
012c7ea56e
commit
3acee2404a
89
.gitea/workflows/demo.yaml
Normal file
89
.gitea/workflows/demo.yaml
Normal file
@ -0,0 +1,89 @@
|
||||
ctrl
|
||||
K
|
||||
Gitea Logo
|
||||
|
||||
UsageactionsQuick Start
|
||||
|
||||
Version: 1.21.2
|
||||
Quick Start
|
||||
|
||||
This page will guide you through the process of using Gitea Actions.
|
||||
Set up Gitea
|
||||
|
||||
First of all, you need a Gitea instance. You can follow the documentation to set up a new instance or upgrade your existing one. It doesn't matter how you install or run Gitea, as long as its version is 1.19.0 or higher.
|
||||
|
||||
Since 1.21.0, Actions are enabled by default. If you are using versions before 1.21.0, you need to add the following to the configuration file to enable it:
|
||||
|
||||
[actions]
|
||||
ENABLED=true
|
||||
|
||||
If you want to learn more or encounter any problems while configuring it, please refer to the Configuration Cheat Sheet.
|
||||
Set up runner
|
||||
|
||||
Gitea Actions requires act runner to run the jobs. In order to avoid consuming too many resources and affecting the Gitea instance, it is recommended to start runners on separate machines from the Gitea instance.
|
||||
|
||||
You can use the pre-built binaries or the docker images to set up the runner.
|
||||
|
||||
Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your local host. And it could be easier to debug if something goes wrong.
|
||||
|
||||
The runner can run the jobs in isolated Docker containers, so you need to make sure that the Docker has been installed and Docker daemon is running. While it is not strictly necessary, because the runner can also run the jobs directly on the host, it depends on how you configure it. However, it is recommended to use Docker to run the jobs, because it is more secure and easier to manage.
|
||||
|
||||
Before running a runner, you should first register it to your Gitea instance using the following command:
|
||||
|
||||
./act_runner register --no-interactive --instance <instance> --token <token>
|
||||
|
||||
There are two arguments required, instance and token.
|
||||
|
||||
instance refers to the address of your Gitea instance, like http://192.168.8.8:3000 or https://gitea.com. The runner and job containers (which are started by the runner to execute jobs) will connect to this address. This means that it could be different from the ROOT_URL of your Gitea instance, which is configured for web access. It is always a bad idea to use a loopback address such as 127.0.0.1 or localhost. If you are unsure which address to use, the LAN address is usually the right choice.
|
||||
|
||||
token is used for authentication and identification, such as P2U1U0oB4XaRCi8azcngmPCLbRpUGapalhmddh23. It is one-time use only and cannot be used to register multiple runners. You can obtain different levels of 'tokens' from the following places to create the corresponding level of' runners':
|
||||
|
||||
Instance level: The admin settings page, like <your_gitea.com>/admin/actions/runners.
|
||||
Organization level: The organization settings page, like <your_gitea.com>/<org>/settings/actions/runners.
|
||||
Repository level: The repository settings page, like <your_gitea.com>/<owner>/<repo>/settings/actions/runners.
|
||||
|
||||
register runner
|
||||
|
||||
After registering, a new file named .runner will appear in the current directory. This file stores the registration information. Please do not edit it manually. If this file is missing or corrupted, you can simply remove it and register again.
|
||||
|
||||
Finally, it's time to start the runner:
|
||||
|
||||
./act_runner daemon
|
||||
|
||||
And you can see the new runner in the management page:
|
||||
|
||||
view runner
|
||||
|
||||
You can find more information by visiting Act runner.
|
||||
Use Actions
|
||||
|
||||
Even if Actions is enabled for the Gitea instance, repositories still disable Actions by default.
|
||||
|
||||
To enable it, go to the settings page of your repository like your_gitea.com/<owner>/repo/settings and enable Enable Repository Actions.
|
||||
|
||||
enable actions
|
||||
|
||||
The next steps may be rather complicated. You will need to study the workflow syntax for Actions and write the workflow files you want.
|
||||
|
||||
However, we can just start from a simple demo:
|
||||
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
from ctypes import *
|
||||
from datetime import datetime
|
||||
from typing import Union, Callable, Union
|
||||
from typing import Union, Callable
|
||||
|
||||
try:
|
||||
from wrapper.libtox import LibToxCore
|
||||
@ -1348,7 +1348,7 @@ class Tox:
|
||||
# File transmission: common between sending and receiving
|
||||
|
||||
@staticmethod
|
||||
def hash(data, hash=None) -> str:
|
||||
def hash(data: bytes, hash=None) -> str:
|
||||
"""Generates a cryptographic hash of the given data.
|
||||
|
||||
This function may be used by clients for any purpose, but is
|
||||
@ -1367,9 +1367,8 @@ class Tox:
|
||||
if hash is None:
|
||||
hash = create_string_buffer(TOX_HASH_LENGTH)
|
||||
else:
|
||||
isinstance(hash, Array), type(hash)
|
||||
if type(data) == str:
|
||||
data = bytes(data, 'utf-8')
|
||||
assert isinstance(hash, Array), f"{type(hash)}"
|
||||
assert type(data) == bytes, f"{type(data)} != bytes"
|
||||
Tox.libtoxcore.tox_hash(hash, c_char_p(data), c_size_t(len(data)))
|
||||
return bin_to_string(hash, TOX_HASH_LENGTH)
|
||||
|
||||
|
@ -9,8 +9,9 @@ except:
|
||||
#? from toxencryptsave_enums_and_consts import *
|
||||
import toxencryptsave_enums_and_consts as enum
|
||||
|
||||
from typing import Union, Callable
|
||||
from ctypes import (ArgumentError, byref, c_bool, c_char_p, c_int, c_size_t,
|
||||
create_string_buffer)
|
||||
create_string_buffer, Array)
|
||||
|
||||
|
||||
class ToxEncryptSave:
|
||||
|
Loading…
Reference in New Issue
Block a user