test 4
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
2026-01-02 16:59:32 +08:00
parent 6d557622b9
commit 41f8201b36

View File

@@ -1,60 +1,60 @@
# .woodpecker.yml - Fig Language CI for Woodpecker # .woodpecker.yml - Fig Language CI
# Windows/Linux 构建, xmake, 自动打包, 自动上传 Gitea Release # Linux Runner 编译 Linux + Windows 二进制, 测试, 打包, Gitea Release
# 使用 Gitea token steps:
environment: - name: build-and-cross
GITEA_TOKEN: image: debian:bookworm
from_secret: GITEA_TOKEN commands:
GITEA_REPO: "PuqiAR/Fig" # 替换成你的 Gitea 仓库 # 安装依赖
GITEA_URL: "https://git.fig-lang.cn" # 替换成你的 Gitea 地址 - apt-get update -y
- apt-get install -y curl git build-essential clang llvm mingw-w64 ninja-build jq
# 安装 xmake
- curl -fsSL https://xmake.io/shget.text | bash
- export PATH=$HOME/.xmake/bin:$PATH
# Linux 构建 # 编译 Linux 版本
build-linux: - xmake f -m release
image: debian:bookworm - xmake -v
commands: - mkdir -p dist
- apt-get update -y - cp `xmake u -o`/Fig dist/Fig-linux
- apt-get install -y curl git build-essential clang llvm ninja-build jq
- curl -fsSL https://xmake.io/shget.text | bash
- export PATH=$HOME/.xmake/bin:$PATH
- xmake f -m release
- xmake -v
- mkdir -p dist
- cp `xmake u -o`/Fig dist/
# Windows 构建 # 交叉编译 Windows 版本 (mingw-w64)
build-windows: - xmake f -m release --plat=windows --arch=x86_64 --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++
image: mcr.microsoft.com/windows/servercore:ltsc2022 - xmake -v
commands: - cp `xmake u -o`/Fig.exe dist/Fig-windows.exe
- choco install xmake -y
- choco install llvm -y
- set PATH=C:\Program Files\LLVM\bin;%PATH%
- xmake f -m release --cc=clang --cxx=clang++ --ld=clang++
- xmake -v
- mkdir dist
- copy `xmake u -o`\Fig dist\
# 测试 - name: test
test: image: debian:bookworm
image: debian:bookworm depends_on:
depends_on: - build-and-cross
- build-linux commands:
- build-windows - xmake r test_all || true
commands:
- xmake r test_all || true
# Gitea Release 上传(仅在打 tag 时触发) - name: gitea-release
release: image: debian:bookworm
image: debian:bookworm depends_on:
depends_on: - build-and-cross
- build-linux when:
- build-windows event: tag
when: environment:
event: tag GITEA_TOKEN:
commands: from_secret: GITEA_TOKEN
- TAG_NAME=${DRONE_TAG} # Woodpecker 用 DRONE_TAG 保存 tag GITEA_REPO: "PuqiAR/Fig"
- echo "Uploading Fig binaries for tag $TAG_NAME to Gitea" GITEA_URL: "https://git.fig-lang.cn"
- curl -X POST -H "Authorization: token $GITEA_TOKEN" \ commands:
- TAG_NAME=${DRONE_TAG}
- echo "Uploading Fig binaries for tag $TAG_NAME to Gitea"
# Linux binary
- |
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
-F "name=Fig-linux" \ -F "name=Fig-linux" \
-F "label=Fig Linux binary" \ -F "label=Fig Linux binary" \
-F "file=@dist/Fig" \ -F "file=@dist/Fig-linux" \
"$GITEA_URL/api/v1/repos/$GITEA_REPO/releases/$TAG_NAME/assets"
# Windows binary
- |
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
-F "name=Fig-windows.exe" \
-F "label=Fig Windows binary" \
-F "file=@dist/Fig-windows.exe" \
"$GITEA_URL/api/v1/repos/$GITEA_REPO/releases/$TAG_NAME/assets" "$GITEA_URL/api/v1/repos/$GITEA_REPO/releases/$TAG_NAME/assets"