Repository navigation
117 lines (105 loc) · 3.82 KB
/
Copy pathfit-release.yml
File metadata and controls
117 lines (105 loc) · 3.82 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: fit-release
# Manual-only: builds pgcache-fit for each target and publishes a GitHub
# Release. Nothing runs until you press "Run workflow".
on:
workflow_dispatch:
inputs:
version:
description: "Release version, e.g. 0.1.0 (tag becomes fit-v<version>)"
required: true
type: string
permissions:
contents: write
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-24.04-arm
steps:
# The pg_query patch (../pg_query.rs) needs the two repos as siblings:
# <workspace>/pgcache (this repo)
# <workspace>/pg_query.rs (with its libpg_query submodule)
- name: Checkout pgcache
uses: actions/checkout@v4
with:
path: pgcache
- name: Checkout pg_query.rs
uses: actions/checkout@v4
with:
repository: PgCache/pg_query.rs
# The fork's pgcache-specific API (pg_nodes, parse_raw_scoped) lives
# on the pgcache branch, not the upstream-tracking default branch.
ref: pgcache
path: pg_query.rs
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# macOS runners already carry clang + cmake, so no dep step is needed
# there. protoc is deliberately absent: the pg_query build regenerates
# src/protobuf.rs only when protoc is present, and we want the committed
# generated file for a reproducible build.
- name: Install Linux build deps
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang cmake musl-tools
- name: Build
working-directory: pgcache
# musl C deps (libpg_query via bindgen, aws-lc-sys) compile with
# musl-gcc; bindgen/libclang run as glibc host tools, so no dlopen fight.
env:
CC_x86_64_unknown_linux_musl: musl-gcc
CC_aarch64_unknown_linux_musl: musl-gcc
run: cargo build --release -p pgcache-fit --target ${{ matrix.target }}
- name: Package
working-directory: pgcache
run: |
bin="target/${{ matrix.target }}/release/pgcache-fit"
strip "$bin"
out="pgcache-fit-${{ inputs.version }}-${{ matrix.target }}"
cp "$bin" "$out"
echo "ASSET=pgcache/$out" >> "$GITHUB_ENV"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: pgcache-fit-${{ matrix.target }}
path: ${{ env.ASSET }}
if-no-files-found: error
release:
name: publish release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
working-directory: dist
run: sha256sum pgcache-fit-* > SHA256SUMS
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: fit-v${{ inputs.version }}
name: pgcache-fit v${{ inputs.version }}
files: |
dist/pgcache-fit-*
dist/SHA256SUMS
body: |
Pre-built `pgcache-fit` binaries. Make one executable with
`chmod +x pgcache-fit-*`, then run it.
macOS binaries are unsigned. Running from the terminal usually
works after `chmod`. Only if macOS refuses ("cannot be verified"),
clear the quarantine flag: `xattr -d com.apple.quarantine ./pgcache-fit-*`