Skip to content

Commit f72d398

Browse files
committed
Fix release workflow: add -O igncr for Cygwin CRLF handling
GitHub Actions writes temp scripts with CRLF on Windows. Without igncr, Cygwin bash treats \r as part of arguments — the download step created googletest-src\r instead of googletest-src, causing the configure step to fail with "source directory does not exist". Changes: - Add -O igncr to Cygwin bash shell spec via defaults.run.shell - Switch multi-command steps from > (folded) to | (literal) blocks - Add verification (ls, test -d) after GoogleTest download - Replace Python release notes with shell heredoc - Use shell: bash for publish step (ensures gh on PATH)
1 parent 245f5d9 commit f72d398

1 file changed

Lines changed: 42 additions & 57 deletions

File tree

.github/workflows/release.yml

Lines changed: 42 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
1313

14-
env:
15-
CYGWIN_SHELL: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
16-
1714
jobs:
1815
release:
1916
runs-on: windows-latest
2017
name: Build and publish Cygwin x86_64
2118
timeout-minutes: 90
19+
defaults:
20+
run:
21+
shell: C:\cygwin\bin\bash.exe --noprofile --norc -O igncr -eo pipefail '{0}'
2222

2323
steps:
2424
- run: git config --global core.autocrlf input
25+
shell: bash
2526

2627
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2728

@@ -35,38 +36,34 @@ jobs:
3536
curl
3637
3738
- 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)"
39+
run: |
40+
echo "GCC: $(g++ -dumpfullversion)"
41+
echo "CMake: $(cmake --version | head -1)"
42+
echo "Cygwin: $(uname -r)"
43+
echo "CWD: $(pwd)"
4344
4445
- name: Download GoogleTest
45-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
46-
run: >
46+
run: |
4747
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
48+
ls -l gtest.tar.gz
49+
tar xzf gtest.tar.gz
50+
mv googletest-1.16.0 googletest-src
51+
test -d googletest-src
5052
5153
- name: Configure GoogleTest
52-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
5354
run: >
5455
cmake -S googletest-src -B gtest-build -G Ninja
5556
-DCMAKE_CXX_STANDARD=17
5657
-DCMAKE_BUILD_TYPE=Release
5758
-DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
5859
-DCMAKE_INSTALL_PREFIX="$PWD/staging/usr/local/lib/absl/vendor"
5960
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
61+
- name: Build and install GoogleTest
62+
run: |
63+
ninja -C gtest-build -j4
64+
cmake --install gtest-build
6765
6866
- name: Configure Abseil
69-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
7067
run: >
7168
cmake -S . -B build -G Ninja
7269
-DCMAKE_CXX_STANDARD=17
@@ -78,48 +75,38 @@ jobs:
7875
-DABSL_FIND_GOOGLETEST=ON
7976
8077
- name: Build Abseil
81-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
8278
run: ninja -C build -j4
8379

8480
- name: Test
85-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
8681
run: ctest --test-dir build --timeout 300 --output-on-failure
8782

8883
- name: Install Abseil
89-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
9084
run: cmake --install build --prefix "$PWD/staging/usr/local"
9185

9286
- 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
87+
run: |
88+
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' >> staging/usr/local/lib/cmake/absl/abslConfig.cmake
9789
9890
- 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
91+
run: tar czf "abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" -C staging usr
10292

10393
- name: Checksum
104-
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
105-
run: >
94+
run: |
10695
sha256sum "abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" > checksums-sha256.txt
107-
&& cat checksums-sha256.txt
96+
cat checksums-sha256.txt
10897
10998
- 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
99+
run: |
100+
tag="$GITHUB_REF_NAME"
101+
ver="${tag%-cygwin}"
102+
artifact="abseil-cpp-${tag}-x86_64.tar.gz"
103+
gcc="$(g++ -dumpfullversion)"
104+
cmake_ver="$(cmake --version | head -1)"
105+
cygwin_ver="$(uname -r)"
106+
cat > release-notes.md <<EOF
107+
Pre-built static libraries and headers for Cygwin x86_64.
108+
109+
**Build environment**: GCC ${gcc}, ${cmake_ver}, Cygwin ${cygwin_ver}, Release mode
123110
**ABI**: \`-D_GLIBCXX_USE_CXX11_ABI=1\` (SSO strings, required for Protobuf compatibility)
124111
**Prefix**: \`/usr/local\` (does not conflict with system abseil in \`/usr\`)
125112
**GoogleTest**: 1.16.0, vendored at \`lib/absl/vendor/\`
@@ -129,7 +116,7 @@ jobs:
129116
Extract at the filesystem root to install into \`/usr/local\`:
130117
131118
\`\`\`bash
132-
cd / && tar xzf {artifact}
119+
cd / && tar xzf ${artifact}
133120
\`\`\`
134121
135122
Verify checksum:
@@ -159,16 +146,14 @@ jobs:
159146
160147
These binaries support the Cygwin port of Protocol Buffers 7.35.0 at
161148
[phdye-cygwin/protobuf](https://github.com/phdye-cygwin/protobuf).
162-
''';
163-
open('release-notes.md', 'w').write(body)
164-
"
149+
EOF
165150
166151
- name: Publish release
152+
shell: bash
167153
env:
168154
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
155+
run: |
156+
gh release create "$GITHUB_REF_NAME" \
157+
--title "Abseil LTS ${GITHUB_REF_NAME%-cygwin} — Cygwin x86_64" \
158+
--notes-file release-notes.md \
159+
"abseil-cpp-$GITHUB_REF_NAME-x86_64.tar.gz" checksums-sha256.txt

0 commit comments

Comments
 (0)