Files
Fig-TreeWalker/.woodpecker.yml
2026-01-02 17:31:02 +08:00

73 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Woodpecker CI for Fig language
# Linux + Windows cross compile
# 国内源 + apt cache适合 WSL2 Docker Runner
volumes:
- name: apt-cache
path: /var/cache/apt
steps:
- name: build-and-cross
image: ubuntu:24.04
volumes:
- type: cache
name: apt-cache
path: /var/cache/apt
commands:
# 换源加速
- cp /etc/apt/sources.list /etc/apt/sources.list.bak
- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse" >> /etc/apt/sources.list
# 安装依赖apt cache 会复用)
- 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=$PATH:/root/.xmake/bin
# 构建 Linux release
- xmake f -m release
- xmake -v
- mkdir -p dist
- cp `xmake u -o`/Fig dist/Fig-linux
# 构建 Windows release (cross compile)
- xmake f -m release --plat=windows --arch=x86_64 --cc=x86_64-w64-mingw32-g++ --cxx=x86_64-w64-mingw32-g++
- xmake -v
- cp `xmake u -o`/Fig.exe dist/Fig-windows.exe
- name: gitea-release
image: ubuntu:24.04
volumes:
- type: cache
name: apt-cache
path: /var/cache/apt
when:
event: tag
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
GITEA_REPO: "PuqiAR/Fig"
GITEA_URL: "https://git.fig-lang.cn"
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 "label=Fig Linux binary" \
-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"