添加初步的 gitea actions 构建支持

This commit is contained in:
mofeng-git
2025-05-11 20:21:18 +08:00
parent a92a6f2811
commit ed7b2e5b33
8 changed files with 250 additions and 186 deletions

View File

@@ -1,23 +0,0 @@
name: Arduino HID CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
container:
image: python
steps:
- uses: actions/checkout@v3
- name: Prepare platformio
run: pip install platformio
- name: Build all
run: make -C hid/arduino _build_all

74
.github/workflows/build_img.yaml vendored Normal file
View File

@@ -0,0 +1,74 @@
name: Build One-KVM Image
on:
workflow_dispatch:
inputs:
device_target:
description: 'Target device name'
required: true
type: choice
options:
- onecloud
- cumebox2
- chainedbox
- vm
- e900v22c
- octopus-flanet
- all
jobs:
build:
runs-on: ubuntu-22.04
container:
image: node:18
options: --user root --privileged
env:
TZ: Asia/Shanghai
volumes:
- /dev:/dev
- /mnt/nfs/lfs/:/mnt/nfs/lfs/
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
sudo tzdata docker.io qemu-utils qemu-user-static binfmt-support parted e2fsprogs \
curl tar python3 python3-pip rsync git android-sdk-libsparse-utils coreutils zerofree
apt-get clean
rm -rf /var/lib/apt/lists/*
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ > /etc/timezone
update-binfmts --enable
env:
DEBIAN_FRONTEND: noninteractive
- name: Build image
run: |
echo "BUILD_DATE=$(date +%y%m%d)" >> $GITHUB_ENV
chmod +x build/build_img.sh
echo "Starting build for target: ${{ github.event.inputs.device_target }}"
bash build/build_img.sh ${{ github.event.inputs.device_target }}
echo "Build script finished."
env:
CI_PROJECT_DIR: ${{ github.workspace }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: onekvm-image-${{ github.event.inputs.device_target }}-${{ env.BUILD_DATE }}
path: |
${{ github.workspace }}/output/*.img
${{ github.workspace }}/output/*.vmdk
${{ github.workspace }}/output/*.vdi
${{ github.workspace }}/output/*.burn.img
if-no-files-found: ignore
env:
CI_PROJECT_DIR: ${{ github.workspace }}

View File

75
.github/workflows/docker-build.yaml vendored Normal file
View File

@@ -0,0 +1,75 @@
name: Build and Push Docker Image
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: choice
options:
- dev
- latest
jobs:
build-and-push-image:
runs-on: ubuntu-22.04
container:
image: docker:24.0-cli
env:
TZ: Asia/Shanghai
# 定义环境变量,方便管理
# 修改为你的 Docker Registry 地址,如果是 Docker Hub则为 docker.io (可以省略)
# 如果是 Gitea 内置的包管理器,则为你的 Gitea 实例地址,例如 gitea.example.com:5000
DOCKER_REGISTRY: docker.io
# 推荐使用 Gitea 的内置变量来动态生成镜像名
#IMAGE_NAME: ${{ gitea.repository_owner }}/${{ gitea.repository_name }}
IMAGE_NAME: silentwind0/kvmd:${{ inputs.version }}
steps:
- name: Print Build Information
run: |
echo "Workflow triggered for version: ${{ inputs.version }}"
echo "Current time: $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Install dependencies
run: |
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends sudo tzdata node git
apt-get clean
rm -rf /var/lib/apt/lists/*
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ > /etc/timezone
env:
DEBIAN_FRONTEND: noninteractive
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
#- name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ./build/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
#push: true
push: false
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
cache-from: type=registry,ref=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max

View File

@@ -1,41 +0,0 @@
name: Pico HID Release
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Installing deps ...
run: sudo apt-get install cmake gcc-arm-none-eabi build-essential
- name: Building ...
run: make -C hid/pico all
- name: Releasing ...
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Uploading firmware ...
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./hid/pico/hid.uf2
asset_name: pico-hid.uf2
asset_content_type: application/octet-stream

View File

@@ -1,20 +0,0 @@
name: Pico HID CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Installing deps ...
run: sudo apt-get install cmake gcc-arm-none-eabi build-essential
- name: Running tests ...
run: make -C hid/pico all

View File

@@ -1,20 +0,0 @@
name: TOX CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Building testenv ...
run: make testenv
- name: Running tests ...
run: make tox CMD="tox -c testenv/tox.ini"