46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: Cross Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
target_arch:
|
|
- "mipsle-softfloat"
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.21'
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-mips-linux-gnu gcc-arm-linux-gnueabihf
|
|
|
|
- name: Build
|
|
env:
|
|
# 直接基于已知格式设置 GOARCH 和 GOMIPS
|
|
GOARCH: ${{ contains(matrix.target_arch, 'mipsle') && 'mipsle' || '' }}
|
|
GOMIPS: ${{ contains(matrix.target_arch, 'softfloat') && 'softfloat' || '' }}
|
|
CGO_ENABLED: 0
|
|
run: |
|
|
echo "Building for GOARCH=${GOARCH} GOMIPS=${GOMIPS}"
|
|
GOOS=linux go build -v -ldflags '-s -w' -o cloudflared-${{ matrix.target_arch }} ./cmd/cloudflared
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cloudflared-${{ matrix.target_arch }}
|
|
path: cloudflared-${{ matrix.target_arch }}
|