-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (133 loc) · 4.21 KB
/
Copy pathRelease.yml
File metadata and controls
149 lines (133 loc) · 4.21 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#
# Manual release workflow - triggered via GitHub UI to create tagged releases
#
# Order: validate -> build/test -> create tag -> create release
#
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v0.1.0)'
required: true
type: string
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false
jobs:
validate:
name: Validate version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate version format
run: |
if [[ ! "${{ inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "Error: Version must match format v0.0.0 or v0.0.0-suffix"
exit 1
fi
- name: Check if tag exists
run: |
if git rev-parse "${{ inputs.version }}" >/dev/null 2>&1; then
echo "Error: Tag ${{ inputs.version }} already exists"
exit 1
fi
build:
name: Build (${{ matrix.duckdb_arch }})
needs: validate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
duckdb_arch: linux_amd64
rust_target: x86_64-unknown-linux-gnu
- os: macos-14
duckdb_arch: osx_amd64
rust_target: x86_64-apple-darwin
osx_build_arch: x86_64
- os: macos-14
duckdb_arch: osx_arm64
rust_target: aarch64-apple-darwin
osx_build_arch: arm64
- os: windows-latest
duckdb_arch: windows_amd64
rust_target: x86_64-pc-windows-msvc
env:
OSX_BUILD_ARCH: ${{ matrix.osx_build_arch }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Build extension (Unix)
if: runner.os != 'Windows'
run: make release
- name: Build extension (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cd yardstick-rs && cargo build --release
cd ..
mkdir -p build/release
cd build/release
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release ../..
cmake --build . --config Release
- name: Test extension
if: matrix.osx_build_arch != 'x86_64' && runner.os != 'Windows'
run: make test
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: yardstick-${{ matrix.duckdb_arch }}
path: build/release/extension/yardstick/yardstick.duckdb_extension
release:
name: Create tag and release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ inputs.version }}" -m "Release ${{ inputs.version }}"
git push origin "${{ inputs.version }}"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release_assets
for dir in artifacts/*/; do
platform=$(basename "$dir")
for ext in "$dir"*.duckdb_extension*; do
[ -f "$ext" ] || continue
filename=$(basename "$ext")
newname="${filename/.duckdb_extension/-${platform}.duckdb_extension}"
cp "$ext" "release_assets/$newname"
done
done
ls -la release_assets/
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
name: ${{ inputs.version }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
files: release_assets/*