-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (72 loc) · 2.57 KB
/
Copy pathbuild-3rdparty-libco.yml
File metadata and controls
80 lines (72 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build 3rdparty — libco
# Per-platform prebuilt static library for libco, published as release
# assets attached to the `lib-libco-<version>` tag and consumed at
# configure time by build-tools/yaafc/3rdparty-fetch.cmake (which
# downloads the prebuilt tarball, falling back to a from-source build
# only when the asset is missing). Version source of truth:
# build-tools/3rdparty/libco/version.
on:
push:
tags:
- 'lib-libco-*'
workflow_dispatch: {}
permissions:
contents: write
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read.outputs.version }}
tag: ${{ steps.read.outputs.tag }}
steps:
- uses: actions/checkout@v4
- id: read
run: |
set -euo pipefail
V="$(tr -d '[:space:]' < build-tools/3rdparty/libco/version)"
[ -n "$V" ] || { echo "version file is empty" >&2; exit 1; }
if [[ "${{ github.event_name }}" == "push" ]]; then
REF="${GITHUB_REF#refs/tags/}"
EXPECT="lib-libco-$V"
if [ "$REF" != "$EXPECT" ]; then
echo "tag $REF does not match version file ($EXPECT)" >&2
exit 1
fi
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "tag=lib-libco-$V" >> "$GITHUB_OUTPUT"
build:
needs: resolve
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- linux-x86_64
- linux-aarch64
- linux-riscv64
steps:
- uses: actions/checkout@v4
- name: install build deps
run: |
set -euo pipefail
sudo apt-get update -y
pkgs="build-essential cmake ninja-build pkg-config curl tar xz-utils ca-certificates git"
case "${{ matrix.target }}" in
linux-aarch64) pkgs="$pkgs gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu" ;;
linux-riscv64) pkgs="$pkgs gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu" ;;
esac
sudo apt-get install -y --no-install-recommends $pkgs
- name: build libco for ${{ matrix.target }}
run: |
mkdir -p out
TARGET_PLATFORM="${{ matrix.target }}" \
OUTPUT_DIR="$PWD/out" \
CACHE_DIR="$PWD/.cache" \
WORK_DIR="$PWD/.work" \
bash build-tools/3rdparty/libco/_build.sh
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.resolve.outputs.tag }}
files: out/libco-${{ matrix.target }}-*.tar.gz
fail_on_unmatched_files: true