Update .gitea/workflow/*.yaml

This commit is contained in:
Hang Cui
2025-10-17 10:19:58 -07:00
parent 7eb71757ea
commit fac212e278
13 changed files with 240 additions and 202 deletions

View File

@@ -1,37 +1,37 @@
name: Conditional Steps # Name of workflow
on:
workflow_dispatch:
jobs:
example_job:
runs-on: ubuntu-latest
steps:
- name: Step 1 - Exit Code 0
id: successful_step
run: |
echo "exit code 0"
exit 0 # Success (exit code 0)
shell: bash # If you want you can change the shell per step
- name: Step 2 - Execute If Previous Succeeded
# The syntax bellow ${{}} is expression syntax in github actions
# Success and failure are status expressions
if: ${{ success() }} # Only run this step if the previous step succeeded
run: |
echo "Running because the previous step has succeeded"
- name: Step 3 - I am Failing
run: |
echo "I am failing"
exit 1 # Failure (non-zero exit code)
- name: Step 4 - I Will Never Execute # Because of failure of Step 3
run: |
echo "I will never execute"
- name: Step 5 - Execute on Workflow Failure
if: ${{ failure() }} # Only run this step if the workflow failed
run: |
name: Conditional Steps # Name of workflow
on:
workflow_dispatch:
jobs:
example_job:
runs-on: ubuntu-latest
steps:
- name: Step 1 - Exit Code 0
id: successful_step
run: |
echo "exit code 0"
exit 0 # Success (exit code 0)
shell: bash # If you want you can change the shell per step
- name: Step 2 - Execute If Previous Succeeded
# The syntax bellow ${{}} is expression syntax in github actions
# Success and failure are status expressions
if: ${{ success() }} # Only run this step if the previous step succeeded
run: |
echo "Running because the previous step has succeeded"
- name: Step 3 - I am Failing
run: |
echo "I am failing"
exit 1 # Failure (non-zero exit code)
- name: Step 4 - I Will Never Execute # Because of failure of Step 3
run: |
echo "I will never execute"
- name: Step 5 - Execute on Workflow Failure
if: ${{ failure() }} # Only run this step if the workflow failed
run: |
echo "Workflow failed"

View File

@@ -1,26 +1,26 @@
name: Parallel Jobs
on:
workflow_dispatch:
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Linting
run: echo "Running linting..."
unit_tests:
runs-on: ubuntu-latest
steps:
- name: Unit Tests
run: echo "Running unit tests..."
integration_tests:
runs-on: ubuntu-latest
steps:
- name: Set Up Test Environment
run: echo "Setting up test environment..."
- name: Integration Tests
name: Parallel Jobs
on:
workflow_dispatch:
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Linting
run: echo "Running linting..."
unit_tests:
runs-on: ubuntu-latest
steps:
- name: Unit Tests
run: echo "Running unit tests..."
integration_tests:
runs-on: ubuntu-latest
steps:
- name: Set Up Test Environment
run: echo "Setting up test environment..."
- name: Integration Tests
run: echo "Running integration tests..."

View File

@@ -0,0 +1,23 @@
name: workflow_dispatch # Name of workflow
on:
workflow_dispatch:
inputs:
username:
description: 'Username'
default: 'Hang'
required: true
type: string
age:
description: 'Age'
required: true
type: number
jobs:
echo-username-age: # Name of job
runs-on: ubuntu-latest
steps:
- name: Echo Username and Age
run: |
echo "Username: ${{ inputs.username }}"
echo "Age: ${{ inputs.age }}"

View File

@@ -0,0 +1,15 @@
name: workflow_run # Name of workflow
on:
workflow_run: # Depend on the workflow completion of "workflow_dispatch"
workflows: ["workflow_dispatch"]
types:
- completed
jobs:
echo-hi-all: # Name of job
runs-on: ubuntu-latest
steps:
- name: Echo "Hi all"
run: |
echo "Hi all"

View File

@@ -1,27 +1,27 @@
name: CI Workflow
#on:
# push:
# branches:
# - "**"
on:
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
name: CI Workflow
#on:
# push:
# branches:
# - "**"
on:
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest -v

View File

@@ -1,28 +1,28 @@
name: Docker Build
on:
workflow_dispatch:
#on:
# push:
# branches:
# - main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Gitea Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.cuihang1201.synology.me -u hangpersonal --password-stdin
- name: Build Docker image
run: docker build -t gitea.cuihang1201.synology.me/hangpersonal/myapp:latest .
- name: Run Docker image
run: docker run --rm gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
- name: Push Docker image
run: docker push gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
name: Docker Build
on:
workflow_dispatch:
#on:
# push:
# branches:
# - main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Gitea Registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.cuihang1201.synology.me -u hangpersonal --password-stdin
- name: Build Docker image
run: docker build -t gitea.cuihang1201.synology.me/hangpersonal/myapp:latest .
- name: Run Docker image
run: docker run --rm gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
- name: Push Docker image
run: docker push gitea.cuihang1201.synology.me/hangpersonal/myapp:latest

View File

@@ -1,44 +1,44 @@
name: Release Workflow
on:
workflow_dispatch:
#on: # The workflow only runs with push a Git tag
# push:
# tags:
# - "v*.*.*" # v1.0.0, v2.5.3, v10.23.7
jobs:
# Defines a job named release
release:
# According to the Gitea documentation, the ubuntu-latest label is mapped
# internally to Ubuntu 22.04 environments
runs-on: ubuntu-latest
steps:
- name: Checkout code
# Pulls your repo into the runner so it has access to the source code
uses: actions/checkout@v3
- name: Build artifact
# Makes a directory dist/
# Creates a file README.txt inside dist/
# $GITHUB_REF_NAME is an environment variable set by Actions -
# it will be the name of the Git tag that triggered this workflow
# If you pushed v1.2.3, the file will contain "Release version v1.2.3"
# run, execute these shell commands
# |, treat everything indented below this as a multi-line string,
# and keep line breaks as they are.
# /workspace/<owner>/<repo>/dist/
run: |
mkdir dist
echo "Release version $GITHUB_REF_NAME" > dist/README.txt
echo "Ref $GITHUB_REF" >> dist/README.txt
- name: Upload artifact
# Packages whatever is inside dist/ (in this case, just the README.txt)
# Uploads it to Gitea Actions as a downloadable artifact
# In the Actions UI, after the run finishes, a link to download release-files.zip
uses: actions/upload-artifact@v3
with:
name: release-files
path: dist/
name: Release Workflow
on:
workflow_dispatch:
#on: # The workflow only runs with push a Git tag
# push:
# tags:
# - "v*.*.*" # v1.0.0, v2.5.3, v10.23.7
jobs:
# Defines a job named release
release:
# According to the Gitea documentation, the ubuntu-latest label is mapped
# internally to Ubuntu 22.04 environments
runs-on: ubuntu-latest
steps:
- name: Checkout code
# Pulls your repo into the runner so it has access to the source code
uses: actions/checkout@v3
- name: Build artifact
# Makes a directory dist/
# Creates a file README.txt inside dist/
# $GITHUB_REF_NAME is an environment variable set by Actions -
# it will be the name of the Git tag that triggered this workflow
# If you pushed v1.2.3, the file will contain "Release version v1.2.3"
# run, execute these shell commands
# |, treat everything indented below this as a multi-line string,
# and keep line breaks as they are.
# /workspace/<owner>/<repo>/dist/
run: |
mkdir dist
echo "Release version $GITHUB_REF_NAME" > dist/README.txt
echo "Ref $GITHUB_REF" >> dist/README.txt
- name: Upload artifact
# Packages whatever is inside dist/ (in this case, just the README.txt)
# Uploads it to Gitea Actions as a downloadable artifact
# In the Actions UI, after the run finishes, a link to download release-files.zip
uses: actions/upload-artifact@v3
with:
name: release-files
path: dist/

View File

@@ -1,15 +1,15 @@
# Base image with Python 3.10
FROM python:3.10-slim
# Set work directory inside container
WORKDIR /app
# Copy dependency file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your code
COPY . .
# Default command (can be overridden in docker run)
CMD ["python3", "main.py"]
# Base image with Python 3.10
FROM python:3.10-slim
# Set work directory inside container
WORKDIR /app
# Copy dependency file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your code
COPY . .
# Default command (can be overridden in docker run)
CMD ["python3", "main.py"]

36
LICENSE
View File

@@ -1,18 +1,18 @@
MIT License
Copyright (c) 2025 hangpersonal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License
Copyright (c) 2025 hangpersonal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,2 +1,2 @@
# Gitea_Action_Test
# Gitea_Action_Test

View File

@@ -1,4 +1,4 @@
[pytest]
testpaths = tests
python_files = test_*.py
python_functions = test_*
[pytest]
testpaths = tests
python_files = test_*.py
python_functions = test_*

View File

@@ -1,3 +1,3 @@
numpy==1.26.4
requests>=2.31
numpy==1.26.4
requests>=2.31
pytest

View File

@@ -1,3 +1,3 @@
# tests/test_smoke.py
def test_smoke():
# tests/test_smoke.py
def test_smoke():
assert True