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