Skip to content

Commit 6bb3d2b

Browse files
committed
rc.yml
1 parent 32d2cd1 commit 6bb3d2b

File tree

1 file changed

+123
-53
lines changed

1 file changed

+123
-53
lines changed

.github/workflows/rc.yml

Lines changed: 123 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,81 +15,151 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
name: Release Candidate
19-
18+
name: RC
2019
on:
2120
push:
21+
branches:
22+
- '**'
23+
- '!dependabot/**'
2224
tags:
23-
- 'v*-rc*'
25+
- '*-rc*'
26+
pull_request:
27+
28+
concurrency:
29+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
30+
cancel-in-progress: true
31+
permissions:
32+
contents: read
2433

2534
jobs:
26-
build-source-tarball:
35+
archive:
36+
name: Archive
2737
runs-on: ubuntu-latest
28-
38+
timeout-minutes: 10 # C++ submodules might take longer
2939
steps:
30-
- name: Checkout repository
40+
- name: Checkout with submodules
3141
uses: actions/checkout@v4
42+
with:
43+
submodules: 'recursive' # CRITICAL for C++ projects with dependencies
3244

33-
- name: Extract version from tag
34-
id: extract_version
45+
- name: Prepare for tag
46+
if: github.ref_type == 'tag'
3547
run: |
36-
TAG_NAME=${GITHUB_REF#refs/tags/}
37-
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
38-
VERSION=$(echo ${TAG_NAME} | sed 's/^v//' | sed 's/-rc.*$//')
39-
RC=$(echo ${TAG_NAME} | sed 's/.*-rc//')
40-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
41-
echo "rc=${RC}" >> $GITHUB_OUTPUT
42-
echo "release_id=apache-iceberg-cpp-${VERSION}-rc${RC}" >> $GITHUB_OUTPUT
43-
44-
- name: Install dependencies
48+
version=${GITHUB_REF_NAME#v}
49+
version=${version%-rc*}
50+
rc=${GITHUB_REF_NAME##*-rc}
51+
echo "VERSION=${version}" >> ${GITHUB_ENV}
52+
echo "RC=${rc}" >> ${GITHUB_ENV}
53+
echo "VERSION=${version}"
54+
echo "RC=${rc}"
55+
56+
- name: Prepare for branch
57+
if: github.ref_type == 'branch'
4558
run: |
46-
sudo apt-get update
47-
sudo apt-get install -y cmake build-essential
59+
# Extract version from a file like VERSION.txt or CMakeLists.txt for branches
60+
# For simplicity, we'll hardcode a dev version here.
61+
version="0.1.0-dev"
62+
rc=100
63+
echo "VERSION=${version}" >> ${GITHUB_ENV}
64+
echo "RC=${rc}" >> ${GITHUB_ENV}
65+
echo "VERSION=${version}"
66+
echo "RC=${rc}"
4867
49-
- name: Create source tarball
68+
- name: Archive
5069
run: |
51-
# Create archive with git
52-
git archive --format=tar.gz --output="${{ steps.extract_version.outputs.release_id }}.tar.gz" --prefix="${{ steps.extract_version.outputs.release_id }}/" HEAD
70+
id="apache-iceberg-cpp-${VERSION}-rc${RC}"
71+
tar_gz="${id}.tar.gz"
72+
echo "TAR_GZ=${tar_gz}" >> ${GITHUB_ENV}
73+
# Use tar instead of git archive to include submodules
74+
tar -czf "${tar_gz}" --transform "s,^./,${id}/," .
75+
sha512sum "${tar_gz}" > "${tar_gz}.sha512"
5376
54-
# Generate SHA512 checksum
55-
sha512sum "${{ steps.extract_version.outputs.release_id }}.tar.gz" > "${{ steps.extract_version.outputs.release_id }}.tar.gz.sha512"
77+
- name: Audit
78+
run: |
79+
# Make sure this script exists in your C++ repository
80+
dev/release/run_rat.sh "${TAR_GZ}"
5681
57-
# Verify the tarball can be extracted and built
58-
tar -xzf "${{ steps.extract_version.outputs.release_id }}.tar.gz"
59-
cd "${{ steps.extract_version.outputs.release_id }}"
82+
- uses: actions/upload-artifact@v4
83+
with:
84+
name: archive
85+
path: |
86+
apache-iceberg-cpp-*
6087
61-
# Basic build test
62-
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
63-
cmake --build build --parallel $(nproc)
88+
verify:
89+
name: Verify
90+
needs:
91+
- archive
92+
runs-on: ${{ matrix.os }}
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
os:
97+
- macos-latest
98+
- ubuntu-latest
99+
# Consider adding windows-latest if your project supports it
100+
# - windows-latest
101+
steps:
102+
- name: Install C++ Build Tools (Ubuntu)
103+
if: runner.os == 'Linux'
104+
run: |
105+
sudo apt-get update
106+
sudo apt-get install -y build-essential cmake ninja-build libssl-dev
64107
65-
- name: Run license check
108+
- name: Install C++ Build Tools (macOS)
109+
if: runner.os == 'macOS'
66110
run: |
67-
# Extract the tarball if not already extracted
68-
if [ ! -d "${{ steps.extract_version.outputs.release_id }}" ]; then
69-
tar -xzf "${{ steps.extract_version.outputs.release_id }}.tar.gz"
70-
fi
111+
brew install cmake ninja openssl
71112
72-
cd "${{ steps.extract_version.outputs.release_id }}"
73-
dev/release/run_rat.sh .
113+
- name: Checkout
114+
uses: actions/checkout@v4
74115

75-
- name: Create GitHub Release
76-
uses: softprops/action-gh-release@v1
116+
- uses: actions/download-artifact@v4
77117
with:
78-
tag_name: ${{ steps.extract_version.outputs.tag_name }}
79-
name: Apache Iceberg C++ ${{ steps.extract_version.outputs.version }} RC${{ steps.extract_version.outputs.rc }}
80-
prerelease: true
81-
draft: false
82-
files: |
83-
${{ steps.extract_version.outputs.release_id }}.tar.gz
84-
${{ steps.extract_version.outputs.release_id }}.tar.gz.sha512
118+
name: archive
119+
120+
- name: Verify
121+
run: |
122+
tar_gz=$(echo apache-iceberg-cpp-*.tar.gz)
123+
version=${tar_gz#apache-iceberg-cpp-}
124+
version=${version%.tar.gz}
125+
version=${version%%-rc*}
126+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
127+
rc=${GITHUB_REF_NAME##*-rc}
128+
else
129+
rc=100
130+
fi
131+
echo "VERSION=${version}"
132+
echo "RC=${rc}"
133+
# You MUST create this verify_rc.sh script for C++
134+
# It should untar, cmake, build, and run tests (ctest)
135+
dev/release/verify_rc.sh "${version}" "${rc}"
85136
env:
86137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87138

88-
- name: Upload artifacts
89-
uses: actions/upload-artifact@v4
139+
upload:
140+
name: Upload
141+
if: github.ref_type == 'tag'
142+
needs:
143+
- verify
144+
runs-on: ubuntu-latest
145+
permissions:
146+
contents: write
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v4
150+
151+
- uses: actions/download-artifact@v4
90152
with:
91-
name: release-candidate-${{ steps.extract_version.outputs.version }}-rc${{ steps.extract_version.outputs.rc }}
92-
path: |
93-
${{ steps.extract_version.outputs.release_id }}.tar.gz
94-
${{ steps.extract_version.outputs.release_id }}.tar.gz.sha512
95-
retention-days: 30
153+
name: archive
154+
155+
- name: Upload
156+
run: |
157+
gh release create ${GITHUB_REF_NAME} \
158+
--prerelease \
159+
--title "Apache Iceberg C++ ${GITHUB_REF_NAME}" \
160+
--generate-notes \
161+
--verify-tag \
162+
apache-iceberg-cpp-*.tar.gz \
163+
apache-iceberg-cpp-*.tar.gz.sha*
164+
env:
165+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)