mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-05-06 23:31:59 +08:00
Replace actions/checkout from v4 to v6 across workflows to prepare for the GitHub Actions Node.js 24 migration and avoid Node.js 20 deprecation risk.
76 lines
2.4 KiB
YAML
76 lines
2.4 KiB
YAML
name: Test Build
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ["main"]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- darwin-amd64
|
|
- darwin-arm64
|
|
- windows-amd64
|
|
- linux-arm64-musl
|
|
- linux-amd64-musl
|
|
- windows-arm64
|
|
- android-arm64
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- uses: benjlevesque/short-sha@v3.0
|
|
id: short-sha
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.25.0"
|
|
|
|
- name: Setup web
|
|
run: bash build.sh dev web
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
|
|
|
|
- name: Build
|
|
uses: OpenListTeam/cgo-actions@v1.2.2
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
flags: ${{ contains(matrix.target, '-musl') && '-ldflags=-linkmode external -extldflags ''-static -fpic''' || '-ldflags=' }}
|
|
static-link-for-musl: true
|
|
musl-target-format: $os-$musl-$arch
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
out-dir: build
|
|
x-flags: |
|
|
github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=$built_at
|
|
github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=The OpenList Projects Contributors <noreply@openlist.team>
|
|
github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=$git_commit
|
|
github.com/OpenListTeam/OpenList/v4/internal/conf.Version=$tag
|
|
github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=rolling
|
|
output: openlist$ext
|
|
|
|
- name: Verify musl binary is static
|
|
if: contains(matrix.target, '-musl')
|
|
run: |
|
|
set -e
|
|
if readelf -l build/openlist | grep -q "Requesting program interpreter"; then
|
|
echo "Dynamic binary detected: build/openlist"
|
|
readelf -l build/openlist | grep "Requesting program interpreter" || true
|
|
exit 1
|
|
fi
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: openlist_${{ steps.short-sha.outputs.sha }}_${{ matrix.target }}
|
|
path: build/*
|