Update .gitea/workflow/*.yaml
This commit is contained in:
@@ -1,37 +1,37 @@
|
|||||||
name: Conditional Steps # Name of workflow
|
name: Conditional Steps # Name of workflow
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
example_job:
|
example_job:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Step 1 - Exit Code 0
|
- name: Step 1 - Exit Code 0
|
||||||
id: successful_step
|
id: successful_step
|
||||||
run: |
|
run: |
|
||||||
echo "exit code 0"
|
echo "exit code 0"
|
||||||
exit 0 # Success (exit code 0)
|
exit 0 # Success (exit code 0)
|
||||||
shell: bash # If you want you can change the shell per step
|
shell: bash # If you want you can change the shell per step
|
||||||
|
|
||||||
- name: Step 2 - Execute If Previous Succeeded
|
- name: Step 2 - Execute If Previous Succeeded
|
||||||
# The syntax bellow ${{}} is expression syntax in github actions
|
# The syntax bellow ${{}} is expression syntax in github actions
|
||||||
# Success and failure are status expressions
|
# Success and failure are status expressions
|
||||||
if: ${{ success() }} # Only run this step if the previous step succeeded
|
if: ${{ success() }} # Only run this step if the previous step succeeded
|
||||||
run: |
|
run: |
|
||||||
echo "Running because the previous step has succeeded"
|
echo "Running because the previous step has succeeded"
|
||||||
|
|
||||||
- name: Step 3 - I am Failing
|
- name: Step 3 - I am Failing
|
||||||
run: |
|
run: |
|
||||||
echo "I am failing"
|
echo "I am failing"
|
||||||
exit 1 # Failure (non-zero exit code)
|
exit 1 # Failure (non-zero exit code)
|
||||||
|
|
||||||
- name: Step 4 - I Will Never Execute # Because of failure of Step 3
|
- name: Step 4 - I Will Never Execute # Because of failure of Step 3
|
||||||
run: |
|
run: |
|
||||||
echo "I will never execute"
|
echo "I will never execute"
|
||||||
|
|
||||||
- name: Step 5 - Execute on Workflow Failure
|
- name: Step 5 - Execute on Workflow Failure
|
||||||
if: ${{ failure() }} # Only run this step if the workflow failed
|
if: ${{ failure() }} # Only run this step if the workflow failed
|
||||||
run: |
|
run: |
|
||||||
echo "Workflow failed"
|
echo "Workflow failed"
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
name: Parallel Jobs
|
name: Parallel Jobs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linting:
|
linting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Linting
|
- name: Linting
|
||||||
run: echo "Running linting..."
|
run: echo "Running linting..."
|
||||||
|
|
||||||
unit_tests:
|
unit_tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Unit Tests
|
- name: Unit Tests
|
||||||
run: echo "Running unit tests..."
|
run: echo "Running unit tests..."
|
||||||
|
|
||||||
integration_tests:
|
integration_tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set Up Test Environment
|
- name: Set Up Test Environment
|
||||||
run: echo "Setting up test environment..."
|
run: echo "Setting up test environment..."
|
||||||
|
|
||||||
- name: Integration Tests
|
- name: Integration Tests
|
||||||
run: echo "Running integration tests..."
|
run: echo "Running integration tests..."
|
||||||
23
.gitea/workflows/003_first_workflow.yaml
Normal file
23
.gitea/workflows/003_first_workflow.yaml
Normal 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 }}"
|
||||||
15
.gitea/workflows/003_second_workflow.yaml
Normal file
15
.gitea/workflows/003_second_workflow.yaml
Normal 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"
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
name: CI Workflow
|
name: CI Workflow
|
||||||
|
|
||||||
#on:
|
#on:
|
||||||
# push:
|
# push:
|
||||||
# branches:
|
# branches:
|
||||||
# - "**"
|
# - "**"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r requirements.txt
|
run: pip install -r requirements.txt
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pytest -v
|
run: pytest -v
|
||||||
@@ -1,28 +1,28 @@
|
|||||||
name: Docker Build
|
name: Docker Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
#on:
|
#on:
|
||||||
# push:
|
# push:
|
||||||
# branches:
|
# branches:
|
||||||
# - main
|
# - main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Log in to Gitea Registry
|
- name: Log in to Gitea Registry
|
||||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.cuihang1201.synology.me -u hangpersonal --password-stdin
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.cuihang1201.synology.me -u hangpersonal --password-stdin
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: docker build -t gitea.cuihang1201.synology.me/hangpersonal/myapp:latest .
|
run: docker build -t gitea.cuihang1201.synology.me/hangpersonal/myapp:latest .
|
||||||
|
|
||||||
- name: Run Docker image
|
- name: Run Docker image
|
||||||
run: docker run --rm gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
|
run: docker run --rm gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
|
||||||
|
|
||||||
- name: Push Docker image
|
- name: Push Docker image
|
||||||
run: docker push gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
|
run: docker push gitea.cuihang1201.synology.me/hangpersonal/myapp:latest
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
name: Release Workflow
|
name: Release Workflow
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
#on: # The workflow only runs with push a Git tag
|
#on: # The workflow only runs with push a Git tag
|
||||||
# push:
|
# push:
|
||||||
# tags:
|
# tags:
|
||||||
# - "v*.*.*" # v1.0.0, v2.5.3, v10.23.7
|
# - "v*.*.*" # v1.0.0, v2.5.3, v10.23.7
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Defines a job named release
|
# Defines a job named release
|
||||||
release:
|
release:
|
||||||
# According to the Gitea documentation, the ubuntu-latest label is mapped
|
# According to the Gitea documentation, the ubuntu-latest label is mapped
|
||||||
# internally to Ubuntu 22.04 environments
|
# internally to Ubuntu 22.04 environments
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
# Pulls your repo into the runner so it has access to the source code
|
# Pulls your repo into the runner so it has access to the source code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build artifact
|
- name: Build artifact
|
||||||
# Makes a directory dist/
|
# Makes a directory dist/
|
||||||
# Creates a file README.txt inside dist/
|
# Creates a file README.txt inside dist/
|
||||||
# $GITHUB_REF_NAME is an environment variable set by Actions -
|
# $GITHUB_REF_NAME is an environment variable set by Actions -
|
||||||
# it will be the name of the Git tag that triggered this workflow
|
# 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"
|
# If you pushed v1.2.3, the file will contain "Release version v1.2.3"
|
||||||
# run, execute these shell commands
|
# run, execute these shell commands
|
||||||
# |, treat everything indented below this as a multi-line string,
|
# |, treat everything indented below this as a multi-line string,
|
||||||
# and keep line breaks as they are.
|
# and keep line breaks as they are.
|
||||||
# /workspace/<owner>/<repo>/dist/
|
# /workspace/<owner>/<repo>/dist/
|
||||||
run: |
|
run: |
|
||||||
mkdir dist
|
mkdir dist
|
||||||
echo "Release version $GITHUB_REF_NAME" > dist/README.txt
|
echo "Release version $GITHUB_REF_NAME" > dist/README.txt
|
||||||
echo "Ref $GITHUB_REF" >> dist/README.txt
|
echo "Ref $GITHUB_REF" >> dist/README.txt
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
# Packages whatever is inside dist/ (in this case, just the README.txt)
|
# Packages whatever is inside dist/ (in this case, just the README.txt)
|
||||||
# Uploads it to Gitea Actions as a downloadable artifact
|
# Uploads it to Gitea Actions as a downloadable artifact
|
||||||
# In the Actions UI, after the run finishes, a link to download release-files.zip
|
# In the Actions UI, after the run finishes, a link to download release-files.zip
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: release-files
|
name: release-files
|
||||||
path: dist/
|
path: dist/
|
||||||
|
|||||||
30
Dockerfile
30
Dockerfile
@@ -1,15 +1,15 @@
|
|||||||
# Base image with Python 3.10
|
# Base image with Python 3.10
|
||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
|
|
||||||
# Set work directory inside container
|
# Set work directory inside container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy dependency file and install dependencies
|
# Copy dependency file and install dependencies
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy the rest of your code
|
# Copy the rest of your code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Default command (can be overridden in docker run)
|
# Default command (can be overridden in docker run)
|
||||||
CMD ["python3", "main.py"]
|
CMD ["python3", "main.py"]
|
||||||
|
|||||||
36
LICENSE
36
LICENSE
@@ -1,18 +1,18 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 hangpersonal
|
Copyright (c) 2025 hangpersonal
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
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
|
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
|
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
|
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
||||||
following conditions:
|
following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||||
portions of the Software.
|
portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
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
|
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
|
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
|
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.
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[pytest]
|
[pytest]
|
||||||
testpaths = tests
|
testpaths = tests
|
||||||
python_files = test_*.py
|
python_files = test_*.py
|
||||||
python_functions = test_*
|
python_functions = test_*
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
numpy==1.26.4
|
numpy==1.26.4
|
||||||
requests>=2.31
|
requests>=2.31
|
||||||
pytest
|
pytest
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# tests/test_smoke.py
|
# tests/test_smoke.py
|
||||||
def test_smoke():
|
def test_smoke():
|
||||||
assert True
|
assert True
|
||||||
Reference in New Issue
Block a user