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