Skip to content

Commit 245f5d9

Browse files
committed
Add release workflow for automated Cygwin binary distribution
Upstream PR abseil#2012 has stalled, so the fork needs to distribute independently. This workflow replicates the manual release process: vendor GoogleTest 1.16.0, build Abseil with external GTest, patch abslConfig.cmake, and publish a tarball with SHA-256 checksums. Triggered on tag push matching *-cygwin (e.g. 20250512.1-cygwin). Full test suite must pass before any artifacts are published.
1 parent 986d4f5 commit 245f5d9

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed

.github/workflows/release.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: Release (Cygwin)
2+
3+
on:
4+
push:
5+
tags: ['*-cygwin']
6+
7+
permissions:
8+
contents: write
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
CYGWIN_SHELL: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
16+
17+
jobs:
18+
release:
19+
runs-on: windows-latest
20+
name: Build and publish Cygwin x86_64
21+
timeout-minutes: 90
22+
23+
steps:
24+
- run: git config --global core.autocrlf input
25+
26+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
27+
28+
- uses: cygwin/cygwin-install-action@8be4a7277a684c177c0fefca7d75c9c24a45055e # v6
29+
with:
30+
packages: |
31+
gcc-g++
32+
cmake
33+
make
34+
ninja
35+
curl
36+
37+
- name: Build environment
38+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
39+
run: >
40+
echo "GCC: $(g++ -dumpfullversion),
41+
$(cmake --version | head -1),
42+
Cygwin $(uname -r)"
43+
44+
- name: Download GoogleTest
45+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
46+
run: >
47+
curl -fL -o gtest.tar.gz https://github.com/google/googletest/archive/refs/tags/v1.16.0.tar.gz
48+
&& tar xzf gtest.tar.gz
49+
&& mv googletest-1.16.0 googletest-src
50+
51+
- name: Configure GoogleTest
52+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
53+
run: >
54+
cmake -S googletest-src -B gtest-build -G Ninja
55+
-DCMAKE_CXX_STANDARD=17
56+
-DCMAKE_BUILD_TYPE=Release
57+
-DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
58+
-DCMAKE_INSTALL_PREFIX="$PWD/staging/usr/local/lib/absl/vendor"
59+
60+
- name: Build GoogleTest
61+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
62+
run: ninja -C gtest-build -j4
63+
64+
- name: Install GoogleTest
65+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
66+
run: cmake --install gtest-build
67+
68+
- name: Configure Abseil
69+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
70+
run: >
71+
cmake -S . -B build -G Ninja
72+
-DCMAKE_CXX_STANDARD=17
73+
-DCMAKE_BUILD_TYPE=Release
74+
-DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1 -DGTEST_HAS_PTHREAD=1"
75+
-DCMAKE_PREFIX_PATH="$PWD/staging/usr/local/lib/absl/vendor"
76+
-DABSL_BUILD_TESTING=ON
77+
-DABSL_USE_EXTERNAL_GOOGLETEST=ON
78+
-DABSL_FIND_GOOGLETEST=ON
79+
80+
- name: Build Abseil
81+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
82+
run: ninja -C build -j4
83+
84+
- name: Test
85+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
86+
run: ctest --test-dir build --timeout 300 --output-on-failure
87+
88+
- name: Install Abseil
89+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
90+
run: cmake --install build --prefix "$PWD/staging/usr/local"
91+
92+
- name: Patch abslConfig.cmake for vendored GoogleTest
93+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
94+
run: >
95+
printf '\n# Vendored GoogleTest for test helper targets (scoped_mock_log, status_matchers)\nif(NOT TARGET GTest::gtest)\n find_package(GTest QUIET HINTS "${CMAKE_CURRENT_LIST_DIR}/../../absl/vendor/lib/cmake/GTest")\nendif()\n'
96+
>> staging/usr/local/lib/cmake/absl/abslConfig.cmake
97+
98+
- name: Package
99+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
100+
run: >
101+
tar czf "abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" -C staging usr
102+
103+
- name: Checksum
104+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
105+
run: >
106+
sha256sum "abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" > checksums-sha256.txt
107+
&& cat checksums-sha256.txt
108+
109+
- name: Create release notes
110+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
111+
run: >
112+
python3 -c "
113+
import subprocess, os;
114+
tag = os.environ['GITHUB_REF_NAME'];
115+
ver = tag.replace('-cygwin', '');
116+
artifact = f'abseil-cpp-{tag}-x86_64.tar.gz';
117+
gcc = subprocess.check_output(['g++', '-dumpfullversion']).decode().strip();
118+
cmake = subprocess.check_output(['cmake', '--version']).decode().split('\n')[0];
119+
cygwin = subprocess.check_output(['uname', '-r']).decode().strip();
120+
body = f'''Pre-built static libraries and headers for Cygwin x86_64.
121+
122+
**Build environment**: GCC {gcc}, {cmake}, Cygwin {cygwin}, Release mode
123+
**ABI**: \`-D_GLIBCXX_USE_CXX11_ABI=1\` (SSO strings, required for Protobuf compatibility)
124+
**Prefix**: \`/usr/local\` (does not conflict with system abseil in \`/usr\`)
125+
**GoogleTest**: 1.16.0, vendored at \`lib/absl/vendor/\`
126+
127+
## Installation
128+
129+
Extract at the filesystem root to install into \`/usr/local\`:
130+
131+
\`\`\`bash
132+
cd / && tar xzf {artifact}
133+
\`\`\`
134+
135+
Verify checksum:
136+
137+
\`\`\`bash
138+
sha256sum -c checksums-sha256.txt
139+
\`\`\`
140+
141+
## Contents
142+
143+
- Libraries in \`/usr/local/lib/libabsl_*.a\`
144+
- Headers in \`/usr/local/include/absl/\`
145+
- CMake config in \`/usr/local/lib/cmake/absl/\`
146+
- Vendored GoogleTest in \`/usr/local/lib/absl/vendor/\`
147+
- pkg-config in \`/usr/local/lib/pkgconfig/absl_*.pc\`
148+
149+
## Usage
150+
151+
\`\`\`cmake
152+
list(APPEND CMAKE_PREFIX_PATH /usr/local)
153+
find_package(absl REQUIRED)
154+
\`\`\`
155+
156+
No separate \`find_package(GTest)\` is needed.
157+
158+
## Purpose
159+
160+
These binaries support the Cygwin port of Protocol Buffers 7.35.0 at
161+
[phdye-cygwin/protobuf](https://github.com/phdye-cygwin/protobuf).
162+
''';
163+
open('release-notes.md', 'w').write(body)
164+
"
165+
166+
- name: Publish release
167+
env:
168+
GH_TOKEN: ${{ github.token }}
169+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
170+
run: >
171+
gh release create "$GITHUB_REF_NAME"
172+
--title "Abseil LTS ${GITHUB_REF_NAME%-cygwin} — Cygwin x86_64"
173+
--notes-file release-notes.md
174+
"abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" checksums-sha256.txt

0 commit comments

Comments
 (0)